Skip to content

Commit b85889f

Browse files
committed
Special-case exception for SunJSSE compatibility
1 parent f3ec578 commit b85889f

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tls/src/main/java/org/bouncycastle/jsse/provider/ProvX509TrustManager.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,20 @@ private static void checkEndpointID(X509Certificate certificate, String endpoint
456456
}
457457
}
458458

459-
checkEndpointID(peerHost, certificate, endpointIDAlg);
459+
try
460+
{
461+
checkEndpointID(peerHost, certificate, endpointIDAlg);
462+
}
463+
catch (CertificateException e)
464+
{
465+
// Special case for SunJSSE compatibility
466+
if (!checkServerTrusted && "HTTPS".equalsIgnoreCase(endpointIDAlg))
467+
{
468+
throw new CertificateException("Endpoint ID algorithm 'HTTPS' is not supported on the server side");
469+
}
470+
471+
throw e;
472+
}
460473
}
461474

462475
private static X509CertSelector createTargetCertConstraints(final X509Certificate eeCert,

0 commit comments

Comments
 (0)