我有一个Java客户端试图访问带有自签名证书的服务器.
当我尝试发布到服务器时,我收到以下错误:
无法找到所请求目标的有效证书路径
在对这个问题进行了一些研究之后,我做了以下工作.
root.cer
文件.keytool -import -alias example -keystore cacerts -file root.cer
keytool -list -v -keystore cacerts
我仍然得到同样的错误.
我有一种感觉这是因为我的Glassfish实际上并没有阅读我修改过的cacert文件,但可能还有其他一些.
你们有没有遇到过这个问题,能否把我推向正确的方向?
我正在尝试使用Java中的HttpURLConnection发出HTTP GET请求。当我开始使用浏览器时,它说我的证书不受信任,您要继续吗?我接受证书,并且GET请求获取数据。但是我在java中获得证书异常(下面给出)
我从该异常中了解到的是,在发出GET请求之前,我需要下载该证书并放置此java系统属性。
我的问题是。
非常感谢 :)
我正在尝试使用keytool命令下载证书。我不知道证书存储在服务器中的位置,但是我给出了我在浏览器中使用的服务器的路径,浏览器说证书不受信任。
URL gatewayServiceUrl = new URL("http://192.168.55.179:56400/nwa");
HttpURLConnection connection = (HttpURLConnection) gatewayServiceUrl.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", getExample.getBasicAuth());
connection.connect();
if (HttpURLConnection.HTTP_OK == connection.getResponseCode()) {
System.out.println("success");
System.out.println(getExample.getDataFromStream(connection.getInputStream()));
} else {
System.out.println("success");
System.out.println(getExample.getDataFromStream(connection.getErrorStream()));
}
System.out.println(connection.getResponseCode());
Exception in thread "main" 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
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)
at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
at sun.security.ssl.Handshaker.processLoop(Unknown Source)
at …
Run Code Online (Sandbox Code Playgroud) 我已完成t3s设置和配置.现在,当我尝试拨打电话以获得低于异常时.请帮帮我们
尝试过url提到的使用Java进行企业软件开发的步骤:WebLogic Server SSL(https/t3s)和Java Web Start
以及根据配置传输级安全性的代码包含
System.setProperty("weblogic.security.SSL.ignoreHostnameVerification","true");
System.setProperty("java.protocol.handler.pkgs", "weblogic.net");
System.setProperty("weblogic.security.TrustKeyStore","CustomTrust");
System.setProperty("weblogic.security.CustomTrustKeyStoreFileName","TRUST_STORE_LOCATION");
System.setProperty("weblogic.security.CustomTrustKeyStorePassPhrase","TRUST_STORE_PASSWORD");
System.setProperty("weblogic.security.CustomTrustKeyStoreType","JKS");
Run Code Online (Sandbox Code Playgroud)
例外:
[java] <Feb 25, 2014 1:14:22 AM EST> <Info> <Security> <BEA-090905> <Disabling the CryptoJ JCE Provider self-integrity check for better startup performance. To enable this check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true.>
[java] <Feb 25, 2014 1:14:22 AM EST> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG to FIPS186PRNG. To disable this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true.>
[java] <Feb 25, 2014 1:14:22 AM …
Run Code Online (Sandbox Code Playgroud) 我们使用TeamCity 7.1.5.,我更新了TeamCity Server站点证书(用新的替换了server.p12文件)新的时间段,并且TeamCity Server与单个Agent失去了连接.代理状态为Disconnected,Authorized,Enabled.使用WEB浏览器,我导航到TeamCity站点并确保新证书有效.
进入teamcity-agent.log文件,我看到许多类似的消息,示例:
" [2014-03-20 16:37:11,694] WARN - jetbrains.buildServer.AGENT - Ping problem: Call https://oursite.com/RPC2 buildServer.ping: 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
"
如何使用新证书修复此代理连接问题?
使用旧站点证书TeamCity正常工作.我看到旧证书和新证书的细节有所不同.旧证书签名算法是具有RSA加密的PKC#1 SHA-1.新证书签名算法是具有RSA加密的PKC#1 SHA-256.
提前感谢您的帮助!