0N/A#
2362N/A# Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
0N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A#
0N/A# This code is free software; you can redistribute it and/or modify it
0N/A# under the terms of the GNU General Public License version 2 only, as
0N/A# published by the Free Software Foundation.
0N/A#
0N/A# This code is distributed in the hope that it will be useful, but WITHOUT
0N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A# version 2 for more details (a copy is included in the LICENSE file that
0N/A# accompanied this code).
0N/A#
0N/A# You should have received a copy of the GNU General Public License version
0N/A# 2 along with this work; if not, write to the Free Software Foundation,
0N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A#
2362N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A# or visit www.oracle.com if you need additional information or have any
2362N/A# questions.
0N/A#
0N/A
0N/A# @test
6067N/A# @bug 6418647 8005527
0N/A# @summary Doc bug 5035358 shows sun.security.util.Password.readPassword() is buggy.
0N/A# @author Weijun Wang
6067N/A# @ignore unable to test manual tools that have input from stdin,
6067N/A# and output to stderr and stdout
0N/A# @run shell/manual console.sh
0N/A
372N/Aif [ "$ALT_PASS" = "" ]; then
0N/A export PASS=äöäöäöäö
0N/Aelse
0N/A export PASS=$ALT_PASS
0N/Afi
0N/A
0N/Aecho "ATTENTION"
0N/Aecho "==============================================================="
0N/Aecho
0N/Aecho "This test is about console password input compatibility between"
0N/Aecho "Tiger and Mustang. Before running the test, make sure that --"
0N/Aecho "\$J5 points to a JDK 5.0 installation"
0N/Aecho "\$JM points to a JDK 6 installation".
0N/Aecho
0N/Aecho "The password string used in this test is $PASS. If you find difficulty"
0N/Aecho "entering it in in your system, feel free to change it to something else"
0N/Aecho "by providing \$ALT_PASS (should be not less than 6 characters)"
0N/Aecho
0N/Aecho "For all prompt of \"Enter keystore password\", type $PASS and press ENTER"
0N/Aecho "For all prompt of \"Enter key password for <mykey> (RETURN if same as keystore password)\", press ENTER"
0N/Aecho "If you see both the prompts appear, say --"
0N/Aecho " Enter key password for <mykey>"
0N/Aecho " (RETURN if same as keystore password): Enter keystore password:"
0N/Aecho "only response to the last prompt by typing $PASS and press ENTER"
372N/Aecho
0N/Aecho "Only if all the command run correctly without showing any error "
0N/Aecho "or warning, this test passes."
0N/Aecho
0N/Aecho "Press ENTER to start the test, or Ctrl-C to stop it"
0N/Aread
0N/Aecho
0N/Aecho "Test #1: 5->6, non-prompt"
0N/Arm kkk
0N/A$J5/bin/keytool -keystore kkk -genkey -dname CN=olala -storepass $PASS
0N/A$JM/bin/keytool -keystore kkk -list -storepass $PASS
0N/Aecho "Test #2: 6->5, non-prompt"
0N/Arm kkk
0N/A$JM/bin/keytool -keystore kkk -genkey -dname CN=olala -storepass $PASS
0N/A$J5/bin/keytool -keystore kkk -list -storepass $PASS
0N/Aecho "Test #3: 5->6, prompt"
0N/Arm kkk
0N/A$J5/bin/keytool -keystore kkk -genkey -dname CN=olala
0N/A$JM/bin/keytool -keystore kkk -list
0N/Aecho $PASS| $J5/bin/keytool -keystore kkk -list
0N/Aecho $PASS| $JM/bin/keytool -keystore kkk -list
0N/Aecho "Test #4: 6->5, prompt"
0N/Arm kkk
0N/A$JM/bin/keytool -keystore kkk -genkey -dname CN=olala
0N/A$J5/bin/keytool -keystore kkk -list
0N/Aecho $PASS| $JM/bin/keytool -keystore kkk -list
0N/Aecho $PASS| $J5/bin/keytool -keystore kkk -list
0N/Aecho "Test #5: 5->6, pipe"
0N/Arm kkk
0N/Aecho $PASS| $J5/bin/keytool -keystore kkk -genkey -dname CN=olala
0N/A$JM/bin/keytool -keystore kkk -list
0N/Aecho $PASS| $J5/bin/keytool -keystore kkk -list
0N/Aecho $PASS| $JM/bin/keytool -keystore kkk -list
372N/Arm kkk
372N/A
372N/Aexit 0