Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to import .p12 keystore

I created a .p12 keystore using openssl from a pkcs8 keystore. Now I'm trying to import the private key using java Keytool into a new JKS keystore. I tried the command:

keytool -importkeystore -srckeystore newKS.p12 -srcstoretype pkcs12 -srcstorepass pass -destkeystore exportedJks.jks -deststoretype jks -deststorepass pass

But I get the following error message:

keytool error: java.security.UnrecoverableKeyException: Get Key failed: EC KeyFactory not available

How can I resolve this error so I can import this key into a new JKS keystore?

like image 613
Amir_Af Avatar asked Dec 25 '14 17:12

Amir_Af


People also ask

Is p12 and JKS same?

p12 is the name of the p12 file and key. jks is the name of the jks keystore to be created.

Is a p12 file a keystore?

p12 is the keystore and -nokeys means only extract the certificates and not the keys.


1 Answers

The error message means that the Java runtime could not find a crypto provider for ECC (elliptic curve cryptography) algorithms.

Java 6 contains only basic support for ECC: It knows the OIDs of most EC algorithms and therefore knows that it must find an "EC KeyFactory". However, by default no provider is installed that can handle these algorithms.

The SunEC provider with full ECC support was added in Java 7, so the easiest solution for this problem is to use keytool from a Java 7 or 8 runtime.

like image 179
Omikron Avatar answered Oct 03 '22 22:10

Omikron