我正在尝试根据 this post 更新 SSL 证书 .
我是证书菜鸟,所以我关注 this guide .但是,当我输入
keytool -keystore mycacerts -storepass changeit -importcert -file "C:\Users\Noks\Desktop\cacerts.pem" -v
我得到错误:
keytool error: java.lang.Exception: Input not an X.509 certificate
java.lang.Exception: Input not an X.509 certificate
at sun.security.tools.KeyTool.addTrustedCert(KeyTool.java:1913)
at sun.security.tools.KeyTool.doCommands(KeyTool.java:818)
at sun.security.tools.KeyTool.run(KeyTool.java:172)
at sun.security.tools.KeyTool.main(KeyTool.java:166)
我该如何解决这个问题?
最佳答案
您的 cacerts.pem 文件是否包含一个证书?既然是 PEM,看一下(用文本编辑器),它应该以
开头-----BEGIN CERTIFICATE-----
并以
结尾-----END CERTIFICATE-----
最后,要检查它没有损坏,获取 openssl 并使用打印其详细信息
openssl x509 -in cacerts.pem -text
关于java - 导入 SSL 证书时出错 : Not an X. 509 证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9889669/