public SSLSocketFactory getSSLSockectFactory ( ) { SSLContext context = null ; try { context = SSLContext . getInstance ( "TLS" ) ; } catch ( NoSuchAlgorithmException e ) { throw new VOMSError ( e . getMessage ( ) , e ) ; } KeyManager [ ] keyManagers = new KeyManager [ ] { credential . getKeyManager ( ) } ; X509TrustManager trustManager = SocketFactoryCreator . getSSLTrustManager ( validator ) ; TrustManager [ ] trustManagers = new TrustManager [ ] { trustManager } ; SecureRandom secureRandom = null ; /* http://bugs.sun.com/view_bug.do?bug_id=6202721 */ /* * Use new SecureRandom instead of SecureRandom.getInstance("SHA1PRNG") to * avoid unnecessary blocking */ secureRandom = new SecureRandom ( ) ; try { context . init ( keyManagers , trustManagers , secureRandom ) ; } catch ( KeyManagementException e ) { throw new VOMSError ( e . getMessage ( ) , e ) ; } return context . getSocketFactory ( ) ; }
Get the SSL socket factory .