保护 Web 服务:有效的 SSL 密钥错误“ValidatorException:PKIX 路径构建失败”

发布于 2024-08-08 08:13:44 字数 411 浏览 7 评论 0原文

我想使用 Netbeans 和 mechansim 来保护 Web 服务:“通过 SSL 进行消息身份验证”,我会执行 Netbeans 文档和 Sun WSIT教程告诉你要做的。我还在客户端 jre 中导入生成的 SSL 密钥,但是当我运行客户端代码时,仍然出现此错误:

无法访问 WSDL:https://localhost:8443/SecureWebService?wsdl。它失败了:sun.security.validator.ValidatorException:PKIX 路径构建失败:un.security.provider.certpath。 SunCertPathBuilderException:无法找到请求目标的有效证书路径。

有人可以帮助我吗?

I want to secure a webservice using Netbeans with mechansim : "Message Authentication over SSL" and I do everything that Netbeans documentation and
Sun WSIT tutorial told to do. I also import the generated SSL key in client jre but when I run the client code, I still got this error :

Failed to access the WSDL at: https://localhost:8443/SecureWebService?wsdl. It failed with: sun.security.validator.ValidatorExcepti on: PKIX pathbuilding failed: un.security.provider.certpath. SunCertPathBuilderException: unable to find validcertification path to requested target.

can someone help me please ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

只是偏爱你 2024-08-15 08:13:45

客户端似乎无法验证整个证书路径。客户端证书是自签名的吗?可能是您的证书颁发机构未知。如果这是问题所在,您可以使用以下脚本导入 CA 的公钥:

#!/bin/bash

# path to your cacerts file
CACERTS="/etc/java-6-sun/security/cacerts"
# sun's default password - change if necessary
CACERTSPASS="changeit" 

# change this
ALIAS="myAlias"
CERTPATH="/path/to/ca.der" 

if [ `keytool -list -keystore $CACERTS -storepass $CACERTSPASS | grep -c $ALIAS` -gt 0 ]; then 
    echo already installed
else 
    keytool -import -keystore $CACERTS -storepass $CACERTSPASS -alias $ALIAS -file $CERTPATH
fi

您也可以在 Windows 计算机上使用 keytool 命令。

Looks as if the client isn't able to validate the whole certificate path. Is the client certificate self-signed? Might be that your certificate authority is unknown. If this is the problem, you may import your CA's public key using this script:

#!/bin/bash

# path to your cacerts file
CACERTS="/etc/java-6-sun/security/cacerts"
# sun's default password - change if necessary
CACERTSPASS="changeit" 

# change this
ALIAS="myAlias"
CERTPATH="/path/to/ca.der" 

if [ `keytool -list -keystore $CACERTS -storepass $CACERTSPASS | grep -c $ALIAS` -gt 0 ]; then 
    echo already installed
else 
    keytool -import -keystore $CACERTS -storepass $CACERTSPASS -alias $ALIAS -file $CERTPATH
fi

You may use the keytool commands on Windows machines as well.

溺孤伤于心 2024-08-15 08:13:45

您可以尝试将 sfussenegger 脚本中的 keytool 命令替换为:

keytool -import -keystore $CACERTS -storepass $CACERTSPASS -alias $ALIAS -file $CERTPATH -trustcacerts

然后该脚本会将您的自签名证书作为受信任的 CA 证书导入根密钥库,这将提供有效的证书路径来验证服务器的身份。

you can try replacing the keytool command in sfussenegger's script to:

keytool -import -keystore $CACERTS -storepass $CACERTSPASS -alias $ALIAS -file $CERTPATH -trustcacerts

Then the script would import your self signed certificate into the root keystore as a trusted CA Certificate, which would provide a valid certification path to verify the identity of the server.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文