keytool -genkeypair -keystore keystore.p12 -storetype PKCS12
-alias ${THE_ALIAS} -keyalg RSA -keysize 2048
-dname "CN=${THE_CN}" -storepass ${THE_PASSWORD}
keytool -certreq -keystore keystore.p12 -storetype PKCS12
-alias ${THE_ALIAS} -sigalg SHA256withRSA -storepass ${THE_PASSWORD}
keytool -import -keystore keystore.p12 -alias ${THE_ALIAS}
-trustcacerts -file the.chain.pem -storepass ${THE_PASSWORD}
openssl pkcs12 -nocerts -in keystore.p12 -out the_private.key -nodes
openssl pkcs12 -export -in the.chain.pem -out keystore.p12
-inkey the_private.key -name ${THE_ALIAS} -noiter -nomaciter