SecureSocketUtils { public static KeyStore getKeyStoreInstance(final KeyStoreTypeEnum type) throws KeyStoreException { if (type == null || KeyStoreTypeEnum.DEFAULT.equals(type)) { return KeyStore.getInstance(KeyStore.getDefaultType()); } return KeyStore.getInstance(type.value()); }  static byte[] loadPemFileAsBytes(final String file); static byte[] loadBinaryFileAsBytes(final String file); static PrivateKey loadPrivateKeyFromPemFile(final String keyFile); static PrivateKey loadPrivateKeyFromBinaryFile(final String keyFile); static X509Certificate loadX509Certificate(final String certificateFile); static TrustManagerFactory getTrustManagerFactory(final String caCertificateFile); static TrustManagerFactory getTrustManagerFactory(final String keyStoreFile, final String keyStorePassword,
			final KeyStoreTypeEnum keyStoreType); static KeyManagerFactory getKeyManagerFactory(final String keyStoreFile, final String keyStorePassword, 
			final String keyPassword, final KeyStoreTypeEnum keyStoreType); static KeyManagerFactory getKeyManagerFactory(
			final String clientCertificateFile, final String clientKeyFile, final String clientKeyPassword, final boolean pemFormat); static KeyStore loadKeystore(final String keyStoreFile, final String keyStorePassword, final KeyStoreTypeEnum keyStoreType); static KeyStore getKeyStoreInstance(final KeyStoreTypeEnum type); static KeyStore getKeyStoreInstance(final KeyStoreTypeEnum type, final Provider provider); static KeyStoreTypeEnum getTypeFromFilename(final String filename);  }
@Test public void testGetKeyStoreInstance() throws KeyStoreException { SecureSocketUtils.getKeyStoreInstance(KeyStoreTypeEnum.DEFAULT); }
@Test public void testGetKeyStoreInstanceBaseTypes() throws KeyStoreException { SecureSocketUtils.getKeyStoreInstance(KeyStoreTypeEnum.JKS); SecureSocketUtils.getKeyStoreInstance(KeyStoreTypeEnum.JCEKS); SecureSocketUtils.getKeyStoreInstance(KeyStoreTypeEnum.PKCS_12); }
@Test public void testGetKeyStoreInstanceBKSType() throws KeyStoreException { SecureSocketUtils.getKeyStoreInstance(KeyStoreTypeEnum.BKS, new BouncyCastleProvider()); Security.addProvider(new BouncyCastleProvider()); SecureSocketUtils.getKeyStoreInstance(KeyStoreTypeEnum.BKS); }