0

I am trying to do a https post but there are issues with the certificate on the server I am trying to access. So going by these instructions I need to add the certificate to a keystore.

The article suggests that I need to run the following command:

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

Being new to Android Studio, I have no idea where this should be run. Can somebody please give me details instructions on how to add my certificate to a Keystore from within Android Studio?

EDIT: My platform is Windows. These seem to be commands for Unix? If so, how do I perform the same operations on Windows?

Community
  • 1
  • 1
Stack Man
  • 866
  • 11
  • 22
  • *"I have no idea where this should be run"* - that is part of a shell script. You should run it from a Terminal. What operating system are you using? – jww Aug 27 '14 at 12:21
  • Windows. So in Android Studio when I open the terminal and try to run it I get: *"'export' is not recognized as an internal or external command, operable program or batch file. The system cannot find the file specified."* – Stack Man Aug 27 '14 at 12:27
  • 1
    It's a Unix shell script. I added the "windows" tag to increase the chances that some knowledgeable Windows user will see it. – Warren Dew Aug 27 '14 at 17:19

0 Answers0