author | vinnie |
Fri, 29 Apr 2011 00:21:54 +0100 | |
changeset 9533 | 13cc5e8eb9f1 |
parent 9519 | a371830a963b |
child 24116 | 9f9b4ba34aad |
permissions | -rw-r--r-- |
2 | 1 |
#!/bin/sh |
2 |
||
3 |
# |
|
9519
a371830a963b
6931562: Support SunMSCAPI Security Provider in Windows 64-bit releases of JVM
vinnie
parents:
5506
diff
changeset
|
4 |
# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. |
2 | 5 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6 |
# |
|
7 |
# This code is free software; you can redistribute it and/or modify it |
|
8 |
# under the terms of the GNU General Public License version 2 only, as |
|
9 |
# published by the Free Software Foundation. |
|
10 |
# |
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
# accompanied this code). |
|
16 |
# |
|
17 |
# You should have received a copy of the GNU General Public License version |
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
# |
|
5506 | 21 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
# or visit www.oracle.com if you need additional information or have any |
|
23 |
# questions. |
|
2 | 24 |
# |
25 |
||
26 |
||
27 |
# @test |
|
9519
a371830a963b
6931562: Support SunMSCAPI Security Provider in Windows 64-bit releases of JVM
vinnie
parents:
5506
diff
changeset
|
28 |
# @bug 6415696 6931562 |
2 | 29 |
# @run shell KeytoolChangeAlias.sh |
30 |
# @summary Test "keytool -changealias" using the Microsoft CryptoAPI provider. |
|
31 |
||
32 |
# set a few environment variables so that the shell-script can run stand-alone |
|
33 |
# in the source directory |
|
34 |
if [ "${TESTSRC}" = "" ] ; then |
|
35 |
TESTSRC="." |
|
36 |
fi |
|
37 |
||
38 |
if [ "${TESTCLASSES}" = "" ] ; then |
|
39 |
TESTCLASSES="." |
|
40 |
fi |
|
41 |
||
42 |
if [ "${TESTJAVA}" = "" ] ; then |
|
43 |
echo "TESTJAVA not set. Test cannot execute." |
|
44 |
echo "FAILED!!!" |
|
45 |
exit 1 |
|
46 |
fi |
|
47 |
||
48 |
OS=`uname -s` |
|
49 |
case "$OS" in |
|
50 |
Windows* | CYGWIN* ) |
|
51 |
||
52 |
# 'uname -m' does not give us enough information - |
|
53 |
# should rely on $PROCESSOR_IDENTIFIER (as is done in Defs-windows.gmk), |
|
54 |
# but JTREG does not pass this env variable when executing a shell script. |
|
55 |
# |
|
56 |
# execute test program - rely on it to exit if platform unsupported |
|
57 |
||
58 |
echo "Creating the alias '246810' in the Windows-My store..." |
|
59 |
${TESTJAVA}/bin/keytool \ |
|
60 |
-import \ |
|
61 |
-storetype Windows-My \ |
|
62 |
-file ${TESTSRC}/246810.cer \ |
|
63 |
-alias 246810 \ |
|
64 |
-noprompt |
|
65 |
||
66 |
if [ $? -ne 0 ] ; then |
|
67 |
exit $? |
|
68 |
fi |
|
69 |
||
70 |
echo "Removing the alias '13579', if it is already present..." |
|
71 |
${TESTJAVA}/bin/keytool \ |
|
72 |
-list \ |
|
73 |
-storetype Windows-My \ |
|
74 |
-alias 13579 > /dev/null 2>&1 |
|
75 |
||
76 |
if [ $? ] ; then |
|
77 |
${TESTJAVA}/bin/keytool \ |
|
78 |
-delete \ |
|
79 |
-storetype Windows-My \ |
|
80 |
-alias 13579 \ |
|
81 |
-noprompt |
|
82 |
fi |
|
83 |
||
84 |
echo "Counting the entries in the store..." |
|
85 |
count=`${TESTJAVA}/bin/keytool -list -storetype Windows-My | wc -l` |
|
86 |
before=$count |
|
87 |
||
88 |
echo "Changing the alias name from '246810' to '13579'..." |
|
89 |
||
90 |
${TESTJAVA}/bin/keytool \ |
|
91 |
-changealias \ |
|
92 |
-storetype Windows-My \ |
|
93 |
-alias 246810 \ |
|
94 |
-destalias 13579 |
|
95 |
||
96 |
if [ $? -ne 0 ] ; then |
|
97 |
exit $? |
|
98 |
fi |
|
99 |
||
100 |
echo "Re-counting the entries in the store..." |
|
101 |
count=`${TESTJAVA}/bin/keytool -list -storetype Windows-My | wc -l` |
|
102 |
after=$count |
|
103 |
||
104 |
if [ ! $before = $after ]; then |
|
105 |
echo "error: unexpected number of entries in the Windows-MY store" |
|
106 |
exit 101 |
|
107 |
fi |
|
108 |
||
109 |
echo "Confirming that the new alias is present..." |
|
110 |
${TESTJAVA}/bin/keytool \ |
|
111 |
-list \ |
|
112 |
-storetype Windows-My \ |
|
113 |
-alias 13579 > /dev/null 2>&1 |
|
114 |
||
115 |
if [ $? -ne 0 ] ; then |
|
116 |
echo "error: cannot find the new alias name in the Windows-MY store" |
|
117 |
exit 102 |
|
118 |
fi |
|
119 |
||
120 |
echo "Removing the new alias '13579'..." |
|
121 |
${TESTJAVA}/bin/keytool \ |
|
122 |
-delete \ |
|
123 |
-storetype Windows-My \ |
|
124 |
-alias 13579 > /dev/null 2>&1 |
|
125 |
||
126 |
echo done. |
|
127 |
exit 0 |
|
128 |
;; |
|
129 |
||
130 |
* ) |
|
131 |
echo "This test is not intended for '$OS' - passing test" |
|
132 |
exit 0 |
|
133 |
;; |
|
134 |
esac |
|
135 |
||
136 |
||
137 |