简体   繁体   English

keytool导入证书和Java系统属性

[英]keytool import certificate and java system property

I have to call a WebService via https. 我必须通过https调用WebService。 If I import the crt file in a specific keystore and then I set System properties: 如果我将crt文件导入特定的密钥库中,然后设置系统属性:

System.setProperty("javax.net.ssl.trustStore", path);
System.setProperty("javax.net.ssl.trustStorePassword", pwd)

Everithing works fine. 一切正常。 If I try to import crt file as a trusted certificate with this instruction: 如果我尝试通过以下说明将crt文件作为受信任的证书导入:

keytool -trustcacerts -import -alias <alias> -file <path to crt file>

I get an javax.net.ssl.SSLHandshakeException. 我得到一个javax.net.ssl.SSLHandshakeException。

How can I avoid the use of System properties? 如何避免使用系统属性?

How can I avoid the use of System properties? 如何避免使用系统属性?

Use a CA-signed certificate. 使用CA签名的证书。

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

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