Error adding certificate to cacerts. Unknown key

I am using jdk 1.6 on windows. I have a .der file (DER Encoded X509 Certificate) that I would like to add cacerts to my 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"

The following error occurred: java.security.cert.CertificateParsingException: java.io.IOException: subject key, java.security.spec.InvalidKeySpecException: unknown key

At first, I decided that this was a problem with the der certificate, but after that I got exactly the same error:

keytool -list -keystore "C: \ Program Files \ Java \ jdk1.6.0_27 \ jre \ lib \ security \ cacerts"

Any ideas why this issue occurs? I did not find anything on the web. Thanks in advance.

+1
source share
2 answers

I faced the same issue when opening cacert to enumerate certificates. There was a file permissions issue on my computer. I tried with root user. He worked. I resolved the error by adding a new jdk jre with the appropriate resolution.

+2
source

Two or more jdk can be installed on your computer. One thing you can try is go to the target jdk. In your case, this is

C:\Program Files\Java\jdk1.6.0_27\bin

Then run your command as soon as it works, make sure your PATH variable is correctly configured in the target JDK box.

+1

Source: https://habr.com/ru/post/1526950/


All Articles