Skip to content

Instantly share code, notes, and snippets.

@albertoaflores
Created April 21, 2017 20:44
Show Gist options
  • Save albertoaflores/9f569208152e745061b36130c44f2f57 to your computer and use it in GitHub Desktop.
Save albertoaflores/9f569208152e745061b36130c44f2f57 to your computer and use it in GitHub Desktop.
Creates a key using JDK's keytool. It's used to encrypt/decrypt values.
ALIAS_NAME="mytestkey"
KEYSTORE_SECRET="changeme"
KEYSTORE_PASSWORD="letmein"
VALIDITY_TIME=365
echo "Creating server key, valid for $VALIDITY_TIME days"
keytool -genkeypair -alias $ALIAS_NAME -keyalg RSA \
-dname "CN=Web Server,OU=Unit,O=Organization,L=City,S=State,C=US" \
-keypass $KEYSTORE_SECRET -keystore server.jks -storepass $KEYSTORE_PASSWORD \
-validity $VALIDITY_TIME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment