【发布时间】:2013-07-31 10:49:29
【问题描述】:
我的证书有问题。这是我的堆栈跟踪:
trustStore is: /usr/user/programs/java/jdk1.7.0_10/jre/lib/security/jssecacerts
trustStore type is : jks
trustStore provider is :
init truststore
adding as trusted cert:
Subject: EMAILADDRESS=******, CN=865409164, OU=http://www.sistem.net, O=DOO, L=Citluk, ST=Text, C=BA
Issuer: EMAILADDRESS=***********, CN=ecommtest.rbbh.ba, OU=ITRIOSS.CARD, O=BANK, L=CITY, ST=******, C=BA
算法:RSA;序列号:0xf6e5b0e213f9b11b 有效期为 2013 年 7 月 30 日星期二 14:43:23 CEST 至 2014 年 7 月 30 日星期三 14:43:23 CEST
最后我得到了这个:
***
%% Invalidated: [Session-1, TLS_RSA_WITH_AES_128_CBC_SHA]
main, SEND TLSv1 ALERT: fatal, description = certificate_unknown
main, WRITE: TLSv1 Alert, length = 2
[Raw write]: length = 7
0000: 15 03 01 00 02 02 2E .......
main, called closeSocket()
main, handling exception: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
main, IOException in getSession(): javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
main, called close()
main, called closeInternal(true)
我已经获得了 PKCS12 的证书,然后我通过 jssecacerts 中的 keytool 导入密钥库并将其复制到 JDK/jre/lib/security 中
我使用 apache HttpClient 来执行 POST 请求。
感谢您的帮助
兹拉亚
【问题讨论】:
-
你能澄清你想要做什么吗?您是否尝试使用客户端证书身份验证?此外,不需要将 PKCS12 导入 jre/lib/security/cacerts。需要在此处导入颁发者的证书。
-
我想连接到别人的公司服务器。我从那家公司获得了 pkcs12 证书。我使用 apache HttpClient 4.1 进行发布请求。我尝试了很多我在互联网上找到的想法,但都没有成功。
-
您需要确定颁发者证书,然后我建议考虑将 PKCS#12 和颁发者证书加载到单个 JKS 密钥库中。然后配置套接字工厂以将该存储用作密钥库和信任库。
-
我找到了这个mkyong.com/webservices/jax-ws/…。应用程序从服务器获取证书并创建密钥库。现在,我没有以前的错误,jdk找不到证书,但知道一个,main,收到EOFException:错误main,处理异常:javax.net.ssl.SSLHandshakeException:握手期间远程主机关闭连接。我不知道这一步是否向前迈进了。