2 # this script generates a set of sample keys
5 [ -f config ] && . config
8 rm -Rf *.csr *.crt *.key *.pkcs12 testca
10 openssl genrsa -out testca.key ${KEYSIZE}
11 openssl req -new -key testca.key -out testca.csr -subj "/CN=local cacert-gigi testCA" -config selfsign.config
12 openssl x509 -req -days 365 -in testca.csr -signkey testca.key -out testca.crt
16 echo 01 > testca/serial
18 echo unique_subject = no >testca/db.attr
22 openssl genrsa -out $1.key ${KEYSIZE}
23 openssl req -new -key $1.key -out $1.csr -subj "/CN=$1.${DOMAIN}" -config selfsign.config
24 openssl ca -cert testca.crt -keyfile testca.key -in $1.csr -out $1.crt -days 356 -batch -config selfsign.config
26 openssl pkcs12 -inkey $1.key -in $1.crt -name $1 -export -passout pass:changeit -out $1.pkcs12
28 keytool -importkeystore -noprompt -srckeystore $1.pkcs12 -destkeystore ../config/keystore.pkcs12 -srcstoretype pkcs12 -deststoretype pkcs12 -srcstorepass "changeit" -deststorepass "changeit"
37 keytool -list -keystore ../config/keystore.pkcs12 -storetype pkcs12 -storepass "changeit"