I have a p12 certificate and I am trying to convert it into a jks keystore.The p12 certificate was created without a password. This is the command I'm using-
keytool -importkeystore -srckeystore [Source.p12] -srcstoretype PKCS12 -srcalias [Src alias] -destkeystore [destination.jks] -deststoretype JKS -deststorepass [Some pass] -destalias [Some alias]
The configurable values are inside square brackets. When I execute this I am prompted for the source keystore password. Since Source doesn't have a password I just hit enter but then I am met with a keytool error stating "invalid null input".
Enter source keystore password:
***************** WARNING WARNING WARNING *****************
* The integrity of the information stored in the srckeystore*
* has NOT been verified! In order to verify its integrity, *
* you must provide the srckeystore password. *
***************** WARNING WARNING WARNING *****************
keytool error: java.lang.NullPointerException: invalid null input
Surprisingly if I use the list command that is - keytool -list -storetype PKCS12 -keystore elastic-certificates.p12 -v
, I am again prompted for a password but this time it works on hitting enter and i get the alias and other information.
Any leads on what may be going wrong here?
Modifying the above command to have src password as blank string "" worked and it didn't prompt me again for a password. This is what worked-
keytool -importkeystore -srckeystore [Source.p12] -srcstoretype PKCS12 -srcalias [Src alias] -srcstorepass "" -destkeystore [destination.jks] -deststoretype JKS -deststorepass [Some pass] -destalias [Some alias]