You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2020/03/22 10:03:14 UTC
[httpcomponents-core] branch master updated: Switched to TLSv1.2 as
default protocol if none provided (#194)
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git
The following commit(s) were added to refs/heads/master by this push:
new 3f94dee Switched to TLSv1.2 as default protocol if none provided (#194)
3f94dee is described below
commit 3f94dee90fa17fca461264a93a6529f148869db1
Author: Hakky54 <ha...@hotmail.com>
AuthorDate: Sun Mar 22 11:03:07 2020 +0100
Switched to TLSv1.2 as default protocol if none provided (#194)
---
.../src/main/java/org/apache/hc/core5/ssl/SSLContextBuilder.java | 4 ++--
httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContexts.java | 2 +-
.../src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContextBuilder.java b/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContextBuilder.java
index 89ecac2..aa576ba 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContextBuilder.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContextBuilder.java
@@ -77,7 +77,7 @@ import org.apache.hc.core5.util.Args;
*/
public class SSLContextBuilder {
- static final String TLS = "TLS";
+ static final String DEFAULT_PROTOCOL = "TLSv1.2";
private String protocol;
private final Set<KeyManager> keyManagers;
@@ -348,7 +348,7 @@ public class SSLContextBuilder {
public SSLContext build() throws NoSuchAlgorithmException, KeyManagementException {
final SSLContext sslContext;
- final String protocolStr = this.protocol != null ? this.protocol : TLS;
+ final String protocolStr = this.protocol != null ? this.protocol : DEFAULT_PROTOCOL;
if (this.provider != null) {
sslContext = SSLContext.getInstance(protocolStr, this.provider);
} else {
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContexts.java b/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContexts.java
index 213026b..86ed039 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContexts.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContexts.java
@@ -63,7 +63,7 @@ public final class SSLContexts {
*/
public static SSLContext createDefault() throws SSLInitializationException {
try {
- final SSLContext sslContext = SSLContext.getInstance(SSLContextBuilder.TLS);
+ final SSLContext sslContext = SSLContext.getInstance(SSLContextBuilder.DEFAULT_PROTOCOL);
sslContext.init(null, null, null);
return sslContext;
} catch (final NoSuchAlgorithmException | KeyManagementException ex) {
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java b/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java
index ee0e369..0579858 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java
@@ -138,7 +138,7 @@ public class TestSSLContextBuilder {
.loadKeyMaterial((KeyStore) null, null, null)
.build();
Assert.assertNotNull(sslContext);
- Assert.assertEquals("TLS", sslContext.getProtocol());
+ Assert.assertEquals("TLSv1.2", sslContext.getProtocol());
Assert.assertEquals(PROVIDER_SUN_JSSE, sslContext.getProvider().getName());
}
@@ -151,7 +151,7 @@ public class TestSSLContextBuilder {
.loadKeyMaterial((KeyStore) null, null, null)
.build();
Assert.assertNotNull(sslContext);
- Assert.assertEquals("TLS", sslContext.getProtocol());
+ Assert.assertEquals("TLSv1.2", sslContext.getProtocol());
}
@Test