OadrPKISecurity { public static KeyStore createTrustStore(List<String> certificates) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, OadrSecurityException { KeyStore ts = KeyStore.getInstance(KeyStore.getDefaultType()); ts.load(null, null); String keyEntryPrefix = "trust_"; int i = 1; for (String certPath : certificates) { ts.setCertificateEntry(keyEntryPrefix + i, OadrPKISecurity.parseCertificate(certPath)); i++; } return ts; } private  OadrPKISecurity(); static PrivateKey parsePrivateKey(String privateKeyFilePath); static PrivateKey parsePrivateKey(FileReader fileReader); static X509Certificate parseCertificate(String certificateFilePath); static X509Certificate parseCertificate(FileReader fileReader); static KeyStore createKeyStore(String privateKeyFilePath, String clientCertificatefilePath, String password); static KeyManagerFactory createKeyManagerFactory(String clientPrivateKeyPemFilePath,
			String clientCertificatePemFilePath, String password); static KeyStore createTrustStore(List<String> certificates); static TrustManagerFactory createTrustManagerFactory(List<String> trustedCertificateFilePath); static SSLContext createSSLContext(String clientPrivateKeyPemFilePath, String clientCertificatePemFilePath,
			List<String> trustCertificates, String password); static String md5Hex(String data); static KeyPair generateRsaKeyPair(); static KeyPair generateEccKeyPair(); static OadrUserX509Credential generateCredentials(KeyPair caKeyPair, X509Certificate caCert,
			String commonName, OadrPKIAlgorithm algo);  }
@Test public void createTrustStoreTest() throws OadrSecurityException, KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { List<String> certificates = new ArrayList<>(); certificates.add(TestUtils.TEST_CRT); KeyStore createTrustStore = OadrPKISecurity.createTrustStore(certificates); assertNotNull(createTrustStore); createTrustStore = OadrPKISecurity.createTrustStore(Lists.newArrayList()); assertNotNull(createTrustStore); certificates = new ArrayList<>(); certificates.add(TestUtils.TEST_KEY); boolean exception = false; try { createTrustStore = OadrPKISecurity.createTrustStore(certificates); } catch (OadrSecurityException e) { exception = true; } assertTrue(exception); }