From e1c5e5922ae9a63fcab3df8995905ca5833c8eae Mon Sep 17 00:00:00 2001 From: "Gary D. Gregory" Date: Tue, 28 Mar 2017 18:53:43 +0000 Subject: [PATCH] [HTTPCLIENT-1836] DefaultHostnameVerifier#getSubjectAltNames(X509Certificate) throws java.lang.ClassCastException. Contributed by Gary Gregory , Ilian Iliev git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1789189 13f79535-47bb-0310-9956-ffa450edef68 --- RELEASE_NOTES.txt | 6 ++++++ .../hc/client5/http/ssl/DefaultHostnameVerifier.java | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index bad7269e1..af97b5e92 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -19,6 +19,12 @@ Changelog: * [HTTPCLIENT-1817] Add a "Trust All" TrustStrategy implementation. Contributed by Gary Gregory +* [HTTPCLIENT-1817] Add a "Trust All" TrustStrategy implementation. + Contributed by Gary Gregory + +* [HTTPCLIENT-1836] DefaultHostnameVerifier#getSubjectAltNames(X509Certificate) throws java.lang.ClassCastException. + Contributed by Gary Gregory , Ilian Iliev + Release 5.0-ALPHA1 ------------------- diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/DefaultHostnameVerifier.java b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/DefaultHostnameVerifier.java index 8a09ff474..d4bbe0e71 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/DefaultHostnameVerifier.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/DefaultHostnameVerifier.java @@ -303,8 +303,12 @@ public final class DefaultHostnameVerifier implements HttpClientHostnameVerifier for (final List entry : entries) { final Integer type = entry.size() >= 2 ? (Integer) entry.get(0) : null; if (type != null) { - final String s = (String) entry.get(1); - result.add(new SubjectName(s, type)); + final Object o = entry.get(1); + if (o instanceof String) { + result.add(new SubjectName((String) o, type.intValue())); + } else if (o instanceof byte[]) { + // TODO ASN.1 DER encoded form + } } } return result;