@Test public void testEncryptedEmptyPassword() throws Exception { PrivateKey key = SslContext.toPrivateKey( new File(getClass().getResource("test_encrypted_empty_pass.pem").getFile()), ""); Assert.assertNotNull(key); }
static PrivateKey toPrivateKey(File keyFile, String keyPassword) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException, InvalidAlgorithmParameterException, KeyException, IOException { if (keyFile == null) { return null; } return getPrivateKeyFromByteBuffer(PemReader.readPrivateKey(keyFile), keyPassword); }
SslContext { static PrivateKey toPrivateKey(File keyFile, String keyPassword) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException, InvalidAlgorithmParameterException, KeyException, IOException { if (keyFile == null) { return null; } return getPrivateKeyFromByteBuffer(PemReader.readPrivateKey(keyFile), keyPassword); } }
SslContext { static PrivateKey toPrivateKey(File keyFile, String keyPassword) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException, InvalidAlgorithmParameterException, KeyException, IOException { if (keyFile == null) { return null; } return getPrivateKeyFromByteBuffer(PemReader.readPrivateKey(keyFile), keyPassword); } protected  SslContext(); protected  SslContext(boolean startTls); }
SslContext { static PrivateKey toPrivateKey(File keyFile, String keyPassword) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException, InvalidAlgorithmParameterException, KeyException, IOException { if (keyFile == null) { return null; } return getPrivateKeyFromByteBuffer(PemReader.readPrivateKey(keyFile), keyPassword); } protected  SslContext(); protected  SslContext(boolean startTls); static SslProvider defaultServerProvider(); static SslProvider defaultClientProvider(); @Deprecated static SslContext newServerContext(File certChainFile, File keyFile); @Deprecated static SslContext newServerContext(
            File certChainFile, File keyFile, String keyPassword); @Deprecated static SslContext newServerContext(
            File certChainFile, File keyFile, String keyPassword,
            Iterable<String> ciphers, Iterable<String> nextProtocols,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newServerContext(
            File certChainFile, File keyFile, String keyPassword,
            Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newServerContext(
            SslProvider provider, File certChainFile, File keyFile); @Deprecated static SslContext newServerContext(
            SslProvider provider, File certChainFile, File keyFile, String keyPassword); @Deprecated static SslContext newServerContext(
            SslProvider provider,
            File certChainFile, File keyFile, String keyPassword,
            Iterable<String> ciphers, Iterable<String> nextProtocols,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newServerContext(
            SslProvider provider,
            File certChainFile, File keyFile, String keyPassword, TrustManagerFactory trustManagerFactory,
            Iterable<String> ciphers, Iterable<String> nextProtocols,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newServerContext(SslProvider provider,
                                              File certChainFile, File keyFile, String keyPassword,
                                              Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
                                              long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newServerContext(
            SslProvider provider,
            File trustCertCollectionFile, TrustManagerFactory trustManagerFactory,
            File keyCertChainFile, File keyFile, String keyPassword, KeyManagerFactory keyManagerFactory,
            Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newClientContext(); @Deprecated static SslContext newClientContext(File certChainFile); @Deprecated static SslContext newClientContext(TrustManagerFactory trustManagerFactory); @Deprecated static SslContext newClientContext(
            File certChainFile, TrustManagerFactory trustManagerFactory); @Deprecated static SslContext newClientContext(
            File certChainFile, TrustManagerFactory trustManagerFactory,
            Iterable<String> ciphers, Iterable<String> nextProtocols,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newClientContext(
            File certChainFile, TrustManagerFactory trustManagerFactory,
            Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newClientContext(SslProvider provider); @Deprecated static SslContext newClientContext(SslProvider provider, File certChainFile); @Deprecated static SslContext newClientContext(
            SslProvider provider, TrustManagerFactory trustManagerFactory); @Deprecated static SslContext newClientContext(
            SslProvider provider, File certChainFile, TrustManagerFactory trustManagerFactory); @Deprecated static SslContext newClientContext(
            SslProvider provider,
            File certChainFile, TrustManagerFactory trustManagerFactory,
            Iterable<String> ciphers, Iterable<String> nextProtocols,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newClientContext(
            SslProvider provider,
            File certChainFile, TrustManagerFactory trustManagerFactory,
            Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newClientContext(
            SslProvider provider,
            File trustCertCollectionFile, TrustManagerFactory trustManagerFactory,
            File keyCertChainFile, File keyFile, String keyPassword,
            KeyManagerFactory keyManagerFactory,
            Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
            long sessionCacheSize, long sessionTimeout); final boolean isServer(); abstract boolean isClient(); abstract List<String> cipherSuites(); abstract long sessionCacheSize(); abstract long sessionTimeout(); @Deprecated final List<String> nextProtocols(); abstract ApplicationProtocolNegotiator applicationProtocolNegotiator(); abstract SSLEngine newEngine(ByteBufAllocator alloc); abstract SSLEngine newEngine(ByteBufAllocator alloc, String peerHost, int peerPort); abstract SSLSessionContext sessionContext(); final SslHandler newHandler(ByteBufAllocator alloc); final SslHandler newHandler(ByteBufAllocator alloc, String peerHost, int peerPort); }
SslContext { static PrivateKey toPrivateKey(File keyFile, String keyPassword) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException, InvalidAlgorithmParameterException, KeyException, IOException { if (keyFile == null) { return null; } return getPrivateKeyFromByteBuffer(PemReader.readPrivateKey(keyFile), keyPassword); } protected  SslContext(); protected  SslContext(boolean startTls); static SslProvider defaultServerProvider(); static SslProvider defaultClientProvider(); @Deprecated static SslContext newServerContext(File certChainFile, File keyFile); @Deprecated static SslContext newServerContext(
            File certChainFile, File keyFile, String keyPassword); @Deprecated static SslContext newServerContext(
            File certChainFile, File keyFile, String keyPassword,
            Iterable<String> ciphers, Iterable<String> nextProtocols,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newServerContext(
            File certChainFile, File keyFile, String keyPassword,
            Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newServerContext(
            SslProvider provider, File certChainFile, File keyFile); @Deprecated static SslContext newServerContext(
            SslProvider provider, File certChainFile, File keyFile, String keyPassword); @Deprecated static SslContext newServerContext(
            SslProvider provider,
            File certChainFile, File keyFile, String keyPassword,
            Iterable<String> ciphers, Iterable<String> nextProtocols,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newServerContext(
            SslProvider provider,
            File certChainFile, File keyFile, String keyPassword, TrustManagerFactory trustManagerFactory,
            Iterable<String> ciphers, Iterable<String> nextProtocols,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newServerContext(SslProvider provider,
                                              File certChainFile, File keyFile, String keyPassword,
                                              Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
                                              long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newServerContext(
            SslProvider provider,
            File trustCertCollectionFile, TrustManagerFactory trustManagerFactory,
            File keyCertChainFile, File keyFile, String keyPassword, KeyManagerFactory keyManagerFactory,
            Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newClientContext(); @Deprecated static SslContext newClientContext(File certChainFile); @Deprecated static SslContext newClientContext(TrustManagerFactory trustManagerFactory); @Deprecated static SslContext newClientContext(
            File certChainFile, TrustManagerFactory trustManagerFactory); @Deprecated static SslContext newClientContext(
            File certChainFile, TrustManagerFactory trustManagerFactory,
            Iterable<String> ciphers, Iterable<String> nextProtocols,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newClientContext(
            File certChainFile, TrustManagerFactory trustManagerFactory,
            Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newClientContext(SslProvider provider); @Deprecated static SslContext newClientContext(SslProvider provider, File certChainFile); @Deprecated static SslContext newClientContext(
            SslProvider provider, TrustManagerFactory trustManagerFactory); @Deprecated static SslContext newClientContext(
            SslProvider provider, File certChainFile, TrustManagerFactory trustManagerFactory); @Deprecated static SslContext newClientContext(
            SslProvider provider,
            File certChainFile, TrustManagerFactory trustManagerFactory,
            Iterable<String> ciphers, Iterable<String> nextProtocols,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newClientContext(
            SslProvider provider,
            File certChainFile, TrustManagerFactory trustManagerFactory,
            Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newClientContext(
            SslProvider provider,
            File trustCertCollectionFile, TrustManagerFactory trustManagerFactory,
            File keyCertChainFile, File keyFile, String keyPassword,
            KeyManagerFactory keyManagerFactory,
            Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
            long sessionCacheSize, long sessionTimeout); final boolean isServer(); abstract boolean isClient(); abstract List<String> cipherSuites(); abstract long sessionCacheSize(); abstract long sessionTimeout(); @Deprecated final List<String> nextProtocols(); abstract ApplicationProtocolNegotiator applicationProtocolNegotiator(); abstract SSLEngine newEngine(ByteBufAllocator alloc); abstract SSLEngine newEngine(ByteBufAllocator alloc, String peerHost, int peerPort); abstract SSLSessionContext sessionContext(); final SslHandler newHandler(ByteBufAllocator alloc); final SslHandler newHandler(ByteBufAllocator alloc, String peerHost, int peerPort);  }