blob: 46252de33c1cb48500518ee798d307086c45c3b2 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001#! /bin/sh
2
3#
4# Copyright 2006 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22# CA 95054 USA or visit www.sun.com if you need additional information or
23# have any questions.
24#
25
26# @test
27# @bug 6418647
28# @summary Doc bug 5035358 shows sun.security.util.Password.readPassword() is buggy.
29# @author Weijun Wang
30#
31# @run shell/manual console.sh
32
33if [ "$ALT_PASS" == "" ]; then
34 export PASS=äöäöäöäö
35else
36 export PASS=$ALT_PASS
37fi
38
39echo "ATTENTION"
40echo "==============================================================="
41echo
42echo "This test is about console password input compatibility between"
43echo "Tiger and Mustang. Before running the test, make sure that --"
44echo "\$J5 points to a JDK 5.0 installation"
45echo "\$JM points to a JDK 6 installation".
46echo
47echo "The password string used in this test is $PASS. If you find difficulty"
48echo "entering it in in your system, feel free to change it to something else"
49echo "by providing \$ALT_PASS (should be not less than 6 characters)"
50echo
51echo "For all prompt of \"Enter keystore password\", type $PASS and press ENTER"
52echo "For all prompt of \"Enter key password for <mykey> (RETURN if same as keystore password)\", press ENTER"
53echo "If you see both the prompts appear, say --"
54echo " Enter key password for <mykey>"
55echo " (RETURN if same as keystore password): Enter keystore password:"
56echo "only response to the last prompt by typing $PASS and press ENTER"
57echo
58echo "Only if all the command run correctly without showing any error "
59echo "or warning, this test passes."
60echo
61echo "Press ENTER to start the test, or Ctrl-C to stop it"
62read
63echo
64echo "Test #1: 5->6, non-prompt"
65rm kkk
66$J5/bin/keytool -keystore kkk -genkey -dname CN=olala -storepass $PASS
67$JM/bin/keytool -keystore kkk -list -storepass $PASS
68echo "Test #2: 6->5, non-prompt"
69rm kkk
70$JM/bin/keytool -keystore kkk -genkey -dname CN=olala -storepass $PASS
71$J5/bin/keytool -keystore kkk -list -storepass $PASS
72echo "Test #3: 5->6, prompt"
73rm kkk
74$J5/bin/keytool -keystore kkk -genkey -dname CN=olala
75$JM/bin/keytool -keystore kkk -list
76echo $PASS| $J5/bin/keytool -keystore kkk -list
77echo $PASS| $JM/bin/keytool -keystore kkk -list
78echo "Test #4: 6->5, prompt"
79rm kkk
80$JM/bin/keytool -keystore kkk -genkey -dname CN=olala
81$J5/bin/keytool -keystore kkk -list
82echo $PASS| $JM/bin/keytool -keystore kkk -list
83echo $PASS| $J5/bin/keytool -keystore kkk -list
84echo "Test #5: 5->6, pipe"
85rm kkk
86echo $PASS| $J5/bin/keytool -keystore kkk -genkey -dname CN=olala
87$JM/bin/keytool -keystore kkk -list
88echo $PASS| $J5/bin/keytool -keystore kkk -list
89echo $PASS| $JM/bin/keytool -keystore kkk -list