• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# This script was tested to work with bouncycastle 1.32.
3
4set -x
5set -e
6
7CERTSTORE=cacerts.bks
8
9if [ -a $CERTSTORE ]; then
10    rm $CERTSTORE || exit 1
11fi
12
13if [ -z "$STOREPASS" ]; then
14    STOREPASS=changeit
15fi
16
17COUNTER=0
18for cert in `ls -1 cacerts`
19  do
20  yes | keytool \
21      -import \
22      -v \
23      -trustcacerts \
24      -alias $COUNTER \
25      -file <(openssl x509 -in cacerts/$cert) \
26      -keystore $CERTSTORE \
27      -storetype BKS \
28      -provider org.bouncycastle.jce.provider.BouncyCastleProvider \
29      -providerpath /usr/share/java/bcprov.jar \
30      -storepass $STOREPASS
31  let "COUNTER=$COUNTER + 1"
32done
33