HTTPCLIENT-1744: normalize hostname and certificate CN when matching to CN
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1745908 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cbf517ace6
commit
951d6d1bfd
|
@ -176,7 +176,9 @@ public final class DefaultHostnameVerifier implements HostnameVerifier {
|
||||||
|
|
||||||
static void matchCN(final String host, final String cn,
|
static void matchCN(final String host, final String cn,
|
||||||
final PublicSuffixMatcher publicSuffixMatcher) throws SSLException {
|
final PublicSuffixMatcher publicSuffixMatcher) throws SSLException {
|
||||||
if (!matchIdentityStrict(host, cn, publicSuffixMatcher)) {
|
final String normalizedHost = host.toLowerCase(Locale.ROOT);
|
||||||
|
final String normalizedCn = cn.toLowerCase(Locale.ROOT);
|
||||||
|
if (!matchIdentityStrict(normalizedHost, normalizedCn, publicSuffixMatcher)) {
|
||||||
throw new SSLException("Certificate for <" + host + "> doesn't match " +
|
throw new SSLException("Certificate for <" + host + "> doesn't match " +
|
||||||
"common name of the certificate subject: " + cn);
|
"common name of the certificate subject: " + cn);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue