How to create a certificate into a PKCS12 keystore with keytool?
I wanted to create a certificate into a PKCS12 keystore format with keytool program. The keystore has extension .pfx . How do I achieve this? David García González If the keystore is PKCS12 type ( .pfx ) you have to specify it with -storetype PKCS12 (line breaks added for readability): keytool -genkey -alias <desired certificate alias> -keystore <path to keystore.pfx> -storetype PKCS12 -keyalg RSA -storepass <password> -validity 730 -keysize 2048 Additional answer to the key of the question . With JDK 8 ( 1.8.0_121-b13 ) you don't get an exception if you remove -storetype pkcs12 but the