Search in sources :

Example 6 with InvalidSSLConfig

use of com.notnoop.exceptions.InvalidSSLConfig in project java-apns by notnoop.

the class SSLContextBuilder method withTrustKeyStore.

public SSLContextBuilder withTrustKeyStore(InputStream keyStoreStream, String keyStorePassword, String keyStoreType) throws InvalidSSLConfig {
    try {
        final KeyStore ks = KeyStore.getInstance(keyStoreType);
        ks.load(keyStoreStream, keyStorePassword.toCharArray());
        return withTrustKeyStore(ks, keyStorePassword);
    } catch (GeneralSecurityException e) {
        throw new InvalidSSLConfig(e);
    } catch (IOException e) {
        throw new InvalidSSLConfig(e);
    }
}
Also used : GeneralSecurityException(java.security.GeneralSecurityException) InvalidSSLConfig(com.notnoop.exceptions.InvalidSSLConfig) IOException(java.io.IOException) KeyStore(java.security.KeyStore)

Aggregations

InvalidSSLConfig (com.notnoop.exceptions.InvalidSSLConfig)6 GeneralSecurityException (java.security.GeneralSecurityException)6 IOException (java.io.IOException)2 KeyStore (java.security.KeyStore)2 TrustManagerFactory (javax.net.ssl.TrustManagerFactory)2 SSLContext (javax.net.ssl.SSLContext)1