Java Jersey不发送ssl客户端证书

时间:2016-08-21 17:10:20

标签: java ssl glassfish jersey-2.0 jersey-client

我有Jersey应用程序,它使用Jersey客户端来请求服务器。服务器使用客户端证书和基本身份验证进行通信。我已经使用glassfish中的证书正确设置了信任库和密钥库

服务器证书链: 服务器证书 - > CA Inter - > CA

客户证书链: 客户证书 - > CA Inter - > CA

CA是自行创建/签名的证书,而非供应商。

信任:

1)CA

2)CA Inter

密钥库:

1)具有完整链的客户证书

代码:(商店在环境中设置)

sSLContext = SslConfigurator.newInstance().securityProtocol("TLSv1.2").createSSLContext();
HttpAuthenticationFeature authFeature = HttpAuthenticationFeature.basic("user", "pass");
client = ClientBuilder.newBuilder().sslContext(sSLContext).build();
client.register(authFeature);

正确加载所有证书和链。

然而,当我提出请求时,我得到了

Info:   Warning: no suitable certificate found - continuing without client authentication

然后我得到handshake_failure错误

我收到其他错误

Info:   http-listener-1(3), setSoTimeout(0) called
Info:   Ignoring unsupported cipher suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 for TLSv1
Info:   Ignoring unsupported cipher suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 for TLSv1
Info:   Ignoring unsupported cipher suite: TLS_RSA_WITH_AES_256_CBC_SHA256 for TLSv1
Info:   Ignoring unsupported cipher suite: TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 for TLSv1
Info:   Ignoring unsupported cipher suite: TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 for TLSv1
Info:   Ignoring unsupported cipher suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 for TLSv1
Info:   Ignoring unsupported cipher suite: TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 for TLSv1
Info:   Ignoring unsupported cipher suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 for TLSv1.1
Info:   Ignoring unsupported cipher suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 for TLSv1.1
Info:   Ignoring unsupported cipher suite: TLS_RSA_WITH_AES_256_CBC_SHA256 for TLSv1.1
Info:   Ignoring unsupported cipher suite: TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 for TLSv1.1
Info:   Ignoring unsupported cipher suite: TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 for TLSv1.1
Info:   Ignoring unsupported cipher suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 for TLSv1.1
Info:   Ignoring unsupported cipher suite: TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 for TLSv1.1

我已经安装了无限的chiper扩展,并检查了它的工作情况。还是得到了这些。

我还检查了浏览器上的证书,我可以通过浏览器连接到服务器并使用相同的证书获取数据。

如何让双向ssl工作?

1 个答案:

答案 0 :(得分:0)

客户端和服务器都需要各自信任库中的CA证书。我会说服务器没有。

当服务器请求客户端证书时,它会发送其可信CA的列表,如果客户端找不到由其中一个签名的证书,则它不会发送一个,