User: starksm
Date: 02/02/08 15:51:45
Modified:src/main/org/jboss/security/ssl
RMISSLClientSocketFactory.java
RMISSLServerSocketFactory.java
Added: src/main/org/jboss/security/ssl
DomainServerSocketFactory.java
Log:
Update the socket factories to use a JaasSecurityDomain as the source
of the KeyStore rather than using hardcoded paths
Revision ChangesPath
1.3 +57 -6
jbosssx/src/main/org/jboss/security/ssl/RMISSLClientSocketFactory.java
Index: RMISSLClientSocketFactory.java
===
RCS file:
/cvsroot/jboss/jbosssx/src/main/org/jboss/security/ssl/RMISSLClientSocketFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RMISSLClientSocketFactory.java15 Oct 2001 04:32:53 - 1.2
+++ RMISSLClientSocketFactory.java8 Feb 2002 23:51:45 - 1.3
@@ -10,14 +10,65 @@
import java.io.Serializable;
import java.net.Socket;
import java.rmi.server.RMIClientSocketFactory;
+import javax.net.ssl.HandshakeCompletedEvent;
+import javax.net.ssl.HandshakeCompletedListener;
+import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.SSLSocket;
-public class RMISSLClientSocketFactory implements RMIClientSocketFactory,
Serializable {
+import org.jboss.logging.Logger;
-public Socket createSocket(String host, int port) throws IOException {
-SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault();
-SSLSocket socket = (SSLSocket) factory.createSocket(host, port);
-return socket;
-}
+/** An implementation of RMIClientSocketFactory that uses the JSSE
+ default SSLSocketFactory to create a client SSLSocket.
+ *
+ * @author [EMAIL PROTECTED]
+ * @version $Revision: 1.3 $
+ */
+public class RMISSLClientSocketFactory implements HandshakeCompletedListener,
+ RMIClientSocketFactory, Serializable
+{
+ private static final long serialVersionUID = -6412485012870705607L;
+
+ /** Creates new RMISSLClientSocketFactory */
+ public RMISSLClientSocketFactory()
+ {
+ }
+
+ /** Create a client socket connected to the specified host and port.
+ * @param host - the host name
+ * @param port - the port number
+ * @return a socket connected to the specified host and port.
+ * @exception IOException if an I/O error occurs during socket creation.
+ */
+ public java.net.Socket createSocket(String host, int port)
+ throws IOException
+ {
+ SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault();
+ SSLSocket socket = (SSLSocket) factory.createSocket(host, port);
+ socket.addHandshakeCompletedListener(this);
+ return socket;
+ }
+
+ public boolean equals(Object obj)
+ {
+ return obj instanceof RMISSLClientSocketFactory;
+ }
+ public int hashCode()
+ {
+ return getClass().getName().hashCode();
+ }
+
+ public void handshakeCompleted(HandshakeCompletedEvent handshakeCompletedEvent)
+ {
+ Logger log = Logger.getLogger(RMISSLClientSocketFactory.class);
+ if( log.isTraceEnabled() )
+ {
+ String cipher = handshakeCompletedEvent.getCipherSuite();
+ SSLSession session = handshakeCompletedEvent.getSession();
+ String peerHost = session.getPeerHost();
+ log.debug(SSL handshakeCompleted, cipher=+cipher
++, peerHost=+peerHost);
+ }
+ }
+
}
1.3 +66 -39
jbosssx/src/main/org/jboss/security/ssl/RMISSLServerSocketFactory.java
Index: RMISSLServerSocketFactory.java
===
RCS file:
/cvsroot/jboss/jbosssx/src/main/org/jboss/security/ssl/RMISSLServerSocketFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RMISSLServerSocketFactory.java15 Oct 2001 04:32:53 - 1.2
+++ RMISSLServerSocketFactory.java8 Feb 2002 23:51:45 - 1.3
@@ -6,47 +6,74 @@
*/
package org.jboss.security.ssl;
-import java.io.FileInputStream;
import java.io.IOException;
import java.io.Serializable;
import java.net.ServerSocket;
+import java.net.UnknownHostException;
import java.rmi.server.RMIServerSocketFactory;
-import javax.net.ssl.SSLServerSocketFactory;
-import java.security.KeyStore;
-import java.security.Security;
-import com.sun.net.ssl.KeyManagerFactory;
-import com.sun.net.ssl.SSLContext;
-
-
-public class RMISSLServerSocketFactory implements RMIServerSocketFactory,
Serializable {
-
-static {
-// Security provider for JSSE 1.0.2
-Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
-}
-
-
-public