1

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
Rikki Tikki Tavi
  • 3,089
  • 5
  • 43
  • 81

1 Answers1

2

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
snow6oy
  • 678
  • 1
  • 7
  • 16