public static KeyStore buildTrustStore ( String provider , String trustAnchorStoreType , String trustAnchorStoreLocation , String trustAnchorStorePassword ) throws GlobusSSLConfigurationException { try { KeyStore trustAnchorStore ; if ( provider == null ) { trustAnchorStore = KeyStore . getInstance ( trustAnchorStoreType ) ; } else { trustAnchorStore = KeyStore . getInstance ( trustAnchorStoreType , provider ) ; } InputStream keyStoreInput = getStream ( trustAnchorStoreLocation ) ; try { trustAnchorStore . load ( new BufferedInputStream ( keyStoreInput ) , trustAnchorStorePassword == null ? null : trustAnchorStorePassword . toCharArray ( ) ) ; } finally { keyStoreInput . close ( ) ; } return trustAnchorStore ; } catch ( KeyStoreException e ) { throw new GlobusSSLConfigurationException ( e ) ; } catch ( IOException e ) { throw new GlobusSSLConfigurationException ( e ) ; } catch ( NoSuchAlgorithmException e ) { throw new GlobusSSLConfigurationException ( e ) ; } catch ( CertificateException e ) { throw new GlobusSSLConfigurationException ( e ) ; } catch ( NoSuchProviderException e ) { throw new GlobusSSLConfigurationException ( e ) ; } }
Create a trust store using the supplied details . Java SSL requires the trust store to be supplied as a java . security . KeyStore so this will create a KeyStore containing all of the Trust Anchors .