Creating keystore BKS for https android connection

元气小坏坏 提交于 2019-12-08 03:15:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!