简体   繁体   English

我需要什么Java SSL(HTTPS)连接

[英]What do I need for a java SSL (HTTPS) connection

I am new to code signing and certificates. 我是代码签名和证书的新手。 Short description: I connect to a Alfresco repository to download some documents to the client using OpenCMIS. 简短说明:我连接到Alfresco存储库,以使用OpenCMIS将一些文档下载到客户端。 Everything is working fine until I tested is with our test server which uses SSL (HTTPS Url) connections. 一切正常,直到我通过使用SSL(HTTPS Url)连接的测试服务器进行测试为止。 Here I get an exception 在这里我有一个例外

sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

I have no experience with such things and dont know what I have to do so my application is running properly? 我没有这些经验,也不知道该怎么做才能使我的应用程序正常运行? I have read I have to use the certificate or a truststore or something? 我已阅读我必须使用证书或信任库之类的东西? But what exactly I need to do? 但是我到底需要做什么? Can someone help me please? 有人能帮助我吗?

EDIT: I should have mentioned that I am developing a java web start application. 编辑:我应该提到我正在开发一个Java Web Start应用程序。 Is there a solution in which I dont have to manually install the certificate to the local truststore? 有没有一种解决方案,我不必手动将证书安装到本地信任库?

EDIT2: Okay since I have to import the certificate on every computer this is no longer an option and I will use the workaround which ignores the verification of the certificate. EDIT2:好的,因为我必须在每台计算机上导入证书,所以这不再是一个选择,我将使用忽略证书验证的解决方法。

Thank you anyways guys!!! 总之谢谢你们!!!

i tried this long back for similar problem, and was working. 我为类似的问题尝试了很久,并且正在工作。

System.setProperty("javax.net.ssl.trustStore", ""); 
System.setProperty("javax.net.ssl.trustStorePassword", ""); 
System.setProperty("javax.net.ssl.trustStoreType", "");
Security.ssl.allowUnsafeRenegotiation", "true");
System.setProperty("javax.net.ssl.keyStore", ""); 
System.setProperty("javax.net.ssl.keyStorePassword", ""); 
System.setProperty("javax.net.ssl.keyStoreType", ""); 
System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true"); 

Also the same can be achieved by configuring the trustore and keystore in the application server you are using. 通过在使用的应用程序服务器中配置trustorekeystore ,也可以实现相同的trustore

Issue is with certificates not getting imported correctly. 问题在于证书未正确导入。 I hope below links will help you out. 我希望下面的链接能对您有所帮助。

Link1 链接1

Link2 链接2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM