-
Notifications
You must be signed in to change notification settings - Fork 5
/
gskcmd
executable file
·41 lines (33 loc) · 1.32 KB
/
gskcmd
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
#!/bin/sh
# z/os ikeycmd wrapper that "reliably" adds CMS v3 support.
# Author: [email protected]
if [ -n "$JAVA_HOME" ]; then
echo "Using JAVA_HOME=$JAVA_HOME"
else
JAVA_HOME=/usr/lpp/java/java800/J8.0_64/
fi
# Should not require edits below this line
> /tmp/java.security.append
# Check for non-v3 CMS provider in java.security.
if grep CMSProvider $JAVA_HOME/lib/security/java.security >/dev/null; then
if ! grep -i "CMSProvider V3" $JAVA_HOME/lib/security/java.security; then
echo "CMS Provider already present, but no 'V3' argument: $JAVA_HOME/lib/security/java.security"
exit 1
fi
else
# Need to add CMSv3 provider.
# Hunt for the next provider offset
let NEXT_PROVIDER=1
for PROVIDER in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
if grep security.provider.$PROVIDER $JAVA_HOME/lib/security/java.security >/dev/null; then
let NEXT_PROVIDER=$NEXT_PROVIDER+1
fi
done
# Stash the provider line in a file
echo "security.provider.$NEXT_PROVIDER=com.ibm.security.cmskeystore.CMSProvider V3" > /tmp/java.security.append
fi
if [ $# -eq 0 ]; then
$JAVA_HOME/bin/ikeycmd -DADD_CMS_SERVICE_PROVIDER_ENABLED=true -Djava.security.properties=/tmp/java.security.append -help
else
$JAVA_HOME/bin/ikeycmd -DADD_CMS_SERVICE_PROVIDER_ENABLED=true -Djava.security.properties=/tmp/java.security.append "$@"
fi