-
-
Save aelkz/d290a4a79714f0f4a822c390fd9fbbd9 to your computer and use it in GitHub Desktop.
Generate a certificate authority and trust anchor keystore, using only keytool
This file contains hidden or 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