Search in sources :

Example 51 with X509KeyManager

use of javax.net.ssl.X509KeyManager in project zookeeper by apache.

the class X509UtilTest method testLoadPKCS12KeyStoreNullPassword.

@ParameterizedTest
@MethodSource("data")
public void testLoadPKCS12KeyStoreNullPassword(X509KeyType caKeyType, X509KeyType certKeyType, String keyPassword, Integer paramIndex) throws Exception {
    init(caKeyType, certKeyType, keyPassword, paramIndex);
    if (!x509TestContext.getKeyStorePassword().isEmpty()) {
        return;
    }
    // Make sure that empty password and null password are treated the same
    X509KeyManager km = X509Util.createKeyManager(x509TestContext.getKeyStoreFile(KeyStoreFileType.PKCS12).getAbsolutePath(), null, KeyStoreFileType.PKCS12.getPropertyValue());
}
Also used : X509KeyManager(javax.net.ssl.X509KeyManager) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 52 with X509KeyManager

use of javax.net.ssl.X509KeyManager in project zookeeper by apache.

the class X509UtilTest method testLoadJKSKeyStoreAutodetectStoreFileType.

@ParameterizedTest
@MethodSource("data")
public void testLoadJKSKeyStoreAutodetectStoreFileType(X509KeyType caKeyType, X509KeyType certKeyType, String keyPassword, Integer paramIndex) throws Exception {
    init(caKeyType, certKeyType, keyPassword, paramIndex);
    // Make sure we can instantiate a key manager from the JKS file on disk
    X509KeyManager km = X509Util.createKeyManager(x509TestContext.getKeyStoreFile(KeyStoreFileType.JKS).getAbsolutePath(), x509TestContext.getKeyStorePassword(), null);
}
Also used : X509KeyManager(javax.net.ssl.X509KeyManager) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 53 with X509KeyManager

use of javax.net.ssl.X509KeyManager in project zookeeper by apache.

the class X509UtilTest method testLoadPEMKeyStoreNullPassword.

@ParameterizedTest
@MethodSource("data")
public void testLoadPEMKeyStoreNullPassword(X509KeyType caKeyType, X509KeyType certKeyType, String keyPassword, Integer paramIndex) throws Exception {
    init(caKeyType, certKeyType, keyPassword, paramIndex);
    if (!x509TestContext.getKeyStorePassword().isEmpty()) {
        return;
    }
    // Make sure that empty password and null password are treated the same
    X509KeyManager km = X509Util.createKeyManager(x509TestContext.getKeyStoreFile(KeyStoreFileType.PEM).getAbsolutePath(), null, KeyStoreFileType.PEM.getPropertyValue());
}
Also used : X509KeyManager(javax.net.ssl.X509KeyManager) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 54 with X509KeyManager

use of javax.net.ssl.X509KeyManager in project zookeeper by apache.

the class X509UtilTest method testLoadJKSKeyStoreNullPassword.

@ParameterizedTest
@MethodSource("data")
public void testLoadJKSKeyStoreNullPassword(X509KeyType caKeyType, X509KeyType certKeyType, String keyPassword, Integer paramIndex) throws Exception {
    init(caKeyType, certKeyType, keyPassword, paramIndex);
    if (!x509TestContext.getKeyStorePassword().isEmpty()) {
        return;
    }
    // Make sure that empty password and null password are treated the same
    X509KeyManager km = X509Util.createKeyManager(x509TestContext.getKeyStoreFile(KeyStoreFileType.JKS).getAbsolutePath(), null, KeyStoreFileType.JKS.getPropertyValue());
}
Also used : X509KeyManager(javax.net.ssl.X509KeyManager) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 55 with X509KeyManager

use of javax.net.ssl.X509KeyManager in project zookeeper by apache.

the class X509UtilTest method testLoadPEMKeyStoreAutodetectStoreFileType.

@ParameterizedTest
@MethodSource("data")
public void testLoadPEMKeyStoreAutodetectStoreFileType(X509KeyType caKeyType, X509KeyType certKeyType, String keyPassword, Integer paramIndex) throws Exception {
    init(caKeyType, certKeyType, keyPassword, paramIndex);
    // Make sure we can instantiate a key manager from the PEM file on disk
    X509KeyManager km = X509Util.createKeyManager(x509TestContext.getKeyStoreFile(KeyStoreFileType.PEM).getAbsolutePath(), x509TestContext.getKeyStorePassword(), null);
}
Also used : X509KeyManager(javax.net.ssl.X509KeyManager) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

X509KeyManager (javax.net.ssl.X509KeyManager)66 KeyManager (javax.net.ssl.KeyManager)32 KeyManagerFactory (javax.net.ssl.KeyManagerFactory)22 IOException (java.io.IOException)18 X509Certificate (java.security.cert.X509Certificate)17 KeyStore (java.security.KeyStore)16 SSLContext (javax.net.ssl.SSLContext)15 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)12 MethodSource (org.junit.jupiter.params.provider.MethodSource)12 GeneralSecurityException (java.security.GeneralSecurityException)8 CertificateException (java.security.cert.CertificateException)8 X509TrustManager (javax.net.ssl.X509TrustManager)8 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)7 PrivateKey (java.security.PrivateKey)7 TrustManager (javax.net.ssl.TrustManager)7 X509ExtendedKeyManager (javax.net.ssl.X509ExtendedKeyManager)7 UnifiedX509KeyManager (com.sun.enterprise.security.ssl.manager.UnifiedX509KeyManager)4 KeyFactory (java.security.KeyFactory)4 KeyPair (java.security.KeyPair)4 KeyPairGenerator (java.security.KeyPairGenerator)4