test/jdk/sun/security/tools/keytool/console.sh
changeset 47216 71c04702a3d5
parent 23357 7225e28e91dd
child 59104 046e4024e55a
equal deleted inserted replaced
47215:4ebc2e2fb97c 47216:71c04702a3d5
       
     1 #
       
     2 # Copyright (c) 2006, 2014, 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 # @run shell/manual console.sh
       
    29 
       
    30 if [ "$ALT_PASS" = "" ]; then
       
    31 	PASSW=äöäöäö
       
    32 else
       
    33   	PASSW=$ALT_PASS
       
    34 fi
       
    35 
       
    36 KS=/tmp/kkk.$$
       
    37 
       
    38 cat <<____
       
    39 
       
    40 ATTENTION
       
    41 ===============================================================
       
    42 
       
    43 This test is about non-ASCII password input compatibility between
       
    44 JDK 5.0 and later versions. Before running the test, make sure that --
       
    45 
       
    46     \$J5 points to a JDK 5.0 installation
       
    47     \$JM points to the current installation
       
    48 
       
    49 The password string used in this test is $PASSW. If you find difficulty
       
    50 entering it in in your system, feel free to change it to something else
       
    51 by providing \$ALT_PASS. It should be no less than 6 characters and include
       
    52 some non-ASCII characters.
       
    53 
       
    54 For each test, type into the characters as described in the test header.
       
    55 <R> means the RETURN (or ENTER key). Please wait for a little while
       
    56 after <R> is pressed each time.
       
    57 
       
    58 \$J5 is now $J5
       
    59 \$JM is now $JM
       
    60 
       
    61 ____
       
    62 
       
    63 
       
    64 if [ "$J5" = "" -o "$JM" = "" ]; then
       
    65 	echo "Define \$J5 and \$JM first"
       
    66 	exit 1
       
    67 fi
       
    68 
       
    69 echo "Press ENTER to start the test, or Ctrl-C to stop it"
       
    70 read x
       
    71 
       
    72 echo
       
    73 echo "=========================================="
       
    74 echo "Test #1: 5->6, non-prompt. Please type <R>"
       
    75 echo "=========================================="
       
    76 echo
       
    77 rm $KS 2> /dev/null
       
    78 $J5/bin/keytool -keystore $KS -genkey -dname CN=olala -storepass $PASSW || exit 1
       
    79 $JM/bin/keytool -keystore $KS -list -storepass $PASSW || exit 2
       
    80 
       
    81 echo "=========================================="
       
    82 echo "Test #2: 6->5, non-prompt. Please type <R>"
       
    83 echo "=========================================="
       
    84 echo
       
    85 
       
    86 rm $KS 2> /dev/null
       
    87 $JM/bin/keytool -keystore $KS -genkey -dname CN=olala -storepass $PASSW || exit 3
       
    88 $J5/bin/keytool -keystore $KS -list -storepass $PASSW || exit 4
       
    89 
       
    90 echo "============================================================"
       
    91 echo "Test #3: 5->6, prompt. Please type $PASSW <R> <R> $PASSW <R>"
       
    92 echo "============================================================"
       
    93 echo
       
    94 
       
    95 rm $KS 2> /dev/null
       
    96 $J5/bin/keytool -keystore $KS -genkey -dname CN=olala || exit 5
       
    97 $JM/bin/keytool -keystore $KS -list || exit 6
       
    98 echo $PASSW| $J5/bin/keytool -keystore $KS -list || exit 7
       
    99 echo $PASSW| $JM/bin/keytool -keystore $KS -list || exit 8
       
   100 
       
   101 echo "======================================================================="
       
   102 echo "Test #4: 6->5, prompt. Please type $PASSW <R> $PASSW <R> <R> $PASSW <R>"
       
   103 echo "======================================================================="
       
   104 echo
       
   105 
       
   106 rm $KS 2> /dev/null
       
   107 $JM/bin/keytool -keystore $KS -genkey -dname CN=olala || exit 9
       
   108 $J5/bin/keytool -keystore $KS -list || exit 10
       
   109 echo $PASSW| $JM/bin/keytool -keystore $KS -list || exit 11
       
   110 echo $PASSW| $J5/bin/keytool -keystore $KS -list || exit 12
       
   111 
       
   112 echo "==========================================="
       
   113 echo "Test #5: 5->6, pipe. Please type $PASSW <R>"
       
   114 echo "==========================================="
       
   115 echo
       
   116 
       
   117 rm $KS 2> /dev/null
       
   118 echo $PASSW| $J5/bin/keytool -keystore $KS -genkey -dname CN=olala || exit 13
       
   119 $JM/bin/keytool -keystore $KS -list || exit 14
       
   120 echo $PASSW| $J5/bin/keytool -keystore $KS -list || exit 15
       
   121 echo $PASSW| $JM/bin/keytool -keystore $KS -list || exit 16
       
   122 
       
   123 rm $KS 2> /dev/null
       
   124 
       
   125 echo
       
   126 echo "Success"
       
   127 
       
   128 exit 0