Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

keytool error: java.io.IOException: parseAlgParameters failed: ObjectIdentifier() -- data isn't an object ID (tag = 48)

I am trying to generate keystore using keytool and getting below error -

D:\Java\bin>keytool -importkeystore -srckeystore cert1.p12 -srcstoretype pkcs12 -destkeystore cert1.keystore -deststoretype JKS
Enter destination keystore password:
Re-enter new password:
Enter source keystore password:
keytool error: java.io.IOException: parseAlgParameters failed: ObjectIdentifier() -- data isn't an object ID (tag = 48)

2 Answers

As @Klaws and @dave_thompson_085 suggested in the comments above, add the -legacy parameter to the openssl pkcs12 command:

openssl pkcs12 -inkey cert1.private.key -in cert1.public.crt -export -out cert1.p12 -legacy
keytool -importkeystore -srckeystore cert1.p12 -srcstoretype pkcs12 -destkeystore cert1.keystore -deststoretype JKS
like image 97
Peter Zaitcev Avatar answered Sep 15 '25 04:09

Peter Zaitcev


Updating the JDK will solve this issue. The old JDK used doesn't support an algorithm used by the imported keystore. This is fixed in more recent JDKs.

like image 34
Emmanuel Bourg Avatar answered Sep 15 '25 03:09

Emmanuel Bourg