Skip to content

Instantly share code, notes, and snippets.

@mikamboo
Last active December 9, 2021 00:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikamboo/4cdbfa6804791bd6ab81196750c8fa3f to your computer and use it in GitHub Desktop.
Save mikamboo/4cdbfa6804791bd6ab81196750c8fa3f to your computer and use it in GitHub Desktop.
Keystore Private key CSR

Create Private key stored in Keystore

If the .keystore does not exist i will be created

keytool -genkey -keystore .keystore -validity 300 \
-storepass myKeypass -keypass myKeypass -dname "CN=MyKey-Name" -alias MY-CERTKEY -storetype pkcs12

NOTE: For java version 11+, store password and key password must be equals.

Creat Certificate Siging Request from stored private key

keytool -keystore .keystore -certreq -file client-cert-sign-request \
-alias MY-CERTKEY -storepass myKeypass -keypass myKeypass

Docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment