Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/sun/security/tools/keytool/console.sh
38853 views
#1# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.2# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3#4# This code is free software; you can redistribute it and/or modify it5# under the terms of the GNU General Public License version 2 only, as6# published by the Free Software Foundation.7#8# This code is distributed in the hope that it will be useful, but WITHOUT9# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11# version 2 for more details (a copy is included in the LICENSE file that12# accompanied this code).13#14# You should have received a copy of the GNU General Public License version15# 2 along with this work; if not, write to the Free Software Foundation,16# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17#18# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19# or visit www.oracle.com if you need additional information or have any20# questions.21#2223# @test24# @bug 6418647 800552725# @summary Doc bug 5035358 shows sun.security.util.Password.readPassword() is buggy.26# @author Weijun Wang27# @ignore unable to test manual tools that have input from stdin,28# and output to stderr and stdout29# @run shell/manual console.sh3031if [ "$ALT_PASS" = "" ]; then32PASSW=äöäöäö33else34PASSW=$ALT_PASS35fi3637KS=/tmp/kkk.$$3839cat <<____4041ATTENTION42===============================================================4344This test is about non-ASCII password input compatibility between45JDK 5.0 and later versions. Before running the test, make sure that --4647\$J5 points to a JDK 5.0 installation48\$JM points to the current installation4950The password string used in this test is $PASSW. If you find difficulty51entering it in in your system, feel free to change it to something else52by providing \$ALT_PASS. It should be no less than 6 characters and include53some non-ASCII characters.5455For each test, type into the characters as described in the test header.56<R> means the RETURN (or ENTER key). Please wait for a little while57after <R> is pressed each time.5859\$J5 is now $J560\$JM is now $JM6162____636465if [ "$J5" = "" -o "$JM" = "" ]; then66echo "Define \$J5 and \$JM first"67exit 168fi6970echo "Press ENTER to start the test, or Ctrl-C to stop it"71read x7273echo74echo "=========================================="75echo "Test #1: 5->6, non-prompt. Please type <R>"76echo "=========================================="77echo78rm $KS 2> /dev/null79$J5/bin/keytool -keystore $KS -genkey -dname CN=olala -storepass $PASSW || exit 180$JM/bin/keytool -keystore $KS -list -storepass $PASSW || exit 28182echo "=========================================="83echo "Test #2: 6->5, non-prompt. Please type <R>"84echo "=========================================="85echo8687rm $KS 2> /dev/null88$JM/bin/keytool -keystore $KS -genkey -dname CN=olala -storepass $PASSW || exit 389$J5/bin/keytool -keystore $KS -list -storepass $PASSW || exit 49091echo "============================================================"92echo "Test #3: 5->6, prompt. Please type $PASSW <R> <R> $PASSW <R>"93echo "============================================================"94echo9596rm $KS 2> /dev/null97$J5/bin/keytool -keystore $KS -genkey -dname CN=olala || exit 598$JM/bin/keytool -keystore $KS -list || exit 699echo $PASSW| $J5/bin/keytool -keystore $KS -list || exit 7100echo $PASSW| $JM/bin/keytool -keystore $KS -list || exit 8101102echo "======================================================================="103echo "Test #4: 6->5, prompt. Please type $PASSW <R> $PASSW <R> <R> $PASSW <R>"104echo "======================================================================="105echo106107rm $KS 2> /dev/null108$JM/bin/keytool -keystore $KS -genkey -dname CN=olala || exit 9109$J5/bin/keytool -keystore $KS -list || exit 10110echo $PASSW| $JM/bin/keytool -keystore $KS -list || exit 11111echo $PASSW| $J5/bin/keytool -keystore $KS -list || exit 12112113echo "==========================================="114echo "Test #5: 5->6, pipe. Please type $PASSW <R>"115echo "==========================================="116echo117118rm $KS 2> /dev/null119echo $PASSW| $J5/bin/keytool -keystore $KS -genkey -dname CN=olala || exit 13120$JM/bin/keytool -keystore $KS -list || exit 14121echo $PASSW| $J5/bin/keytool -keystore $KS -list || exit 15122echo $PASSW| $JM/bin/keytool -keystore $KS -list || exit 16123124rm $KS 2> /dev/null125126echo127echo "Success"128129exit 0130131132