-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathgenerateBCSAPIkeys
More file actions
executable file
·49 lines (39 loc) · 2.79 KB
/
Copy pathgenerateBCSAPIkeys
File metadata and controls
executable file
·49 lines (39 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
if [ -f BCSAPIPASSWORD ]
then
BCSAPIPASSWORD=`cat BCSAPIPASSWORD`
else
echo -n "BCSAPIPASSWORD: "
read BCSAPIPASSWORD
echo $BCSAPIPASSWORD >BCSAPIPASSWORD
fi
echo generating server key...
rm -f bcsapi_server.keystore bcsapi_client.keystore jms_server.keystore
echo generating key...
keytool -genkey -validity 3650 -alias bitsofproofServer -dname "cn=bitsofproof supernode server, ou=IT, o=bitsofproof, c=NET" -keystore bcsapi_server.keystore -keypass $BCSAPIPASSWORD -storepass $BCSAPIPASSWORD
echo extracting certificate...
keytool -exportcert -alias bitsofproofServer -keystore bcsapi_server.keystore -rfc -file server.cert -keypass $BCSAPIPASSWORD -storepass $BCSAPIPASSWORD
echo
echo generatng client key...
keytool -genkey -validity 3650 -alias bitsofproofClient -dname "cn=bitsofproof supernode client, ou=IT, o=bitsofproof, c=NET" -keystore bcsapi_client.keystore -keypass $BCSAPIPASSWORD -storepass $BCSAPIPASSWORD
echo extracting certificate...
keytool -exportcert -alias bitsofproofClient -keystore bcsapi_client.keystore -rfc -file client.cert -keypass $BCSAPIPASSWORD -storepass $BCSAPIPASSWORD
echo
echo generatng JMS server key...
keytool -genkey -validity 3650 -alias bitsofproofJMSServer -dname "cn=bitsofproof supernode JMS server, ou=IT, o=bitsofproof, c=NET" -keystore jms_server.keystore -keypass $BCSAPIPASSWORD -storepass $BCSAPIPASSWORD
echo extracting certificate...
keytool -exportcert -alias bitsofproofJMSServer -keystore jms_server.keystore -rfc -file jmsserver.cert -keypass $BCSAPIPASSWORD -storepass $BCSAPIPASSWORD
echo
echo add client and server certs to JMS server key store ...
keytool -importcert -noprompt -trustcacerts -alias bitsofproofServer -file server.cert -keystore jms_server.keystore -keypass $BCSAPIPASSWORD -storepass $BCSAPIPASSWORD
keytool -importcert -noprompt -trustcacerts -alias bitsofproofClient -file client.cert -keystore jms_server.keystore -keypass $BCSAPIPASSWORD -storepass $BCSAPIPASSWORD
echo
echo add server cert to bcsapi_client.keystore...
keytool -importcert -noprompt -trustcacerts -alias bitsofproofServer -file server.cert -keystore bcsapi_client.keystore -keypass $BCSAPIPASSWORD -storepass $BCSAPIPASSWORD
keytool -importcert -noprompt -trustcacerts -alias bitsofproofJMSServer -file jmsserver.cert -keystore bcsapi_client.keystore -keypass $BCSAPIPASSWORD -storepass $BCSAPIPASSWORD
echo add client cert to bcsapi_server.keystore...
keytool -importcert -noprompt -trustcacerts -alias bitsofproofClient -file client.cert -keystore bcsapi_server.keystore -keypass $BCSAPIPASSWORD -storepass $BCSAPIPASSWORD
keytool -importcert -noprompt -trustcacerts -alias bitsofproofJMSServer -file jmsserver.cert -keystore bcsapi_server.keystore -keypass $BCSAPIPASSWORD -storepass $BCSAPIPASSWORD
echo
rm -f server.cert client.cert jmsserver.cert
echo done.