SSL请求trustStore的两种注册方式 缺乏、安全感 2022-09-18 11:44 111阅读 0赞 如果是要发起SSL请求,这个时候通常是需要指定trustStore的,当然如果你使用自签名那是不需要的(查看如何使用自签名,查看这篇文章 [http://blog.csdn.net/fenglibing/article/details/16842527][http_blog.csdn.net_fenglibing_article_details_16842527] )。 一种方式是通过在启动参数中指定,如下: java -Djavax.net.ssl.trustStore=yourTruststore.jks -Djavax.net.ssl.trustStorePassword=123456 YourApp 还是一种就是通过程序中指定Properties参数进行加载,不过一定要在请求发出之前进行加载,如下: Properties systemProps = System.getProperties(); systemProps.put( "javax.net.ssl.trustStore", "/path/to/yourTruststore.jks"); systemProps.put( "javax.net.ssl.trustStorePassword", "trustStorePassword"); System.setProperties(systemProps); 如果trustStore没有密码,那以下两种加载方式的参数”javax.net.ssl.trustStorePassword”都是不需要输入的。 [http_blog.csdn.net_fenglibing_article_details_16842527]: http://blog.csdn.net/fenglibing/article/details/16842527
还没有评论,来说两句吧...