forked from bmc08gt/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake-keystore
More file actions
executable file
·42 lines (34 loc) · 897 Bytes
/
Copy pathmake-keystore
File metadata and controls
executable file
·42 lines (34 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
PK8=$1
X509PEM=$2
ALIAS=$3
STORENAME=$4
PWREQ=$5
CRYPT=
if [ -z "$PK8" ]; then
echo "Please provide the following:"
echo " .pk8,"
echo " .x509.pem,"
echo " desired alias,"
echo " desired keystore name,"
echo " and if pw should be required (optional)"
exit 1
fi
if [ ! -z "$PWREQ" ]; then
CRYPT="-nocrypt"
fi
openssl pkcs8 -inform DER $CRYPT -in $PK8 -out key.pem
if [ ! -z $CRYPT ]; then
STOREPASS=android
else
echo "Enter keystore pass:"
read STOREPASS
fi
openssl pkcs12 -export -in $X509PEM -inkey key.pem -out platform.p12 -password pass:$STOREPASS -name $ALIAS
if [ ! -z $CRPYT ]; then
KEYPASS=password
else
echo "Enter key pass:"
read KEYPASS
fi
keytool -importkeystore -deststorepass $KEYPASS -destkeystore $STORENAME -srckeystore platform.p12 -srcstoretype PKCS12 -srcstorepass $STOREPASS