问题
I found tutorial which describes how create and use keystore for https connection. But I have very noob question: where should i put this code to create keystore? at the openssl command promt or in keytool key prompt.
export CLASSPATH=bcprov-jdk16-145.jar
CERTSTORE=res/raw/mystore.bks
if [ -a $CERTSTORE ]; then
rm $CERTSTORE || exit 1
fi
keytool \
-import \
-v \
-trustcacerts \
-alias 0 \
-file <(openssl x509 -in mycert.pem) \
-keystore $CERTSTORE \
-storetype BKS \
-provider org.bouncycastle.jce.provider.BouncyCastleProvider \
-providerpath /usr/share/java/bcprov.jar \
-storepass some-password
回答1:
Neither. The code you have pasted is a bash script. Typically you would name this file make-keystore.sh. Add this as a first line:
#!/bin/bash
Make sure it can execute on your linux box
chmod +x
and run it like
./make-keystore.sh
来源:https://stackoverflow.com/questions/12382342/creating-keystore-bks-for-https-android-connection