I wanted to create a certificate into a PKCS12 keystore format with keytool program.
The keystore has extension .pfx.
.pfx
How do I achieve this?
If the keystore is PKCS12 type (.pfx) you have to specify it with -storetype PKCS12 (line breaks added for readability):
-storetype PKCS12
keytool -genkey -alias -keystore -storetype PKCS12 -keyalg RSA -storepass -validity 730 -keysize 2048