Java examples for Security:Key
trust Manager For Key Store
//package com.java2s; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; public class Main { public static X509TrustManager trustManagerForKeyStore(KeyStore ks) throws NoSuchAlgorithmException, KeyStoreException { TrustManagerFactory tmf = TrustManagerFactory .getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmf.init(ks);// ww w . j ava2 s .c o m return (X509TrustManager) tmf.getTrustManagers()[0]; } }