Last active
May 7, 2021 15:16
-
-
Save wsargent/11062032 to your computer and use it in GitHub Desktop.
Generate a certificate authority and trust anchor keystore, using only keytool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export PW=`cat password` | |
# Create a self signed key pair root CA certificate. | |
keytool -genkeypair -v \ | |
-alias exampleca \ | |
-dname "CN=exampleCA, OU=Example Org, O=Example Company, L=San Francisco, ST=California, C=US" \ | |
-keystore exampleca.jks \ | |
-keypass:env PW \ | |
-storepass:env PW \ | |
-keyalg RSA \ | |
-keysize 4096 \ | |
-ext KeyUsage="keyCertSign" \ | |
-ext BasicConstraints:"critical=ca:true" \ | |
-validity 9999 | |
# Export the exampleCA public certificate so that it can be used in trust stores.. | |
keytool -export -v \ | |
-alias exampleca \ | |
-file exampleca.crt \ | |
-keypass:env PW \ | |
-storepass:env PW \ | |
-keystore exampleca.jks \ | |
-rfc | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My bad - nevermind - just realized the VM i was on was running java 1.6...doooop. Time for donut. Thanks!