Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/sun/security/mscapi/nonUniqueAliases/NonUniqueAliases.sh
38855 views
1
#!/bin/sh
2
3
#
4
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
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
#
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.
24
#
25
26
27
# @test
28
# @ignore Uses certutil.exe that isn't guaranteed to be installed
29
# @bug 6483657
30
# @requires os.family == "windows"
31
# @run shell NonUniqueAliases.sh
32
# @summary Test "keytool -list" displays correcly same named certificates
33
34
# set a few environment variables so that the shell-script can run stand-alone
35
# in the source directory
36
if [ "${TESTSRC}" = "" ] ; then
37
TESTSRC="."
38
fi
39
40
if [ "${TESTCLASSES}" = "" ] ; then
41
TESTCLASSES="."
42
fi
43
44
if [ "${TESTJAVA}" = "" ] ; then
45
echo "TESTJAVA not set. Test cannot execute."
46
echo "FAILED!!!"
47
exit 1
48
fi
49
50
OS=`uname -s`
51
case "$OS" in
52
Windows* | CYGWIN* )
53
54
# 'uname -m' does not give us enough information -
55
# should rely on $PROCESSOR_IDENTIFIER (as is done in Defs-windows.gmk),
56
# but JTREG does not pass this env variable when executing a shell script.
57
#
58
# execute test program - rely on it to exit if platform unsupported
59
60
echo "removing the alias NonUniqueName if it already exists"
61
certutil -user -delstore MY NonUniqueName
62
63
echo "Importing 1st certificate into MY keystore using certutil tool"
64
certutil -user -addstore MY ${TESTSRC}/nonUniq1.pem
65
66
echo "Importing 2nd certificate into MY keystore using certutil tool"
67
certutil -user -addstore MY ${TESTSRC}/nonUniq2.pem
68
69
echo "Listing certificates with keytool"
70
${TESTJAVA}/bin/keytool ${TESTTOOLVMOPTS} -list -storetype Windows-My
71
72
echo "Counting expected entries"
73
count0=`${TESTJAVA}/bin/keytool ${TESTTOOLVMOPTS} -list -storetype Windows-My | grep 'NonUniqueName,' | wc -l`
74
75
if [ ! $count0 = 1 ]; then
76
echo "error: unexpected number of entries ($count0) in the Windows-MY store"
77
certutil -user -delstore MY NonUniqueName
78
exit 115
79
fi
80
81
echo "Counting expected entries"
82
count1=`${TESTJAVA}/bin/keytool ${TESTTOOLVMOPTS} -list -storetype Windows-My | grep 'NonUniqueName (1),' | wc -l`
83
84
if [ ! $count1 = 1 ]; then
85
echo "error: unexpected number of entries ($count1) in the Windows-MY store"
86
certutil -user -delstore MY NonUniqueName
87
exit 116
88
fi
89
90
echo "Cleaning up"
91
certutil -user -delstore MY NonUniqueName
92
93
exit 0
94
;;
95
96
* )
97
echo "This test is not intended for '$OS' - passing test"
98
exit 0
99
;;
100
esac
101
102