GeezerVison is showing github.com — Backport 4.1 Fix propagation of startTls for client SslContext handle… · lltopk/netty@d364fcc
File treeExpand file treeCollapse file tree Open diff view settings handler/src/main/java/io/netty/handler/ssl
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: handler/src/main/java/io/netty/handler/ssl/OpenSslClientContext.java +16-2Lines changed: 16 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -178,7 +178,7 @@ public OpenSslClientContext(File trustCertCollectionFile, TrustManagerFactory tr | 178 | 178 | this(toX509CertificatesInternal(trustCertCollectionFile), trustManagerFactory, | 179 | 179 | toX509CertificatesInternal(keyCertChainFile), toPrivateKeyInternal(keyFile, keyPassword), | 180 | 180 | keyPassword, keyManagerFactory, ciphers, cipherFilter, apn, null, sessionCacheSize, | 181 | | - sessionTimeout, false, KeyStore.getDefaultType(), null, null); | | 181 | + sessionTimeout, false, false, KeyStore.getDefaultType(), null, null); | 182 | 182 | } | 183 | 183 |
| 184 | 184 | OpenSslClientContext(X509Certificate[] trustCertCollection, TrustManagerFactory trustManagerFactory, | @@ -189,7 +189,21 @@ public OpenSslClientContext(File trustCertCollectionFile, TrustManagerFactory tr | 189 | 189 | String endpointIdentificationAlgorithm, ResumptionController resumptionController, | 190 | 190 | Map.Entry<SslContextOption<?>, Object>... options) | 191 | 191 | throws SSLException { | 192 | | - super(ciphers, cipherFilter, apn, SSL.SSL_MODE_CLIENT, keyCertChain, ClientAuth.NONE, protocols, false, | | 192 | + this(trustCertCollection, trustManagerFactory, keyCertChain, key, keyPassword, keyManagerFactory, ciphers, | | 193 | + cipherFilter, apn, protocols, sessionCacheSize, sessionTimeout, false, enableOcsp, keyStore, | | 194 | + endpointIdentificationAlgorithm, resumptionController, options); | | 195 | + } | | 196 | + | | 197 | + OpenSslClientContext(X509Certificate[] trustCertCollection, TrustManagerFactory trustManagerFactory, | | 198 | + X509Certificate[] keyCertChain, PrivateKey key, String keyPassword, | | 199 | + KeyManagerFactory keyManagerFactory, Iterable<String> ciphers, | | 200 | + CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, String[] protocols, | | 201 | + long sessionCacheSize, long sessionTimeout, boolean startTls, boolean enableOcsp, | | 202 | + String keyStore, String endpointIdentificationAlgorithm, | | 203 | + ResumptionController resumptionController, | | 204 | + Map.Entry<SslContextOption<?>, Object>... options) | | 205 | + throws SSLException { | | 206 | + super(ciphers, cipherFilter, apn, SSL.SSL_MODE_CLIENT, keyCertChain, ClientAuth.NONE, protocols, startTls, | 193 | 207 | endpointIdentificationAlgorithm, enableOcsp, resumptionController, options); | 194 | 208 | boolean success = false; | 195 | 209 | try { | |
Collapse file Copy file name to clipboardExpand all lines: handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslClientContext.java +15-1Lines changed: 15 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -66,8 +66,22 @@ public final class ReferenceCountedOpenSslClientContext extends ReferenceCounted | 66 | 66 | boolean enableOcsp, String keyStore, String endpointIdentificationAlgorithm, | 67 | 67 | ResumptionController resumptionController, | 68 | 68 | Map.Entry<SslContextOption<?>, Object>... options) throws SSLException { | | 69 | + this(trustCertCollection, trustManagerFactory, keyCertChain, key, keyPassword, keyManagerFactory, ciphers, | | 70 | + cipherFilter, apn, protocols, sessionCacheSize, sessionTimeout, false, enableOcsp, keyStore, | | 71 | + endpointIdentificationAlgorithm, resumptionController, options); | | 72 | + } | | 73 | + | | 74 | + ReferenceCountedOpenSslClientContext(X509Certificate[] trustCertCollection, TrustManagerFactory trustManagerFactory, | | 75 | + X509Certificate[] keyCertChain, PrivateKey key, String keyPassword, | | 76 | + KeyManagerFactory keyManagerFactory, Iterable<String> ciphers, | | 77 | + CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, | | 78 | + String[] protocols, long sessionCacheSize, long sessionTimeout, | | 79 | + boolean startTls, boolean enableOcsp, String keyStore, | | 80 | + String endpointIdentificationAlgorithm, | | 81 | + ResumptionController resumptionController, | | 82 | + Map.Entry<SslContextOption<?>, Object>... options) throws SSLException { | 69 | 83 | super(ciphers, cipherFilter, toNegotiator(apn), SSL.SSL_MODE_CLIENT, keyCertChain, | 70 | | - ClientAuth.NONE, protocols, false, endpointIdentificationAlgorithm, enableOcsp, true, | | 84 | + ClientAuth.NONE, protocols, startTls, endpointIdentificationAlgorithm, enableOcsp, true, | 71 | 85 | resumptionController, options); | 72 | 86 | boolean success = false; | 73 | 87 | try { | |
Collapse file Copy file name to clipboardExpand all lines: handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslContext.java +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -114,7 +114,7 @@ public abstract class ReferenceCountedOpenSslContext extends SslContext implemen | 114 | 114 | static final boolean SERVER_ENABLE_SESSION_TICKET = | 115 | 115 | SystemPropertyUtil.getBoolean("jdk.tls.server.enableSessionTicketExtension", false); | 116 | 116 |
| 117 | | - static final boolean SERVER_ENABLE_SESSION_TICKET_TLSV13 = | | 117 | + static final boolean SERVER_ENABLE_SESSION_TICKET_TLSV13 = | 118 | 118 | SystemPropertyUtil.getBoolean("jdk.tls.server.enableSessionTicketExtension", true); | 119 | 119 |
| 120 | 120 | static final boolean SERVER_ENABLE_SESSION_CACHE = | @@ -527,7 +527,7 @@ protected SslHandler newHandler(ByteBufAllocator alloc, boolean startTls, Execut | 527 | 527 | @Override | 528 | 528 | protected SslHandler newHandler(ByteBufAllocator alloc, String peerHost, int peerPort, | 529 | 529 | boolean startTls, Executor executor) { | 530 | | - return new SslHandler(newEngine0(alloc, peerHost, peerPort, false), false, executor, resumptionController); | | 530 | + return new SslHandler(newEngine0(alloc, peerHost, peerPort, false), startTls, executor, resumptionController); | 531 | 531 | } | 532 | 532 |
| 533 | 533 | SSLEngine newEngine0(ByteBufAllocator alloc, String peerHost, int peerPort, boolean jdkCompatibilityMode) { | |
Collapse file Copy file name to clipboardExpand all lines: handler/src/main/java/io/netty/handler/ssl/SslContext.java +19-2Lines changed: 19 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -826,6 +826,21 @@ static SslContext newClientContextInternal( | 826 | 826 | long sessionCacheSize, long sessionTimeout, boolean enableOcsp, | 827 | 827 | SecureRandom secureRandom, String keyStoreType, String endpointIdentificationAlgorithm, | 828 | 828 | Map.Entry<SslContextOption<?>, Object>... options) throws SSLException { | | 829 | + return newClientContextInternal(provider, sslContextProvider, trustCert, trustManagerFactory, keyCertChain, key, | | 830 | + keyPassword, keyManagerFactory, ciphers, cipherFilter, apn, protocols, sessionCacheSize, | | 831 | + sessionTimeout, false, enableOcsp, secureRandom, keyStoreType, endpointIdentificationAlgorithm, | | 832 | + options); | | 833 | + } | | 834 | + | | 835 | + static SslContext newClientContextInternal( | | 836 | + SslProvider provider, | | 837 | + Provider sslContextProvider, | | 838 | + X509Certificate[] trustCert, TrustManagerFactory trustManagerFactory, | | 839 | + X509Certificate[] keyCertChain, PrivateKey key, String keyPassword, KeyManagerFactory keyManagerFactory, | | 840 | + Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, String[] protocols, | | 841 | + long sessionCacheSize, long sessionTimeout, boolean startTls, boolean enableOcsp, | | 842 | + SecureRandom secureRandom, String keyStoreType, String endpointIdentificationAlgorithm, | | 843 | + Map.Entry<SslContextOption<?>, Object>... options) throws SSLException { | 829 | 844 | if (provider == null) { | 830 | 845 | provider = defaultClientProvider(); | 831 | 846 | } | @@ -848,14 +863,16 @@ static SslContext newClientContextInternal( | 848 | 863 | return new OpenSslClientContext( | 849 | 864 | trustCert, trustManagerFactory, keyCertChain, key, keyPassword, | 850 | 865 | keyManagerFactory, ciphers, cipherFilter, apn, protocols, sessionCacheSize, sessionTimeout, | 851 | | - enableOcsp, keyStoreType, endpointIdentificationAlgorithm, resumptionController, options); | | 866 | + startTls, enableOcsp, keyStoreType, endpointIdentificationAlgorithm, | | 867 | + resumptionController, options); | 852 | 868 | case OPENSSL_REFCNT: | 853 | 869 | verifyNullSslContextProvider(provider, sslContextProvider); | 854 | 870 | OpenSsl.ensureAvailability(); | 855 | 871 | return new ReferenceCountedOpenSslClientContext( | 856 | 872 | trustCert, trustManagerFactory, keyCertChain, key, keyPassword, | 857 | 873 | keyManagerFactory, ciphers, cipherFilter, apn, protocols, sessionCacheSize, sessionTimeout, | 858 | | - enableOcsp, keyStoreType, endpointIdentificationAlgorithm, resumptionController, options); | | 874 | + startTls, enableOcsp, keyStoreType, endpointIdentificationAlgorithm, | | 875 | + resumptionController, options); | 859 | 876 | default: | 860 | 877 | throw new Error(provider.toString()); | 861 | 878 | } | |
Collapse file Copy file name to clipboardExpand all lines: handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -648,7 +648,7 @@ public SslContext build() throws SSLException { | 648 | 648 | return SslContext.newClientContextInternal(provider, sslContextProvider, trustCertCollection, | 649 | 649 | trustManagerFactory, keyCertChain, key, keyPassword, keyManagerFactory, | 650 | 650 | ciphers, cipherFilter, apn, protocols, sessionCacheSize, | 651 | | - sessionTimeout, enableOcsp, secureRandom, keyStoreType, endpointIdentificationAlgorithm, | | 651 | + sessionTimeout, startTls, enableOcsp, secureRandom, keyStoreType, endpointIdentificationAlgorithm, | 652 | 652 | toArray(options.entrySet(), EMPTY_ENTRIES)); | 653 | 653 | } | 654 | 654 | } | |
|