annotate test/sun/security/mscapi/ShortRSAKey1024.sh @ 8470:5763085fd9be

8139436: sun.security.mscapi.KeyStore might load incomplete data Reviewed-by: vinnie, weijun
author clanger
date Fri, 18 Dec 2015 08:25:27 +0800
parents 7271cd8bc3ff
children e5c39738ce1f
rev   line source
xuelei@4791 1 #!/bin/sh
xuelei@4791 2
xuelei@4791 3 #
clanger@8470 4 # Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
xuelei@4791 5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
xuelei@4791 6 #
xuelei@4791 7 # This code is free software; you can redistribute it and/or modify it
xuelei@4791 8 # under the terms of the GNU General Public License version 2 only, as
xuelei@4791 9 # published by the Free Software Foundation.
xuelei@4791 10 #
xuelei@4791 11 # This code is distributed in the hope that it will be useful, but WITHOUT
xuelei@4791 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
xuelei@4791 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
xuelei@4791 14 # version 2 for more details (a copy is included in the LICENSE file that
xuelei@4791 15 # accompanied this code).
xuelei@4791 16 #
xuelei@4791 17 # You should have received a copy of the GNU General Public License version
xuelei@4791 18 # 2 along with this work; if not, write to the Free Software Foundation,
xuelei@4791 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
xuelei@4791 20 #
xuelei@4791 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
xuelei@4791 22 # or visit www.oracle.com if you need additional information or have any
xuelei@4791 23 # questions.
xuelei@4791 24 #
xuelei@4791 25
xuelei@4791 26
xuelei@4791 27 # @test
xuelei@4791 28 # @bug 7106773
xuelei@4791 29 # @summary 512 bits RSA key cannot work with SHA384 and SHA512
clanger@8470 30 # @requires os.family == "windows"
weijun@5680 31 # @run shell ShortRSAKey1024.sh 1024
weijun@5680 32 # @run shell ShortRSAKey1024.sh 768
weijun@5680 33 # @run shell ShortRSAKey1024.sh 512
xuelei@4791 34
xuelei@4791 35 # set a few environment variables so that the shell-script can run stand-alone
xuelei@4791 36 # in the source directory
xuelei@4791 37 if [ "${TESTSRC}" = "" ] ; then
xuelei@4791 38 TESTSRC="."
xuelei@4791 39 fi
xuelei@4791 40
xuelei@4791 41 if [ "${TESTCLASSES}" = "" ] ; then
xuelei@4791 42 TESTCLASSES="."
xuelei@4791 43 fi
xuelei@4791 44
xuelei@4791 45 if [ "${TESTJAVA}" = "" ] ; then
xuelei@4791 46 echo "TESTJAVA not set. Test cannot execute."
xuelei@4791 47 echo "FAILED!!!"
xuelei@4791 48 exit 1
xuelei@4791 49 fi
xuelei@4791 50
weijun@5680 51 BITS=$1
weijun@5680 52
xuelei@4791 53 OS=`uname -s`
xuelei@4791 54 case "$OS" in
xuelei@4791 55 Windows* | CYGWIN* )
xuelei@4791 56
weijun@5680 57 echo "Removing the keypair if it already exists (for unknown reason)..."
weijun@5680 58 ${TESTJAVA}/bin/keytool \
weijun@5680 59 -delete \
weijun@5680 60 -storetype Windows-My \
weijun@5680 61 -debug \
weijun@5680 62 -alias 7106773.$BITS
weijun@5680 63
xuelei@4791 64 echo "Creating a temporary RSA keypair in the Windows-My store..."
xuelei@4791 65 ${TESTJAVA}/bin/keytool \
xuelei@4791 66 -genkeypair \
xuelei@4791 67 -storetype Windows-My \
xuelei@4791 68 -keyalg RSA \
weijun@5680 69 -alias 7106773.$BITS \
weijun@5680 70 -keysize $BITS \
xuelei@4791 71 -dname "cn=localhost,c=US" \
weijun@5680 72 -debug \
xuelei@4791 73 -noprompt
xuelei@4791 74
weijun@5680 75 if [ "$?" -ne "0" ]; then
weijun@5680 76 echo "Unable to generate key pair in Windows-My keystore"
weijun@5680 77 exit 1
weijun@5680 78 fi
weijun@5680 79
xuelei@4791 80 echo
xuelei@4791 81 echo "Running the test..."
xuelei@4791 82 ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\ShortRSAKeyWithinTLS.java
weijun@5680 83 ${TESTJAVA}/bin/java ShortRSAKeyWithinTLS 7106773.$BITS $BITS \
xuelei@4791 84 TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA
xuelei@4791 85
xuelei@4791 86 rc=$?
xuelei@4791 87
xuelei@4791 88 echo
xuelei@4791 89 echo "Removing the temporary RSA keypair from the Windows-My store..."
xuelei@4791 90 ${TESTJAVA}/bin/keytool \
xuelei@4791 91 -delete \
xuelei@4791 92 -storetype Windows-My \
weijun@5680 93 -debug \
weijun@5680 94 -alias 7106773.$BITS
xuelei@4791 95
xuelei@4791 96 echo done.
xuelei@4791 97 exit $rc
xuelei@4791 98 ;;
xuelei@4791 99
xuelei@4791 100 * )
xuelei@4791 101 echo "This test is not intended for '$OS' - passing test"
xuelei@4791 102 exit 0
xuelei@4791 103 ;;
xuelei@4791 104 esac