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/tools/keytool/console.sh
38853 views
1
#
2
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
#
5
# This code is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 2 only, as
7
# published by the Free Software Foundation.
8
#
9
# This code is distributed in the hope that it will be useful, but WITHOUT
10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
# version 2 for more details (a copy is included in the LICENSE file that
13
# accompanied this code).
14
#
15
# You should have received a copy of the GNU General Public License version
16
# 2 along with this work; if not, write to the Free Software Foundation,
17
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
#
19
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
# or visit www.oracle.com if you need additional information or have any
21
# questions.
22
#
23
24
# @test
25
# @bug 6418647 8005527
26
# @summary Doc bug 5035358 shows sun.security.util.Password.readPassword() is buggy.
27
# @author Weijun Wang
28
# @ignore unable to test manual tools that have input from stdin,
29
# and output to stderr and stdout
30
# @run shell/manual console.sh
31
32
if [ "$ALT_PASS" = "" ]; then
33
PASSW=äöäöäö
34
else
35
PASSW=$ALT_PASS
36
fi
37
38
KS=/tmp/kkk.$$
39
40
cat <<____
41
42
ATTENTION
43
===============================================================
44
45
This test is about non-ASCII password input compatibility between
46
JDK 5.0 and later versions. Before running the test, make sure that --
47
48
\$J5 points to a JDK 5.0 installation
49
\$JM points to the current installation
50
51
The password string used in this test is $PASSW. If you find difficulty
52
entering it in in your system, feel free to change it to something else
53
by providing \$ALT_PASS. It should be no less than 6 characters and include
54
some non-ASCII characters.
55
56
For each test, type into the characters as described in the test header.
57
<R> means the RETURN (or ENTER key). Please wait for a little while
58
after <R> is pressed each time.
59
60
\$J5 is now $J5
61
\$JM is now $JM
62
63
____
64
65
66
if [ "$J5" = "" -o "$JM" = "" ]; then
67
echo "Define \$J5 and \$JM first"
68
exit 1
69
fi
70
71
echo "Press ENTER to start the test, or Ctrl-C to stop it"
72
read x
73
74
echo
75
echo "=========================================="
76
echo "Test #1: 5->6, non-prompt. Please type <R>"
77
echo "=========================================="
78
echo
79
rm $KS 2> /dev/null
80
$J5/bin/keytool -keystore $KS -genkey -dname CN=olala -storepass $PASSW || exit 1
81
$JM/bin/keytool -keystore $KS -list -storepass $PASSW || exit 2
82
83
echo "=========================================="
84
echo "Test #2: 6->5, non-prompt. Please type <R>"
85
echo "=========================================="
86
echo
87
88
rm $KS 2> /dev/null
89
$JM/bin/keytool -keystore $KS -genkey -dname CN=olala -storepass $PASSW || exit 3
90
$J5/bin/keytool -keystore $KS -list -storepass $PASSW || exit 4
91
92
echo "============================================================"
93
echo "Test #3: 5->6, prompt. Please type $PASSW <R> <R> $PASSW <R>"
94
echo "============================================================"
95
echo
96
97
rm $KS 2> /dev/null
98
$J5/bin/keytool -keystore $KS -genkey -dname CN=olala || exit 5
99
$JM/bin/keytool -keystore $KS -list || exit 6
100
echo $PASSW| $J5/bin/keytool -keystore $KS -list || exit 7
101
echo $PASSW| $JM/bin/keytool -keystore $KS -list || exit 8
102
103
echo "======================================================================="
104
echo "Test #4: 6->5, prompt. Please type $PASSW <R> $PASSW <R> <R> $PASSW <R>"
105
echo "======================================================================="
106
echo
107
108
rm $KS 2> /dev/null
109
$JM/bin/keytool -keystore $KS -genkey -dname CN=olala || exit 9
110
$J5/bin/keytool -keystore $KS -list || exit 10
111
echo $PASSW| $JM/bin/keytool -keystore $KS -list || exit 11
112
echo $PASSW| $J5/bin/keytool -keystore $KS -list || exit 12
113
114
echo "==========================================="
115
echo "Test #5: 5->6, pipe. Please type $PASSW <R>"
116
echo "==========================================="
117
echo
118
119
rm $KS 2> /dev/null
120
echo $PASSW| $J5/bin/keytool -keystore $KS -genkey -dname CN=olala || exit 13
121
$JM/bin/keytool -keystore $KS -list || exit 14
122
echo $PASSW| $J5/bin/keytool -keystore $KS -list || exit 15
123
echo $PASSW| $JM/bin/keytool -keystore $KS -list || exit 16
124
125
rm $KS 2> /dev/null
126
127
echo
128
echo "Success"
129
130
exit 0
131
132