Static Public Member Functions | |
ServerSocketFactory | createServerFactory (SSLConfiguration config) throws SSLException |
SocketFactory | createFactory (SSLConfiguration config) throws Exception |
SSLContext | createSSLContext (SSLConfiguration config) throws Exception |
Static Protected Member Functions | |
KeyManager[] | getKeyManagers (File keyStore, String keyStorePassword, String keyPassword) throws IOException, GeneralSecurityException |
TrustManager[] | getTrustManagers (File trustStore, String trustStorePassword) throws IOException, GeneralSecurityException |
Definition at line 50 of file SocketFactoryFactory.java.
|
create a socket factory with the specified configuration
Definition at line 92 of file SocketFactoryFactory.java. 00094 { 00095 if (config == null) 00096 // nothing todo return default SocketFactory 00097 return SocketFactory.getDefault(); 00098 00099 SSLContext context = createSSLContext(config); 00100 00101 // Finally, we get a SocketFactory 00102 SSLSocketFactory ssf = context.getSocketFactory(); 00103 00104 if (!config.isClientAuthenticationRequired()) 00105 return ssf; 00106 00107 return new AuthenticatedSocketFactory(ssf); 00108 }
|
|
create a server socket factory with the specified configuration
Definition at line 60 of file SocketFactoryFactory.java. 00062 { 00063 try 00064 { 00065 00066 if (config == null) 00067 // nothing todo return default SocketFactory 00068 return ServerSocketFactory.getDefault(); 00069 00070 SSLContext context = createSSLContext(config); 00071 // Finally, we get a SocketFactory 00072 SSLServerSocketFactory ssf = context.getServerSocketFactory(); 00073 00074 if (!config.isClientAuthenticationRequired()) 00075 return ssf; 00076 00077 return new AuthenticatedServerSocketFactory(ssf); 00078 } 00079 catch (Exception e) 00080 { 00081 throw new SSLException(e); 00082 } 00083 }
|
|
create a ssl context
Definition at line 117 of file SocketFactoryFactory.java. 00119 { 00120 00121 KeyManager[] kms = getKeyManagers(config.getKeyStore(), config 00122 .getKeyStorePassword(), config.getKeyStoreKeyPassword()); 00123 00124 TrustManager[] tms = getTrustManagers(config.getTrustStore(), config 00125 .getTrustStorePassword()); 00126 00127 // Now construct a SSLContext using these KeyManagers. We 00128 // specify a null SecureRandom, indicating that the 00129 // defaults should be used. 00130 SSLContext context = SSLContext.getInstance("SSL"); 00131 context.init(kms, tms, null); 00132 return context; 00133 }
|