Skip to content

Commit

Permalink
gen-keystore.sh: Don't pass the passwords as args
Browse files Browse the repository at this point in the history
Also mention that the password is saved in clear text.

Change-Id: Ia7bf8b1b85193aa76b541dc5c6ee99a471d12f92
  • Loading branch information
Gabriele M committed Apr 10, 2018
1 parent d5f4c1b commit 6c0aa81
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions gen-keystore.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
#!/bin/sh
#!/bin/bash

if [ $# -ne 6 ]; then
if [ $# -ne 4 ]; then
echo "Usage: `basename $0` PRIVATE_KEY CERTIFICATE \\"
echo " KEYSTORE_PASSWRD KEY_PASSWORD KEY_ALIAS \\"
echo " OUTPUT_KEYSTORE_PATH"
echo " KEY_ALIAS OUTPUT_KEYSTORE_PATH"
echo
echo "Example:"
echo " `basename $0` \\"
echo " ../../../build/target/product/security/testkey.pk8 \\"
echo " ../../../build/target/product/security/testkey.x509.pem \\"
echo " keystore-password key-password android testkey.jks"
echo " android testkey.jks"
exit 0
fi

PRIVATE_KEY="$1"
CERTIFICATE="$2"
KEYSTORE_PASSWORD="$3"
KEY_PASSWORD="$4"
KEY_ALIAS="$5"
KEYSTORE_PATH="$6"
KEY_ALIAS="$3"
KEYSTORE_PATH="$4"

if [ -f "$KEYSTORE_PATH" ]; then
echo "$KEYSTORE_PATH already exists"
exit 1
fi

echo "The passwords will be stored in clear text"
read -p "Enter new keystore password: " -s KEYSTORE_PASSWORD
echo
read -p "Enter new key password: " -s KEY_PASSWORD
echo

tmpdir=`mktemp -d`
trap 'rm -rf $tmpdir;' 0

Expand Down

0 comments on commit 6c0aa81

Please sign in to comment.