hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1618566 - /httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/AbstractCommonHostnameVerifier.java
Date Mon, 18 Aug 2014 09:26:19 GMT
Author: olegk
Date: Mon Aug 18 09:26:19 2014
New Revision: 1618566

URL: http://svn.apache.org/r1618566
Log:
Use RFC2253 encoded cert subject

Modified:
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/AbstractCommonHostnameVerifier.java

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/AbstractCommonHostnameVerifier.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/AbstractCommonHostnameVerifier.java?rev=1618566&r1=1618565&r2=1618566&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/AbstractCommonHostnameVerifier.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/AbstractCommonHostnameVerifier.java
Mon Aug 18 09:26:19 2014
@@ -50,6 +50,7 @@ import javax.naming.ldap.Rdn;
 import javax.net.ssl.HostnameVerifier;
 import javax.net.ssl.SSLException;
 import javax.net.ssl.SSLSession;
+import javax.security.auth.x500.X500Principal;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -106,8 +107,8 @@ public abstract class AbstractCommonHost
 
     public final void verify(
             final String host, final X509Certificate cert) throws SSLException {
-        final String subjectPrincipal = cert.getSubjectX500Principal().toString();
-        final String[] cns = extractCNs(subjectPrincipal);
+        final X500Principal subjectPrincipal = cert.getSubjectX500Principal();
+        final String[] cns = extractCNs(subjectPrincipal.getName(X500Principal.RFC2253));
         final String[] subjectAlts = extractSubjectAlts(cert, host);
         verify(host, cns, subjectAlts);
     }



Mime
View raw message