Skip to content

Commit

Permalink
#54 Generate and export key pair without password prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
vityaman committed Nov 26, 2024
1 parent d21d4f6 commit bcd21fb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions backend/config/crypto/keys.bash
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function remove() {
}

function generate() {
echo "Generation key pair..."
keytool \
-genkeypair \
-alias "$ALIAS" \
Expand All @@ -31,8 +32,13 @@ function generate() {
-storeType PKCS12 \
-storepass "$PASSWORD"

openssl pkcs12 -in "$KEYSTORE" -nocerts -out "$ALIAS-private.pem"
openssl pkcs12 -in "$KEYSTORE" -nokeys -out "$ALIAS-public.pem"
echo "Exporting a private key..."
openssl pkcs12 -in "$KEYSTORE" -nocerts -out "$ALIAS-private.pem" \
-passin pass:"$PASSWORD" -passout pass:"$PASSWORD"

echo "Exporting a public key..."
openssl pkcs12 -in "$KEYSTORE" -nokeys -out "$ALIAS-public.pem" \
-passin pass:"$PASSWORD" -passout pass:"$PASSWORD"

copy "$KEYSTORE"
copy "$ALIAS-private.pem"
Expand Down

0 comments on commit bcd21fb

Please sign in to comment.