1- Create PKCS#12 keystore (.p12 or .pfx file)
keytool -genkeypair -keystore myKeystore.p12 -storetype PKCS12 -storepass MY_PASSWORD -alias KEYSTORE_ENTRY -keyalg RSA -keysize 2048 -validity 99999 -dname "CN=My SSL Certificate, OU=My Team, O=My Company, L=My City, ST=My State, C=SA" -ext san=dns:mydomain.com,dns:localhost,ip:127.0.0.1
myKeystore.p12
= keystore filename. It can with .pfx extension as well.MY_PASSWORD
= password used for the keystore and the private key as well.CN
= commonName, it will be shown as certiciate name in certificates list.OU
= organizationUnit, department name for example.