# $Id: storesetup.sh,v 1.1 2007/07/22 23:59:18 blaine Exp $

# JMX Accelerated Howto and its sample code are copyrighted with the
# BSD license available in the Howto document.
# Copyright (c) 2004-2007, Axis Data Management Corp

# This script generates test keystores containing self-signed private keys.

Failout {
    echo "$@" 1>&2
    exit 1
}

rm -f server.store client1.store client2.store

keytool -genkey -dname "cn=application, ou=RND, o=Fake Corp., c=US"   \
      -alias server.rec -keypass pwdSstore -keystore server.store  \
      -storepass pwdSstore -validity 180 ||
Failout "Failed to generate server's keystore"

keytool -genkey -dname "cn=proto client 1, ou=RND, o=Fake Corp., c=US"   \
      -alias client1.rec -keypass pwdC1store -keystore client1.store  \
      -storepass pwdC1store -validity 180 ||
Failout "Failed to generate client #1's keystore"

keytool -genkey -dname "cn=proto client 2, ou=RND, o=Fake Corp., c=US"   \
      -alias client2.rec -keypass pwdC2store -keystore client2.store  \
      -storepass pwdC2store -validity 180 ||
Failout "Failed to generate client #2's keystore"
