Search Java Code Snippets


  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.





Java - Code Samples

 Sample 1. Code Sample / Example / Snippet of javax.net.ssl.TrustManagerFactory

    private TrustManager[] getTrustManagerFactory(String truststoreFile, String storePass) throws IOException, GeneralSecurityException {

TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());



InputStream is = null;

try {

is = new FileInputStream(truststoreFile);



KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());

ks.load(is, storePass.toCharArray());



tmf.init(ks);



return tmf.getTrustManagers();

}

finally {

try {

if (is != null) {

is.close();

}

}

catch (IOException e) {

}

}

}


   Like      Feedback      javax.net.ssl.TrustManagerFactory



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner