クラス org.objectweb.cjdbc.common.net.SocketFactoryFactory

すべてのメンバ一覧

説明

This class defines a SocketFactory

作者:
Marc Wick
バージョン:
1.0

SocketFactoryFactory.java50 行で定義されています。

Static Public メソッド

ServerSocketFactory createServerFactory (SSLConfiguration config) throws SSLException
SocketFactory createFactory (SSLConfiguration config) throws Exception
SSLContext createSSLContext (SSLConfiguration config) throws Exception

Static Protected メソッド

KeyManager[] getKeyManagers (File keyStore, String keyStorePassword, String keyPassword) throws IOException, GeneralSecurityException
TrustManager[] getTrustManagers (File trustStore, String trustStorePassword) throws IOException, GeneralSecurityException


メソッド

SocketFactory org.objectweb.cjdbc.common.net.SocketFactoryFactory.createFactory SSLConfiguration  config  )  throws Exception [static]
 

create a socket factory with the specified configuration

引数:
config - the ssl configuration
戻り値:
- the socket factory
例外:
Exception - could not create factory
SocketFactoryFactory.java92 行で定義されています。

参照先 org.objectweb.cjdbc.common.net.SocketFactoryFactory.createSSLContext().

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 }

ServerSocketFactory org.objectweb.cjdbc.common.net.SocketFactoryFactory.createServerFactory SSLConfiguration  config  )  throws SSLException [static]
 

create a server socket factory with the specified configuration

引数:
config - the ssl configuration
戻り値:
- the socket factory
例外:
SSLException - could not create factory
SocketFactoryFactory.java60 行で定義されています。

参照先 org.objectweb.cjdbc.common.net.SocketFactoryFactory.createSSLContext().

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 }

SSLContext org.objectweb.cjdbc.common.net.SocketFactoryFactory.createSSLContext SSLConfiguration  config  )  throws Exception [static]
 

create a ssl context

引数:
config - ssl config
戻り値:
- the ssl context
例外:
Exception - problems initializing the content
SocketFactoryFactory.java117 行で定義されています。

参照先 org.objectweb.cjdbc.common.net.SocketFactoryFactory.getKeyManagers(), と org.objectweb.cjdbc.common.net.SocketFactoryFactory.getTrustManagers().

参照元 org.objectweb.cjdbc.common.net.SocketFactoryFactory.createFactory(), と org.objectweb.cjdbc.common.net.SocketFactoryFactory.createServerFactory().

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 }

KeyManager [] org.objectweb.cjdbc.common.net.SocketFactoryFactory.getKeyManagers File  keyStore,
String  keyStorePassword,
String  keyPassword
throws IOException, GeneralSecurityException [static, protected]
 

SocketFactoryFactory.java135 行で定義されています。

参照元 org.objectweb.cjdbc.common.net.SocketFactoryFactory.createSSLContext().

00138 { 00139 // First, get the default KeyManagerFactory. 00140 String alg = KeyManagerFactory.getDefaultAlgorithm(); 00141 KeyManagerFactory kmFact = KeyManagerFactory.getInstance(alg); 00142 00143 // Next, set up the KeyStore to use. We need to load the file into 00144 // a KeyStore instance. 00145 FileInputStream fis = new FileInputStream(keyStore); 00146 KeyStore ks = KeyStore.getInstance("jks"); 00147 00148 char[] passwd = null; 00149 if (keyStorePassword != null) 00150 { 00151 passwd = keyStorePassword.toCharArray(); 00152 } 00153 ks.load(fis, passwd); 00154 fis.close(); 00155 00156 // Now we initialize the TrustManagerFactory with this KeyStore 00157 kmFact.init(ks, keyPassword.toCharArray()); 00158 00159 // And now get the TrustManagers 00160 KeyManager[] kms = kmFact.getKeyManagers(); 00161 return kms; 00162 }

TrustManager [] org.objectweb.cjdbc.common.net.SocketFactoryFactory.getTrustManagers File  trustStore,
String  trustStorePassword
throws IOException, GeneralSecurityException [static, protected]
 

SocketFactoryFactory.java164 行で定義されています。

参照元 org.objectweb.cjdbc.common.net.SocketFactoryFactory.createSSLContext().

00166 { 00167 // First, get the default TrustManagerFactory. 00168 String alg = TrustManagerFactory.getDefaultAlgorithm(); 00169 TrustManagerFactory tmFact = TrustManagerFactory.getInstance(alg); 00170 00171 // Next, set up the TrustStore to use. We need to load the file into 00172 // a KeyStore instance. 00173 FileInputStream fis = new FileInputStream(trustStore); 00174 KeyStore ks = KeyStore.getInstance("jks"); 00175 ks.load(fis, trustStorePassword.toCharArray()); 00176 fis.close(); 00177 00178 // Now we initialize the TrustManagerFactory with this KeyStore 00179 tmFact.init(ks); 00180 00181 // And now get the TrustManagers 00182 TrustManager[] tms = tmFact.getTrustManagers(); 00183 return tms; 00184 }


このクラスの説明は次のファイルから生成されました:
CJDBCversion1.0.4に対してTue Oct 12 15:16:16 2004に生成されました。 doxygen 1.3.8