Java examples for Security:Trust Manager
create Trust Managers
//package com.java2s; import javax.net.ssl.*; import java.io.FileInputStream; import java.io.InputStream; import java.security.KeyStore; public class Main { public static TrustManager[] createTrustManagers(String filepath, String keystorePassword) throws Exception { KeyStore trustStore = KeyStore.getInstance("JKS"); try (InputStream trustStoreIS = new FileInputStream(filepath)) { trustStore.load(trustStoreIS, keystorePassword.toCharArray()); }//from ww w . j a va 2 s .co m TrustManagerFactory trustFactory = TrustManagerFactory .getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustFactory.init(trustStore); return trustFactory.getTrustManagers(); } }