将证书添加到 cacerts 时出错。关键规格未知
我在Windows中使用jdk 1.6。我有一个 .der 文件(DER 编码的 X509 证书)想要添加到我的 cacerts 文件中...所以我尝试了以下操作:
keytool -import -keystore "C:\Program Files\Java\jdk1.6.0_27\jre \lib\security\cacerts" -trustcacerts -alias openldap -file "C:\cacert.der"
我收到以下错误: java.security.cert.CertificateParsingException: java.io.IOException: subject key, java.security.spec.InvalidKeySpecException: Unknown key spec
起初,我认为这是证书的问题,但是然后执行以下操作,我得到完全相同的错误:
keytool -list -keystore "C:\Program Files\Java\jdk1.6.0_27\jre\lib\security\cacerts"
有什么想法为什么会出现这个问题吗?我在网上没有找到任何东西。 提前致谢。
I am using jdk 1.6 in Windows. I have a .der file (DER Encoded X509 Certificate) that will like to add to my cacerts file... so I tried the following:
keytool -import -keystore "C:\Program Files\Java\jdk1.6.0_27\jre\lib\security\cacerts" -trustcacerts -alias openldap -file "C:\cacert.der"
I got the following error:
java.security.cert.CertificateParsingException: java.io.IOException: subject key, java.security.spec.InvalidKeySpecException: Unknown key spec
At first, I thoght it was a problemen with the der certificate, but then doing the following I got exactly the same error:
keytool -list -keystore "C:\Program Files\Java\jdk1.6.0_27\jre\lib\security\cacerts"
Any ideas why is this problem appearing? I have not found anything in the Web.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的计算机上可能安装了两个或多个 jdk。您可以尝试的一件事是转到您的目标 jdk。在你的情况下,
然后运行你的命令,一旦它工作,然后确保你的 PATH 变量正确配置到目标 JDK 的 bin。
You may have two or more jdk's installed on your machine. One thing, which you can try, is go to your target jdk. In your case it is
Then run your command, Once it is working, then make sure that your PATH variable is configured properly to the targeted JDK's bin.
我在打开 cacert 列出证书时遇到了同样的问题。
我的机器上存在文件权限问题。
我尝试使用 root 用户。它工作正常。
我通过添加具有适当权限的新 jdk jre 解决了错误。
I faced same issue while opening cacert for listing the certificates.
There was a file permission issue on my machine.
I tried with root user.It was working.
I resolved error by adding new jdk jre with proper permission.