我全新安装了 ubuntu 18.04。我的构建(例如 Maven 和 Gradle)访问存储库 https 时遇到问题,它显示的消息是:
java.security.InvalidAlgorithmParameterException:trustAnchors 参数必须为非空
当我尝试使用以下命令从我的密钥库访问证书时:
keytool -list -keystore /etc/ssl/certs/java/cacerts
提示我输入密码,这不是问题,但如果我只是按 Enter 而不输入密码,它不会显示任何条目。
如果我输入密码,所有证书都会正常显示。我必须做的是向我的所有 Java 应用程序添加以下系统属性:javax.net.ssl.trustStorePassword=changeit
然后一切正常。我做错了什么?
编辑:
这是现在对 cacerts 的许可:
-rw-r--r-- 1 root root 167K jun 8 11:21 /etc/ssl/certs/java/cacerts
所以每个人都可以阅读。如果我尝试使用没有密码的列表:
keytool -list -keystore /etc/ssl/certs/java/cacerts ✔ 308 10:27:15
Enter keystore password:
***************** WARNING WARNING WARNING *****************
* The integrity of the information stored in your keystore *
* has NOT been verified! In order to verify its integrity, *
* you must provide your keystore password. *
***************** WARNING WARNING WARNING *****************
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 0 entries
with the password:keytool -list -keystore /etc/ssl/certs/java/cacerts ✔ 310 10:36:33
Enter keystore password:
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 134 entries