提交 331267eb 编写于 作者: X xuelei

8207029: Unable to use custom SSLEngine with default TrustManagerFactory after...

8207029: Unable to use custom SSLEngine with default TrustManagerFactory after updating to JDK 11 b21
Reviewed-by: wetmore
上级 e7a1b74e
......@@ -73,12 +73,20 @@ final class SSLAlgorithmConstraints implements AlgorithmConstraints {
boolean withDefaultCertPathConstraints) {
AlgorithmConstraints configuredConstraints = null;
if (socket != null) {
HandshakeContext hc =
((SSLSocketImpl)socket).conContext.handshakeContext;
if (hc != null) {
configuredConstraints = hc.sslConfig.algorithmConstraints;
// Note that the KeyManager or TrustManager implementation may be
// not implemented in the same provider as SSLSocket/SSLEngine.
// Please check the instance before casting to use SSLSocketImpl.
if (socket instanceof SSLSocketImpl) {
HandshakeContext hc =
((SSLSocketImpl)socket).conContext.handshakeContext;
if (hc != null) {
configuredConstraints = hc.sslConfig.algorithmConstraints;
} else {
configuredConstraints = null;
}
} else {
configuredConstraints = null;
configuredConstraints =
socket.getSSLParameters().getAlgorithmConstraints();
}
}
this.userSpecifiedConstraints = configuredConstraints;
......@@ -90,12 +98,20 @@ final class SSLAlgorithmConstraints implements AlgorithmConstraints {
boolean withDefaultCertPathConstraints) {
AlgorithmConstraints configuredConstraints = null;
if (engine != null) {
HandshakeContext hc =
((SSLEngineImpl)engine).conContext.handshakeContext;
if (hc != null) {
configuredConstraints = hc.sslConfig.algorithmConstraints;
// Note that the KeyManager or TrustManager implementation may be
// not implemented in the same provider as SSLSocket/SSLEngine.
// Please check the instance before casting to use SSLEngineImpl.
if (engine instanceof SSLEngineImpl) {
HandshakeContext hc =
((SSLEngineImpl)engine).conContext.handshakeContext;
if (hc != null) {
configuredConstraints = hc.sslConfig.algorithmConstraints;
} else {
configuredConstraints = null;
}
} else {
configuredConstraints = null;
configuredConstraints =
engine.getSSLParameters().getAlgorithmConstraints();
}
}
this.userSpecifiedConstraints = configuredConstraints;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册