/* Create the TrustManagerFactory. We use the SunJSSE provider * for this purpose.*/ TrustManagerFactory tmf=TrustManagerFactory.getInstance("SunX509", "SunJSSE"); tmf.init((Java.security.KeyStore)null); tm=tmf.getTrustManagers()[0]; /* Something failed we could not get a TrustManager instance.*/ if(tm == null) { thrownew SSLException("Could not get default TrustManager instance."); }
/* Create the file input stream for the own keystore. */ try{ keyStoreIStream = new FileInputStream(keyStorePath); } catch( FileNotFoundException fne ) { // If the path does not exist then a null stream means // the keystore is initialized empty. If an untrusted // certificate chain is trusted by the user, then it will be // saved in the file pointed to by keyStorePath. keyStoreIStream = null; } /* Now create the keystore. */