|
From: <ls...@us...> - 2007-11-18 15:16:57
|
Revision: 3597
http://jnode.svn.sourceforge.net/jnode/?rev=3597&view=rev
Author: lsantha
Date: 2007-11-18 07:16:56 -0800 (Sun, 18 Nov 2007)
Log Message:
-----------
OpenJDK integration.
Added Paths:
-----------
trunk/core/src/openjdk/javax/javax/net/ServerSocketFactory.java
trunk/core/src/openjdk/javax/javax/net/SocketFactory.java
trunk/core/src/openjdk/javax/javax/net/package.html
trunk/core/src/openjdk/javax/javax/net/ssl/CertPathTrustManagerParameters.java
trunk/core/src/openjdk/javax/javax/net/ssl/HandshakeCompletedEvent.java
trunk/core/src/openjdk/javax/javax/net/ssl/HandshakeCompletedListener.java
trunk/core/src/openjdk/javax/javax/net/ssl/HostnameVerifier.java
trunk/core/src/openjdk/javax/javax/net/ssl/HttpsURLConnection.java
trunk/core/src/openjdk/javax/javax/net/ssl/KeyManager.java
trunk/core/src/openjdk/javax/javax/net/ssl/KeyManagerFactory.java
trunk/core/src/openjdk/javax/javax/net/ssl/KeyManagerFactorySpi.java
trunk/core/src/openjdk/javax/javax/net/ssl/KeyStoreBuilderParameters.java
trunk/core/src/openjdk/javax/javax/net/ssl/ManagerFactoryParameters.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLEngine.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLEngineResult.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLException.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLHandshakeException.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLKeyException.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLPeerUnverifiedException.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLPermission.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLProtocolException.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLServerSocket.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLServerSocketFactory.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLSession.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLSessionBindingEvent.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLSessionBindingListener.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLSessionContext.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLSocketFactory.java
trunk/core/src/openjdk/javax/javax/net/ssl/TrustManager.java
trunk/core/src/openjdk/javax/javax/net/ssl/TrustManagerFactory.java
trunk/core/src/openjdk/javax/javax/net/ssl/TrustManagerFactorySpi.java
trunk/core/src/openjdk/javax/javax/net/ssl/X509ExtendedKeyManager.java
trunk/core/src/openjdk/javax/javax/net/ssl/X509KeyManager.java
trunk/core/src/openjdk/javax/javax/net/ssl/X509TrustManager.java
trunk/core/src/openjdk/javax/javax/net/ssl/package.html
trunk/core/src/openjdk/sun/sun/net/www/protocol/https/
trunk/core/src/openjdk/sun/sun/net/www/protocol/https/DefaultHostnameVerifier.java
Removed Paths:
-------------
trunk/core/src/classpath/javax/javax/net/
Added: trunk/core/src/openjdk/javax/javax/net/ServerSocketFactory.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/net/ServerSocketFactory.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/net/ServerSocketFactory.java 2007-11-18 15:16:56 UTC (rev 3597)
@@ -0,0 +1,234 @@
+/*
+ * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.net;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.SocketException;
+
+/**
+ * This class creates server sockets. It may be subclassed by other
+ * factories, which create particular types of server sockets. This
+ * provides a general framework for the addition of public socket-level
+ * functionality. It is the server side analogue of a socket factory,
+ * and similarly provides a way to capture a variety of policies related
+ * to the sockets being constructed.
+ *
+ * <P> Like socket factories, server Socket factory instances have
+ * methods used to create sockets. There is also an environment
+ * specific default server socket factory; frameworks will often use
+ * their own customized factory.
+ *
+ * @since 1.4
+ * @see SocketFactory
+ *
+ * @version 1.27
+ * @author David Brownell
+ */
+public abstract class ServerSocketFactory
+{
+ //
+ // NOTE: JDK 1.1 bug in class GC, this can get collected
+ // even though it's always accessible via getDefault().
+ //
+ private static ServerSocketFactory theFactory;
+
+
+ /**
+ * Creates a server socket factory.
+ */
+ protected ServerSocketFactory() { /* NOTHING */ }
+
+ /**
+ * Returns a copy of the environment's default socket factory.
+ *
+ * @return the <code>ServerSocketFactory</code>
+ */
+ public static ServerSocketFactory getDefault()
+ {
+ synchronized (ServerSocketFactory.class) {
+ if (theFactory == null) {
+ //
+ // Different implementations of this method could
+ // work rather differently. For example, driving
+ // this from a system property, or using a different
+ // implementation than JavaSoft's.
+ //
+ theFactory = new DefaultServerSocketFactory();
+ }
+ }
+
+ return theFactory;
+ }
+
+
+ /**
+ * Returns an unbound server socket. The socket is configured with
+ * the socket options (such as accept timeout) given to this factory.
+ *
+ * @return the unbound socket
+ * @throws IOException if the socket cannot be created
+ * @see java.net.ServerSocket#bind(java.net.SocketAddress)
+ * @see java.net.ServerSocket#bind(java.net.SocketAddress, int)
+ * @see java.net.ServerSocket#ServerSocket()
+ */
+ public ServerSocket createServerSocket() throws IOException {
+ throw new SocketException("Unbound server sockets not implemented");
+ }
+
+ /**
+ * Returns a server socket bound to the specified port.
+ * The socket is configured with the socket options
+ * (such as accept timeout) given to this factory.
+ * <P>
+ * If there is a security manager, its <code>checkListen</code>
+ * method is called with the <code>port</code> argument as its
+ * argument to ensure the operation is allowed. This could result
+ * in a SecurityException.
+ *
+ * @param port the port to listen to
+ * @return the <code>ServerSocket</code>
+ * @throws IOException for networking errors
+ * @throws SecurityException if a security manager exists and its
+ * <code>checkListen</code> method doesn't allow the operation.
+ * @throws IllegalArgumentException if the port parameter is outside the
+ * specified range of valid port values, which is between 0 and
+ * 65535, inclusive.
+ * @see SecurityManager#checkListen
+ * @see java.net.ServerSocket#ServerSocket(int)
+ */
+ public abstract ServerSocket createServerSocket(int port)
+ throws IOException;
+
+
+ /**
+ * Returns a server socket bound to the specified port, and uses the
+ * specified connection backlog. The socket is configured with
+ * the socket options (such as accept timeout) given to this factory.
+ * <P>
+ * The <code>backlog</code> argument must be a positive
+ * value greater than 0. If the value passed if equal or less
+ * than 0, then the default value will be assumed.
+ * <P>
+ * If there is a security manager, its <code>checkListen</code>
+ * method is called with the <code>port</code> argument as its
+ * argument to ensure the operation is allowed. This could result
+ * in a SecurityException.
+ *
+ * @param port the port to listen to
+ * @param backlog how many connections are queued
+ * @return the <code>ServerSocket</code>
+ * @throws IOException for networking errors
+ * @throws SecurityException if a security manager exists and its
+ * <code>checkListen</code> method doesn't allow the operation.
+ * @throws IllegalArgumentException if the port parameter is outside the
+ * specified range of valid port values, which is between 0 and
+ * 65535, inclusive.
+ * @see SecurityManager#checkListen
+ * @see java.net.ServerSocket#ServerSocket(int, int)
+ */
+ public abstract ServerSocket
+ createServerSocket(int port, int backlog)
+ throws IOException;
+
+
+ /**
+ * Returns a server socket bound to the specified port,
+ * with a specified listen backlog and local IP.
+ * <P>
+ * The <code>ifAddress</code> argument can be used on a multi-homed
+ * host for a <code>ServerSocket</code> that will only accept connect
+ * requests to one of its addresses. If <code>ifAddress</code> is null,
+ * it will accept connections on all local addresses. The socket is
+ * configured with the socket options (such as accept timeout) given
+ * to this factory.
+ * <P>
+ * The <code>backlog</code> argument must be a positive
+ * value greater than 0. If the value passed if equal or less
+ * than 0, then the default value will be assumed.
+ * <P>
+ * If there is a security manager, its <code>checkListen</code>
+ * method is called with the <code>port</code> argument as its
+ * argument to ensure the operation is allowed. This could result
+ * in a SecurityException.
+ *
+ * @param port the port to listen to
+ * @param backlog how many connections are queued
+ * @param ifAddress the network interface address to use
+ * @return the <code>ServerSocket</code>
+ * @throws IOException for networking errors
+ * @throws SecurityException if a security manager exists and its
+ * <code>checkListen</code> method doesn't allow the operation.
+ * @throws IllegalArgumentException if the port parameter is outside the
+ * specified range of valid port values, which is between 0 and
+ * 65535, inclusive.
+ * @see SecurityManager#checkListen
+ * @see java.net.ServerSocket#ServerSocket(int, int, java.net.InetAddress)
+ */
+ public abstract ServerSocket
+ createServerSocket(int port, int backlog, InetAddress ifAddress)
+ throws IOException;
+}
+
+
+//
+// The default factory has NO intelligence. In fact it's not clear
+// what sort of intelligence servers need; the onus is on clients,
+// who have to know how to tunnel etc.
+//
+class DefaultServerSocketFactory extends ServerSocketFactory {
+
+ DefaultServerSocketFactory()
+ {
+ /* NOTHING */
+ }
+
+ public ServerSocket createServerSocket()
+ throws IOException
+ {
+ return new ServerSocket();
+ }
+
+ public ServerSocket createServerSocket(int port)
+ throws IOException
+ {
+ return new ServerSocket(port);
+ }
+
+ public ServerSocket createServerSocket(int port, int backlog)
+ throws IOException
+ {
+ return new ServerSocket(port, backlog);
+ }
+
+ public ServerSocket
+ createServerSocket(int port, int backlog, InetAddress ifAddress)
+ throws IOException
+ {
+ return new ServerSocket(port, backlog, ifAddress);
+ }
+}
Added: trunk/core/src/openjdk/javax/javax/net/SocketFactory.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/net/SocketFactory.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/net/SocketFactory.java 2007-11-18 15:16:56 UTC (rev 3597)
@@ -0,0 +1,282 @@
+/*
+ * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+
+package javax.net;
+
+import java.io.IOException;
+import java.net.*;
+
+
+/**
+ * This class creates sockets. It may be subclassed by other factories,
+ * which create particular subclasses of sockets and thus provide a general
+ * framework for the addition of public socket-level functionality.
+ *
+ * <P> Socket factories are a simple way to capture a variety of policies
+ * related to the sockets being constructed, producing such sockets in
+ * a way which does not require special configuration of the code which
+ * asks for the sockets: <UL>
+ *
+ * <LI> Due to polymorphism of both factories and sockets, different
+ * kinds of sockets can be used by the same application code just
+ * by passing it different kinds of factories.
+ *
+ * <LI> Factories can themselves be customized with parameters used
+ * in socket construction. So for example, factories could be
+ * customized to return sockets with different networking timeouts
+ * or security parameters already configured.
+ *
+ * <LI> The sockets returned to the application can be subclasses
+ * of java.net.Socket, so that they can directly expose new APIs
+ * for features such as compression, security, record marking,
+ * statistics collection, or firewall tunneling.
+ *
+ * </UL>
+ *
+ * <P> Factory classes are specified by environment-specific configuration
+ * mechanisms. For example, the <em>getDefault</em> method could return
+ * a factory that was appropriate for a particular user or applet, and a
+ * framework could use a factory customized to its own purposes.
+ *
+ * @since 1.4
+ * @see ServerSocketFactory
+ *
+ * @version 1.24
+ * @author David Brownell
+ */
+public abstract class SocketFactory
+{
+ //
+ // NOTE: JDK 1.1 bug in class GC, this can get collected
+ // even though it's always accessible via getDefault().
+ //
+ private static SocketFactory theFactory;
+
+ /**
+ * Creates a <code>SocketFactory</code>.
+ */
+ protected SocketFactory() { /* NOTHING */ }
+
+
+ /**
+ * Returns a copy of the environment's default socket factory.
+ *
+ * @return the default <code>SocketFactory</code>
+ */
+ public static SocketFactory getDefault()
+ {
+ synchronized (SocketFactory.class) {
+ if (theFactory == null) {
+ //
+ // Different implementations of this method SHOULD
+ // work rather differently. For example, driving
+ // this from a system property, or using a different
+ // implementation than JavaSoft's.
+ //
+ theFactory = new DefaultSocketFactory();
+ }
+ }
+
+ return theFactory;
+ }
+
+
+ /**
+ * Creates an unconnected socket.
+ *
+ * @return the unconnected socket
+ * @throws IOException if the socket cannot be created
+ * @see java.net.Socket#connect(java.net.SocketAddress)
+ * @see java.net.Socket#connect(java.net.SocketAddress, int)
+ * @see java.net.Socket#Socket()
+ */
+ public Socket createSocket() throws IOException {
+ throw new SocketException("Unconnected sockets not implemented");
+ }
+
+
+ /**
+ * Creates a socket and connects it to the specified remote host
+ * at the specified remote port. This socket is configured using
+ * the socket options established for this factory.
+ * <p>
+ * If there is a security manager, its <code>checkConnect</code>
+ * method is called with the host address and <code>port</code>
+ * as its arguments. This could result in a SecurityException.
+ *
+ * @param host the server host name with which to connect, or
+ * <code>null</code> for the loopback address.
+ * @param port the server port
+ * @return the <code>Socket</code>
+ * @throws IOException if an I/O error occurs when creating the socket
+ * @throws SecurityException if a security manager exists and its
+ * <code>checkConnect</code> method doesn't allow the operation.
+ * @throws UnknownHostException if the host is not known
+ * @throws IllegalArgumentException if the port parameter is outside the
+ * specified range of valid port values, which is between 0 and
+ * 65535, inclusive.
+ * @see SecurityManager#checkConnect
+ * @see java.net.Socket#Socket(String, int)
+ */
+ public abstract Socket createSocket(String host, int port)
+ throws IOException, UnknownHostException;
+
+
+ /**
+ * Creates a socket and connects it to the specified remote host
+ * on the specified remote port.
+ * The socket will also be bound to the local address and port supplied.
+ * This socket is configured using
+ * the socket options established for this factory.
+ * <p>
+ * If there is a security manager, its <code>checkConnect</code>
+ * method is called with the host address and <code>port</code>
+ * as its arguments. This could result in a SecurityException.
+ *
+ * @param host the server host name with which to connect, or
+ * <code>null</code> for the loopback address.
+ * @param port the server port
+ * @param localHost the local address the socket is bound to
+ * @param localPort the local port the socket is bound to
+ * @return the <code>Socket</code>
+ * @throws IOException if an I/O error occurs when creating the socket
+ * @throws SecurityException if a security manager exists and its
+ * <code>checkConnect</code> method doesn't allow the operation.
+ * @throws UnknownHostException if the host is not known
+ * @throws IllegalArgumentException if the port parameter or localPort
+ * parameter is outside the specified range of valid port values,
+ * which is between 0 and 65535, inclusive.
+ * @see SecurityManager#checkConnect
+ * @see java.net.Socket#Socket(String, int, java.net.InetAddress, int)
+ */
+ public abstract Socket
+ createSocket(String host, int port, InetAddress localHost, int localPort)
+ throws IOException, UnknownHostException;
+
+
+ /**
+ * Creates a socket and connects it to the specified port number
+ * at the specified address. This socket is configured using
+ * the socket options established for this factory.
+ * <p>
+ * If there is a security manager, its <code>checkConnect</code>
+ * method is called with the host address and <code>port</code>
+ * as its arguments. This could result in a SecurityException.
+ *
+ * @param host the server host
+ * @param port the server port
+ * @return the <code>Socket</code>
+ * @throws IOException if an I/O error occurs when creating the socket
+ * @throws SecurityException if a security manager exists and its
+ * <code>checkConnect</code> method doesn't allow the operation.
+ * @throws IllegalArgumentException if the port parameter is outside the
+ * specified range of valid port values, which is between 0 and
+ * 65535, inclusive.
+ * @throws NullPointerException if <code>host</code> is null.
+ * @see SecurityManager#checkConnect
+ * @see java.net.Socket#Socket(java.net.InetAddress, int)
+ */
+ public abstract Socket createSocket(InetAddress host, int port)
+ throws IOException;
+
+
+ /**
+ * Creates a socket and connect it to the specified remote address
+ * on the specified remote port. The socket will also be bound
+ * to the local address and port suplied. The socket is configured using
+ * the socket options established for this factory.
+ * <p>
+ * If there is a security manager, its <code>checkConnect</code>
+ * method is called with the host address and <code>port</code>
+ * as its arguments. This could result in a SecurityException.
+ *
+ * @param address the server network address
+ * @param port the server port
+ * @param localAddress the client network address
+ * @param localPort the client port
+ * @return the <code>Socket</code>
+ * @throws IOException if an I/O error occurs when creating the socket
+ * @throws SecurityException if a security manager exists and its
+ * <code>checkConnect</code> method doesn't allow the operation.
+ * @throws IllegalArgumentException if the port parameter or localPort
+ * parameter is outside the specified range of valid port values,
+ * which is between 0 and 65535, inclusive.
+ * @throws NullPointerException if <code>address</code> is null.
+ * @see SecurityManager#checkConnect
+ * @see java.net.Socket#Socket(java.net.InetAddress, int,
+ * java.net.InetAddress, int)
+ */
+ public abstract Socket
+ createSocket(InetAddress address, int port,
+ InetAddress localAddress, int localPort)
+ throws IOException;
+}
+
+
+//
+// The default factory has NO intelligence about policies like tunneling
+// out through firewalls (e.g. SOCKS V4 or V5) or in through them
+// (e.g. using SSL), or that some ports are reserved for use with SSL.
+//
+// Note that at least JDK 1.1 has a low level "plainSocketImpl" that
+// knows about SOCKS V4 tunneling, so this isn't a totally bogus default.
+//
+// ALSO: we may want to expose this class somewhere so other folk
+// can reuse it, particularly if we start to add highly useful features
+// such as ability to set connect timeouts.
+//
+class DefaultSocketFactory extends SocketFactory {
+
+ public Socket createSocket() {
+ return new Socket();
+ }
+
+ public Socket createSocket(String host, int port)
+ throws IOException, UnknownHostException
+ {
+ return new Socket(host, port);
+ }
+
+ public Socket createSocket(InetAddress address, int port)
+ throws IOException
+ {
+ return new Socket(address, port);
+ }
+
+ public Socket createSocket(String host, int port,
+ InetAddress clientAddress, int clientPort)
+ throws IOException, UnknownHostException
+ {
+ return new Socket(host, port, clientAddress, clientPort);
+ }
+
+ public Socket createSocket(InetAddress address, int port,
+ InetAddress clientAddress, int clientPort)
+ throws IOException
+ {
+ return new Socket(address, port, clientAddress, clientPort);
+ }
+}
Added: trunk/core/src/openjdk/javax/javax/net/package.html
===================================================================
--- trunk/core/src/openjdk/javax/javax/net/package.html (rev 0)
+++ trunk/core/src/openjdk/javax/javax/net/package.html 2007-11-18 15:16:56 UTC (rev 3597)
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+Copyright 1999-2001 Sun Microsystems, Inc. All Rights Reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation. Sun designates this
+particular file as subject to the "Classpath" exception as provided
+by Sun in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+CA 95054 USA or visit www.sun.com if you need additional information or
+have any questions.
+-->
+
+</head>
+<body bgcolor="white">
+
+Provides classes for networking applications. These classes include
+factories for creating sockets. Using socket factories you can encapsulate
+socket creation and configuration behavior.
+<!--
+<h2>Package Specification</h2>
+
+##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
+<ul>
+ <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
+</ul>
+
+<h2>Related Documentation</h2>
+
+For overviews, tutorials, examples, guides, and tool documentation, please see:
+<ul>
+ <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
+</ul>
+
+-->
+
+@since 1.4
+</body>
+</html>
Added: trunk/core/src/openjdk/javax/javax/net/ssl/CertPathTrustManagerParameters.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/net/ssl/CertPathTrustManagerParameters.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/net/ssl/CertPathTrustManagerParameters.java 2007-11-18 15:16:56 UTC (rev 3597)
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.net.ssl;
+
+import java.security.cert.CertPathParameters;
+
+/**
+ * A wrapper for CertPathParameters. This class is used to pass validation
+ * settings to CertPath based {@link TrustManager}s using the
+ * {@link TrustManagerFactory#init(ManagerFactoryParameters)
+ * TrustManagerFactory.init()} method.
+ *
+ * <p>Instances of this class are immutable.
+ *
+ * @see X509TrustManager
+ * @see TrustManagerFactory
+ * @see java.security.cert.CertPathParameters
+ *
+ * @since 1.5
+ * @version 1.8, 05/05/07
+ * @author Andreas Sterbenz
+ */
+public class CertPathTrustManagerParameters implements ManagerFactoryParameters {
+
+ private final CertPathParameters parameters;
+
+ /**
+ * Construct new CertPathTrustManagerParameters from the specified
+ * parameters. The parameters are cloned to protect against subsequent
+ * modification.
+ *
+ * @param parameters the CertPathParameters to be used
+ *
+ * @throws NullPointerException if parameters is null
+ */
+ public CertPathTrustManagerParameters(CertPathParameters parameters) {
+ this.parameters = (CertPathParameters)parameters.clone();
+ }
+
+ /**
+ * Return a clone of the CertPathParameters encapsulated by this class.
+ *
+ * @return a clone of the CertPathParameters encapsulated by this class.
+ */
+ public CertPathParameters getParameters() {
+ return (CertPathParameters)parameters.clone();
+ }
+
+}
Added: trunk/core/src/openjdk/javax/javax/net/ssl/HandshakeCompletedEvent.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/net/ssl/HandshakeCompletedEvent.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/net/ssl/HandshakeCompletedEvent.java 2007-11-18 15:16:56 UTC (rev 3597)
@@ -0,0 +1,238 @@
+/*
+ * Copyright 1997-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.net.ssl;
+
+import java.util.EventObject;
+import java.security.cert.Certificate;
+import java.security.Principal;
+import java.security.cert.X509Certificate;
+import javax.security.auth.x500.X500Principal;
+
+/**
+ * This event indicates that an SSL handshake completed on a given
+ * SSL connection. All of the core information about that handshake's
+ * result is captured through an "SSLSession" object. As a convenience,
+ * this event class provides direct access to some important session
+ * attributes.
+ *
+ * <P> The source of this event is the SSLSocket on which handshaking
+ * just completed.
+ *
+ * @see SSLSocket
+ * @see HandshakeCompletedListener
+ * @see SSLSession
+ *
+ * @since 1.4
+ * @version 1.29
+ * @author David Brownell
+ */
+public class HandshakeCompletedEvent extends EventObject
+{
+ private static final long serialVersionUID = 7914963744257769778L;
+
+ private transient SSLSession session;
+
+ /**
+ * Constructs a new HandshakeCompletedEvent.
+ *
+ * @param sock the SSLSocket acting as the source of the event
+ * @param s the SSLSession this event is associated with
+ */
+ public HandshakeCompletedEvent(SSLSocket sock, SSLSession s)
+ {
+ super(sock);
+ session = s;
+ }
+
+
+ /**
+ * Returns the session that triggered this event.
+ *
+ * @return the <code>SSLSession</code> for this handshake
+ */
+ public SSLSession getSession()
+ {
+ return session;
+ }
+
+
+ /**
+ * Returns the cipher suite in use by the session which was produced
+ * by the handshake. (This is a convenience method for
+ * getting the ciphersuite from the SSLsession.)
+ *
+ * @return the name of the cipher suite negotiated during this session.
+ */
+ public String getCipherSuite()
+ {
+ return session.getCipherSuite();
+ }
+
+
+ /**
+ * Returns the certificate(s) that were sent to the peer during
+ * handshaking.
+ * Note: This method is useful only when using certificate-based
+ * cipher suites.
+ *
+ * When multiple certificates are available for use in a
+ * handshake, the implementation chooses what it considers the
+ * "best" certificate chain available, and transmits that to
+ * the other side. This method allows the caller to know
+ * which certificate chain was actually used.
+ *
+ * @return an ordered array of certificates, with the local
+ * certificate first followed by any
+ * certificate authorities. If no certificates were sent,
+ * then null is returned.
+ * @see #getLocalPrincipal()
+ */
+ public java.security.cert.Certificate [] getLocalCertificates()
+ {
+ return session.getLocalCertificates();
+ }
+
+
+ /**
+ * Returns the identity of the peer which was established as part
+ * of defining the session.
+ * Note: This method can be used only when using certificate-based
+ * cipher suites; using it with non-certificate-based cipher suites,
+ * such as Kerberos, will throw an SSLPeerUnverifiedException.
+ *
+ * @return an ordered array of the peer certificates,
+ * with the peer's own certificate first followed by
+ * any certificate authorities.
+ * @exception SSLPeerUnverifiedException if the peer is not verified.
+ * @see #getPeerPrincipal()
+ */
+ public java.security.cert.Certificate [] getPeerCertificates()
+ throws SSLPeerUnverifiedException
+ {
+ return session.getPeerCertificates();
+ }
+
+
+ /**
+ * Returns the identity of the peer which was identified as part
+ * of defining the session.
+ * Note: This method can be used only when using certificate-based
+ * cipher suites; using it with non-certificate-based cipher suites,
+ * such as Kerberos, will throw an SSLPeerUnverifiedException.
+ *
+ * <p><em>Note: this method exists for compatibility with previous
+ * releases. New applications should use
+ * {@link #getPeerCertificates} instead.</em></p>
+ *
+ * @return an ordered array of peer X.509 certificates,
+ * with the peer's own certificate first followed by any
+ * certificate authorities. (The certificates are in
+ * the original JSSE
+ * {@link javax.security.cert.X509Certificate} format).
+ * @exception SSLPeerUnverifiedException if the peer is not verified.
+ * @see #getPeerPrincipal()
+ */
+ public javax.security.cert.X509Certificate [] getPeerCertificateChain()
+ throws SSLPeerUnverifiedException
+ {
+ return session.getPeerCertificateChain();
+ }
+
+ /**
+ * Returns the identity of the peer which was established as part of
+ * defining the session.
+ *
+ * @return the peer's principal. Returns an X500Principal of the
+ * end-entity certiticate for X509-based cipher suites, and
+ * KerberosPrincipal for Kerberos cipher suites.
+ *
+ * @throws SSLPeerUnverifiedException if the peer's identity has not
+ * been verified
+ *
+ * @see #getPeerCertificates()
+ * @see #getLocalPrincipal()
+ *
+ * @since 1.5
+ */
+ public Principal getPeerPrincipal()
+ throws SSLPeerUnverifiedException
+ {
+ Principal principal;
+ try {
+ principal = session.getPeerPrincipal();
+ } catch (AbstractMethodError e) {
+ // if the provider does not support it, fallback to peer certs.
+ // return the X500Principal of the end-entity cert.
+ Certificate[] certs = getPeerCertificates();
+ principal = (X500Principal)
+ ((X509Certificate)certs[0]).getSubjectX500Principal();
+ }
+ return principal;
+ }
+
+ /**
+ * Returns the principal that was sent to the peer during handshaking.
+ *
+ * @return the principal sent to the peer. Returns an X500Principal
+ * of the end-entity certificate for X509-based cipher suites, and
+ * KerberosPrincipal for Kerberos cipher suites. If no principal was
+ * sent, then null is returned.
+ *
+ * @see #getLocalCertificates()
+ * @see #getPeerPrincipal()
+ *
+ * @since 1.5
+ */
+ public Principal getLocalPrincipal()
+ {
+ Principal principal;
+ try {
+ principal = session.getLocalPrincipal();
+ } catch (AbstractMethodError e) {
+ principal = null;
+ // if the provider does not support it, fallback to local certs.
+ // return the X500Principal of the end-entity cert.
+ Certificate[] certs = getLocalCertificates();
+ if (certs != null) {
+ principal = (X500Principal)
+ ((X509Certificate)certs[0]).getSubjectX500Principal();
+ }
+ }
+ return principal;
+ }
+
+ /**
+ * Returns the socket which is the source of this event.
+ * (This is a convenience function, to let applications
+ * write code without type casts.)
+ *
+ * @return the socket on which the connection was made.
+ */
+ public SSLSocket getSocket()
+ {
+ return (SSLSocket) getSource();
+ }
+}
Added: trunk/core/src/openjdk/javax/javax/net/ssl/HandshakeCompletedListener.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/net/ssl/HandshakeCompletedListener.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/net/ssl/HandshakeCompletedListener.java 2007-11-18 15:16:56 UTC (rev 3597)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 1997-2001 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.net.ssl;
+
+import java.util.EventListener;
+
+/**
+ * This interface is implemented by any class which wants to receive
+ * notifications about the completion of an SSL protocol handshake
+ * on a given SSL connection.
+ *
+ * <P> When an SSL handshake completes, new security parameters will
+ * have been established. Those parameters always include the security
+ * keys used to protect messages. They may also include parameters
+ * associated with a new <em>session</em> such as authenticated
+ * peer identity and a new SSL cipher suite.
+ *
+ * @since 1.4
+ * @version 1.14
+ * @author David Brownell
+ */
+public interface HandshakeCompletedListener extends EventListener
+{
+ /**
+ * This method is invoked on registered objects
+ * when a SSL handshake is completed.
+ *
+ * @param event the event identifying when the SSL Handshake
+ * completed on a given SSL connection
+ */
+ void handshakeCompleted(HandshakeCompletedEvent event);
+}
Added: trunk/core/src/openjdk/javax/javax/net/ssl/HostnameVerifier.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/net/ssl/HostnameVerifier.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/net/ssl/HostnameVerifier.java 2007-11-18 15:16:56 UTC (rev 3597)
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.net.ssl;
+
+/**
+ * This class is the base interface for hostname verification.
+ * <P>
+ * During handshaking, if the URL's hostname and
+ * the server's identification hostname mismatch, the
+ * verification mechanism can call back to implementers of this
+ * interface to determine if this connection should be allowed.
+ * <P>
+ * The policies can be certificate-based
+ * or may depend on other authentication schemes.
+ * <P>
+ * These callbacks are used when the default rules for URL hostname
+ * verification fail.
+ *
+ * @author Brad R. Wetmore
+ * @version 1.10, 05/05/07
+ * @since 1.4
+ */
+
+public interface HostnameVerifier {
+ /**
+ * Verify that the host name is an acceptable match with
+ * the server's authentication scheme.
+ *
+ * @param hostname the host name
+ * @param session SSLSession used on the connection to host
+ * @return true if the host name is acceptable
+ */
+ public boolean verify(String hostname, SSLSession session);
+}
Added: trunk/core/src/openjdk/javax/javax/net/ssl/HttpsURLConnection.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/net/ssl/HttpsURLConnection.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/net/ssl/HttpsURLConnection.java 2007-11-18 15:16:56 UTC (rev 3597)
@@ -0,0 +1,385 @@
+/*
+ * Copyright 1999-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.net.ssl;
+
+import java.net.URL;
+import java.net.HttpURLConnection;
+import java.security.Principal;
+import java.security.cert.X509Certificate;
+import javax.security.auth.x500.X500Principal;
+
+/**
+ * <code>HttpsURLConnection</code> extends <code>HttpURLConnection</code>
+ * with support for https-specific features.
+ * <P>
+ * See <A HREF="http://www.w3.org/pub/WWW/Protocols/">
+ * http://www.w3.org/pub/WWW/Protocols/</A> and
+ * <A HREF="http://www.ietf.org/"> RFC 2818 </A>
+ * for more details on the
+ * https specification.
+ * <P>
+ * This class uses <code>HostnameVerifier</code> and
+ * <code>SSLSocketFactory</code>.
+ * There are default implementations defined for both classes.
+ * However, the implementations can be replaced on a per-class (static) or
+ * per-instance basis. All new <code>HttpsURLConnection</code>s instances
+ * will be assigned
+ * the "default" static values at instance creation, but they can be overriden
+ * by calling the appropriate per-instance set method(s) before
+ * <code>connect</code>ing.
+ *
+ * @since 1.4
+ * @version 1.33
+ */
+abstract public
+class HttpsURLConnection extends HttpURLConnection
+{
+ /**
+ * Creates an <code>HttpsURLConnection</code> using the
+ * URL specified.
+ *
+ * @param url the URL
+ */
+ protected HttpsURLConnection(URL url) {
+ super(url);
+ }
+
+ /**
+ * Returns the cipher suite in use on this connection.
+ *
+ * @return the cipher suite
+ * @throws IllegalStateException if this method is called before
+ * the connection has been established.
+ */
+ public abstract String getCipherSuite();
+
+ /**
+ * Returns the certificate(s) that were sent to the server during
+ * handshaking.
+ * <P>
+ * Note: This method is useful only when using certificate-based
+ * cipher suites.
+ * <P>
+ * When multiple certificates are available for use in a
+ * handshake, the implementation chooses what it considers the
+ * "best" certificate chain available, and transmits that to
+ * the other side. This method allows the caller to know
+ * which certificate chain was actually sent.
+ *
+ * @return an ordered array of certificates,
+ * with the client's own certificate first followed by any
+ * certificate authorities. If no certificates were sent,
+ * then null is returned.
+ * @throws IllegalStateException if this method is called before
+ * the connection has been established.
+ * @see #getLocalPrincipal()
+ */
+ public abstract java.security.cert.Certificate [] getLocalCertificates();
+
+ /**
+ * Returns the server's certificate chain which was established
+ * as part of defining the session.
+ * <P>
+ * Note: This method can be used only when using certificate-based
+ * cipher suites; using it with non-certificate-based cipher suites,
+ * such as Kerberos, will throw an SSLPeerUnverifiedException.
+ *
+ * @return an ordered array of server certificates,
+ * with the peer's own certificate first followed by
+ * any certificate authorities.
+ * @throws SSLPeerUnverifiedException if the peer is not verified.
+ * @throws IllegalStateException if this method is called before
+ * the connection has been established.
+ * @see #getPeerPrincipal()
+ */
+ public abstract java.security.cert.Certificate [] getServerCertificates()
+ throws SSLPeerUnverifiedException;
+
+ /**
+ * Returns the server's principal which was established as part of
+ * defining the session.
+ * <P>
+ * Note: Subclasses should override this method. If not overridden, it
+ * will default to returning the X500Principal of the server's end-entity
+ * certificate for certificate-based ciphersuites, or throw an
+ * SSLPeerUnverifiedException for non-certificate based ciphersuites,
+ * such as Kerberos.
+ *
+ * @return the server's principal. Returns an X500Principal of the
+ * end-entity certiticate for X509-based cipher suites, and
+ * KerberosPrincipal for Kerberos cipher suites.
+ *
+ * @throws SSLPeerUnverifiedException if the peer was not verified
+ * @throws IllegalStateException if this method is called before
+ * the connection has been established.
+ *
+ * @see #getServerCertificates()
+ * @see #getLocalPrincipal()
+ *
+ * @since 1.5
+ */
+ public Principal getPeerPrincipal()
+ throws SSLPeerUnverifiedException {
+
+ java.security.cert.Certificate[] certs = getServerCertificates();
+ return ((X500Principal)
+ ((X509Certificate)certs[0]).getSubjectX500Principal());
+ }
+
+ /**
+ * Returns the principal that was sent to the server during handshaking.
+ * <P>
+ * Note: Subclasses should override this method. If not overridden, it
+ * will default to returning the X500Principal of the end-entity certificate
+ * that was sent to the server for certificate-based ciphersuites or,
+ * return null for non-certificate based ciphersuites, such as Kerberos.
+ *
+ * @return the principal sent to the server. Returns an X500Principal
+ * of the end-entity certificate for X509-based cipher suites, and
+ * KerberosPrincipal for Kerberos cipher suites. If no principal was
+ * sent, then null is returned.
+ *
+ * @throws IllegalStateException if this method is called before
+ * the connection has been established.
+ *
+ * @see #getLocalCertificates()
+ * @see #getPeerPrincipal()
+ *
+ * @since 1.5
+ */
+ public Principal getLocalPrincipal() {
+
+ java.security.cert.Certificate[] certs = getLocalCertificates();
+ if (certs != null) {
+ return ((X500Principal)
+ ((X509Certificate)certs[0]).getSubjectX500Principal());
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * <code>HostnameVerifier</code> provides a callback mechanism so that
+ * implementers of this interface can supply a policy for
+ * handling the case where the host to connect to and
+ * the server name from the certificate mismatch.
+ * <p>
+ * The default implementation will deny such connections.
+ */
+ private static HostnameVerifier defaultHostnameVerifier;
+
+ /**
+ * Initialize the default <code>HostnameVerifier</code>.
+ */
+ static {
+ try {
+ defaultHostnameVerifier =
+ new sun.net.www.protocol.https.DefaultHostnameVerifier();
+ } catch (NoClassDefFoundError e) {
+ defaultHostnameVerifier = new DefaultHostnameVerifier();
+ }
+ }
+
+ /*
+ * The initial default <code>HostnameVerifier</code>. Should be
+ * updated for another other type of <code>HostnameVerifier</code>
+ * that are created.
+ */
+ private static class DefaultHostnameVerifier
+ implements HostnameVerifier {
+ public boolean verify(String hostname, SSLSession session) {
+ return false;
+ }
+ }
+
+ /**
+ * The <code>hostnameVerifier</code> for this object.
+ */
+ protected HostnameVerifier hostnameVerifier = defaultHostnameVerifier;
+
+ /**
+ * Sets the default <code>HostnameVerifier</code> inherited by a
+ * new instance of this class.
+ * <P>
+ * If this method is not called, the default
+ * <code>HostnameVerifier</code> assumes the connection should not
+ * be permitted.
+ *
+ * @param v the default host name verifier
+ * @throws IllegalArgumentException if the <code>HostnameVerifier</code>
+ * parameter is null.
+ * @throws SecurityException if a security manager exists and its
+ * <code>checkPermission</code> method does not allow
+ * <code>SSLPermission("setHostnameVerifier")</code>
+ * @see #getDefaultHostnameVerifier()
+ */
+ public static void setDefaultHostnameVerifier(HostnameVerifier v) {
+ if (v == null) {
+ throw new IllegalArgumentException(
+ "no default HostnameVerifier specified");
+ }
+
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPermission(new SSLPermission("setHostnameVerifier"));
+ }
+ defaultHostnameVerifier = v;
+ }
+
+ /**
+ * Gets the default <code>HostnameVerifier</code> that is inherited
+ * by new instances of this class.
+ *
+ * @return the default host name verifier
+ * @see #setDefaultHostnameVerifier(HostnameVerifier)
+ */
+ public static HostnameVerifier getDefaultHostnameVerifier() {
+ return defaultHostnameVerifier;
+ }
+
+ /**
+ * Sets the <code>HostnameVerifier</code> for this instance.
+ * <P>
+ * New instances of this class inherit the default static hostname
+ * verifier set by {@link #setDefaultHostnameVerifier(HostnameVerifier)
+ * setDefaultHostnameVerifier}. Calls to this method replace
+ * this object's <code>HostnameVerifier</code>.
+ *
+ * @param v the host name verifier
+ * @throws IllegalArgumentException if the <code>HostnameVerifier</code>
+ * parameter is null.
+ * @see #getHostnameVerifier()
+ * @see #setDefaultHostnameVerifier(HostnameVerifier)
+ */
+ public void setHostnameVerifier(HostnameVerifier v) {
+ if (v == null) {
+ throw new IllegalArgumentException(
+ "no HostnameVerifier specified");
+ }
+
+ hostnameVerifier = v;
+ }
+
+ /**
+ * Gets the <code>HostnameVerifier</code> in place on this instance.
+ *
+ * @return the host name verifier
+ * @see #setHostnameVerifier(HostnameVerifier)
+ * @see #setDefaultHostnameVerifier(HostnameVerifier)
+ */
+ public HostnameVerifier getHostnameVerifier() {
+ return hostnameVerifier;
+ }
+
+ private static SSLSocketFactory defaultSSLSocketFactory = null;
+
+ /**
+ * The <code>SSLSocketFactory</code> inherited when an instance
+ * of this class is created.
+ */
+ private SSLSocketFactory sslSocketFactory = getDefaultSSLSocketFactory();
+
+ /**
+ * Sets the default <code>SSLSocketFactory</code> inherited by new
+ * instances of this class.
+ * <P>
+ * The socket factories are used when creating sockets for secure
+ * https URL connections.
+ *
+ * @param sf the default SSL socket factory
+ * @throws IllegalArgumentException if the SSLSocketFactory
+ * parameter is null.
+ * @throws SecurityException if a security manager exists and its
+ * <code>checkSetFactory</code> method does not allow
+ * a socket factory to be specified.
+ * @see #getDefaultSSLSocketFactory()
+ */
+ public static void setDefaultSSLSocketFactory(SSLSocketFactory sf) {
+ if (sf == null) {
+ throw new IllegalArgumentException(
+ "no default SSLSocketFactory specified");
+ }
+
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkSetFactory();
+ }
+ defaultSSLSocketFactory = sf;
+ }
+
+ /**
+ * Gets the default static <code>SSLSocketFactory</code> that is
+ * inherited by new instances of this class.
+ * <P>
+ * The socket factories are used when creating sockets for secure
+ * https URL connections.
+ *
+ * @return the default <code>SSLSocketFactory</code>
+ * @see #setDefaultSSLSocketFactory(SSLSocketFactory)
+ */
+ public static SSLSocketFactory getDefaultSSLSocketFactory() {
+ if (defaultSSLSocketFactory == null) {
+ defaultSSLSocketFactory =
+ (SSLSocketFactory)SSLSocketFactory.getDefault();
+ }
+ return defaultSSLSocketFactory;
+ }
+
+ /**
+ * Sets the <code>SSLSocketFactory</code> to be used when this instance
+ * creates sockets for secure https URL connections.
+ * <P>
+ * New instances of this class inherit the default static
+ * <code>SSLSocketFactory</code> set by
+ * {@link #setDefaultSSLSocketFactory(SSLSocketFactory)
+ * setDefaultSSLSocketFactory}. Calls to this method replace
+ * this object's <code>SSLSocketFactory</code>.
+ *
+ * @param sf the SSL socket factory
+ * @throws IllegalArgumentException if the <code>SSLSocketFactory</code>
+ * parameter is null.
+ * @see #getSSLSocketFactory()
+ */
+ public void setSSLSocketFactory(SSLSocketFactory sf) {
+ if (sf == null) {
+ throw new IllegalArgumentException(
+ "no SSLSocketFactory specified");
+ }
+
+ sslSocketFactory = sf;
+ }
+
+ /**
+ * Gets the SSL socket factory to be used when creating sockets
+ * for secure https URL connections.
+ *
+ * @return the <code>SSLSocketFactory</code>
+ * @see #setSSLSocketFactory(SSLSocketFactory)
+ */
+ public SSLSocketFactory getSSLSocketFactory() {
+ return sslSocketFactory;
+ }
+}
Added: trunk/core/src/openjdk/javax/javax/net/ssl/KeyManager.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/net/ssl/KeyManager.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/net/ssl/KeyManager.java 2007-11-18 15:16:56 UTC (rev 3597)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 1999-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.net.ssl;
+
+/**
+ * This is the base interface for JSSE key managers.
+ * <P>
+ * <code>KeyManager</code>s are responsible for managing the
+ * key material which is used to authenticate the local SSLSocket
+ * to its peer. If no key material is available, the socket will
+ * be unable to present authentication credentials.
+ * <P>
+ * <code>KeyManager</code>s are created by either
+ * using a <code>KeyManagerFactory</code>,
+ * or by implementing one of the <code>KeyManager</code> subclasses.
+ *
+ * @since 1.4
+ * @version 1.17
+ * @see KeyManagerFactory
+ */
+public interface KeyManager {
+}
Added: trunk/core/src/openjdk/javax/javax/net/ssl/KeyManagerFactory.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/net/ssl/KeyManagerFactory.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/net/ssl/KeyManagerFactory.java 2007-11-18 15:16:56 UTC (rev 3597)
@@ -0,0 +1,295 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. ...
[truncated message content] |