annotate test/sun/security/mscapi/ShortRSAKey1024.sh @ 11259:44a6aa58f7b2

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