@Override public SSLContextInitializer createSSLContextInitializer() throws GeneralSecurityException { final X509SSLContextInitializer sslInit = new X509SSLContextInitializer(); if (trustCertificates != null) { sslInit.setTrustCertificates(trustCertificates); } if (authenticationCertificate != null) { sslInit.setAuthenticationCertificate(authenticationCertificate); } if (authenticationKey != null) { sslInit.setAuthenticationKey(authenticationKey); } return sslInit; } };
/** * Creates a X509CredentialConfig from the supplied trust certificates, authentication certificate and private key. * * @param trustCertificates to create credential config from * @param authenticationCertificate to create credential config from * @param authenticationKey that belongs to the certificate * * @return credential config */ public static CredentialConfig createX509CredentialConfig( final X509Certificate[] trustCertificates, final X509Certificate authenticationCertificate, final PrivateKey authenticationKey) { return () -> { final X509SSLContextInitializer sslInit = new X509SSLContextInitializer(); if (trustCertificates != null) { sslInit.setTrustCertificates(trustCertificates); } if (authenticationCertificate != null) { sslInit.setAuthenticationCertificate(authenticationCertificate); } if (authenticationKey != null) { sslInit.setAuthenticationKey(authenticationKey); } return sslInit; }; }
/** * Creates a X509CredentialConfig from the supplied trust certificates, authentication certificate and private key. * * @param trustCertificates to create credential config from * @param authenticationCertificate to create credential config from * @param authenticationKey that belongs to the certificate * * @return credential config */ public static CredentialConfig createX509CredentialConfig( final X509Certificate[] trustCertificates, final X509Certificate authenticationCertificate, final PrivateKey authenticationKey) { return () -> { final X509SSLContextInitializer sslInit = new X509SSLContextInitializer(); if (trustCertificates != null) { sslInit.setTrustCertificates(trustCertificates); } if (authenticationCertificate != null) { sslInit.setAuthenticationCertificate(authenticationCertificate); } if (authenticationKey != null) { sslInit.setAuthenticationKey(authenticationKey); } return sslInit; }; }
@Override public SSLContextInitializer createSSLContextInitializer() throws GeneralSecurityException { final X509SSLContextInitializer sslInit = new X509SSLContextInitializer(); try { if (trustCertificates != null) { sslInit.setTrustCertificates(certsReader.read(trustCertificates)); } if (authenticationCertificate != null) { sslInit.setAuthenticationCertificate(certReader.read(authenticationCertificate)); } if (authenticationKey != null) { sslInit.setAuthenticationKey(keyReader.read(authenticationKey)); } } catch (IOException e) { throw new GeneralSecurityException(e); } return sslInit; }
/** {@inheritDoc} */ @Override public SSLContextInitializer createSSLContextInitializer() throws GeneralSecurityException { final X509SSLContextInitializer sslInit = new X509SSLContextInitializer(); try { if (trustCertificates != null) { sslInit.setTrustCertificates(X509Support.decodeCertificates(trustCertificates.getFile()).toArray( new X509Certificate[0])); } if (authenticationCertificate != null) { sslInit.setAuthenticationCertificate( X509Support.decodeCertificate(authenticationCertificate.getFile())); } if (authenticationKey != null) { sslInit.setAuthenticationKey(KeySupport.decodePrivateKey(authenticationKey.getFile(), authenticationKeyPassword != null ? authenticationKeyPassword.toCharArray() : null)); } } catch (final IOException e) { throw new GeneralSecurityException(e); } return sslInit; } }
@Override public SSLContextInitializer createSSLContextInitializer() throws GeneralSecurityException { final X509SSLContextInitializer sslInit = new X509SSLContextInitializer(); try { if (trustCertificates != null) { sslInit.setTrustCertificates(certsReader.read(trustCertificates)); } if (authenticationCertificate != null) { sslInit.setAuthenticationCertificate(certReader.read(authenticationCertificate)); } if (authenticationKey != null) { sslInit.setAuthenticationKey(keyReader.read(authenticationKey)); } } catch (IOException e) { throw new GeneralSecurityException(e); } return sslInit; }
@Override public SSLContextInitializer createSSLContextInitializer() throws GeneralSecurityException { final X509SSLContextInitializer sslInit = new X509SSLContextInitializer(); try { if (trustCertificates != null) { sslInit.setTrustCertificates(certsReader.read(trustCertificates)); } if (authenticationCertificate != null) { sslInit.setAuthenticationCertificate(certReader.read(authenticationCertificate)); } if (authenticationKey != null) { sslInit.setAuthenticationKey(keyReader.read(authenticationKey)); } } catch (IOException e) { throw new GeneralSecurityException(e); } return sslInit; }