public static SSLContext createSslContext(boolean allowInsecureConnection, String trustCertsFilePath, String certFilePath, String keyFilePath) throws GeneralSecurityException { X509Certificate[] trustCertificates = loadCertificatesFromPemFile(trustCertsFilePath); X509Certificate[] certificates = loadCertificatesFromPemFile(certFilePath); PrivateKey privateKey = loadPrivateKeyFromPemFile(keyFilePath); return createSslContext(allowInsecureConnection, trustCertificates, certificates, privateKey); }
public AuthenticationDataTls(String certFilePath, String keyFilePath) throws KeyManagementException { if (certFilePath == null) { throw new IllegalArgumentException("certFilePath must not be null"); } if (keyFilePath == null) { throw new IllegalArgumentException("keyFilePath must not be null"); } certificates = SecurityUtility.loadCertificatesFromPemFile(certFilePath); privateKey = SecurityUtility.loadPrivateKeyFromPemFile(keyFilePath); }
public static SslContext createNettySslContextForClient(boolean allowInsecureConnection, String trustCertsFilePath, String certFilePath, String keyFilePath) throws GeneralSecurityException, SSLException, FileNotFoundException, IOException { X509Certificate[] certificates = loadCertificatesFromPemFile(certFilePath); PrivateKey privateKey = loadPrivateKeyFromPemFile(keyFilePath); return createNettySslContextForClient(allowInsecureConnection, trustCertsFilePath, certificates, privateKey); }
public static SslContext createNettySslContextForServer(boolean allowInsecureConnection, String trustCertsFilePath, String certFilePath, String keyFilePath, Set<String> ciphers, Set<String> protocols, boolean requireTrustedClientCertOnConnect) throws GeneralSecurityException, SSLException, FileNotFoundException, IOException { X509Certificate[] certificates = loadCertificatesFromPemFile(certFilePath); PrivateKey privateKey = loadPrivateKeyFromPemFile(keyFilePath); SslContextBuilder builder = SslContextBuilder.forServer(privateKey, (X509Certificate[]) certificates); setupCiphers(builder, ciphers); setupProtocols(builder, protocols); setupTrustCerts(builder, allowInsecureConnection, trustCertsFilePath); setupKeyManager(builder, privateKey, certificates); setupClientAuthentication(builder, requireTrustedClientCertOnConnect); return builder.build(); }
public static SSLContext createSslContext(boolean allowInsecureConnection, String trustCertsFilePath, String certFilePath, String keyFilePath) throws GeneralSecurityException { X509Certificate[] trustCertificates = loadCertificatesFromPemFile(trustCertsFilePath); X509Certificate[] certificates = loadCertificatesFromPemFile(certFilePath); PrivateKey privateKey = loadPrivateKeyFromPemFile(keyFilePath); return createSslContext(allowInsecureConnection, trustCertificates, certificates, privateKey); }
public AuthenticationDataTls(String certFilePath, String keyFilePath) throws KeyManagementException { if (certFilePath == null) { throw new IllegalArgumentException("certFilePath must not be null"); } if (keyFilePath == null) { throw new IllegalArgumentException("keyFilePath must not be null"); } certificates = SecurityUtility.loadCertificatesFromPemFile(certFilePath); privateKey = SecurityUtility.loadPrivateKeyFromPemFile(keyFilePath); }
public static SslContext createNettySslContextForClient(boolean allowInsecureConnection, String trustCertsFilePath, String certFilePath, String keyFilePath) throws GeneralSecurityException, SSLException, FileNotFoundException, IOException { X509Certificate[] certificates = loadCertificatesFromPemFile(certFilePath); PrivateKey privateKey = loadPrivateKeyFromPemFile(keyFilePath); return createNettySslContextForClient(allowInsecureConnection, trustCertsFilePath, certificates, privateKey); }
public static SslContext createNettySslContextForServer(boolean allowInsecureConnection, String trustCertsFilePath, String certFilePath, String keyFilePath, Set<String> ciphers, Set<String> protocols, boolean requireTrustedClientCertOnConnect) throws GeneralSecurityException, SSLException, FileNotFoundException, IOException { X509Certificate[] certificates = loadCertificatesFromPemFile(certFilePath); PrivateKey privateKey = loadPrivateKeyFromPemFile(keyFilePath); SslContextBuilder builder = SslContextBuilder.forServer(privateKey, (X509Certificate[]) certificates); setupCiphers(builder, ciphers); setupProtocols(builder, protocols); setupTrustCerts(builder, allowInsecureConnection, trustCertsFilePath); setupKeyManager(builder, privateKey, certificates); setupClientAuthentication(builder, requireTrustedClientCertOnConnect); return builder.build(); }
try { X509Certificate trustCertificates[] = SecurityUtility .loadCertificatesFromPemFile(config.getTlsTrustCertsFilePath());
.loadCertificatesFromPemFile(clientConfigData.getTlsTrustCertsFilePath());