Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/sun/security/mscapi/ShortRSAKey1024.sh
38841 views
#!/bin/sh12#3# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.4# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.5#6# This code is free software; you can redistribute it and/or modify it7# under the terms of the GNU General Public License version 2 only, as8# published by the Free Software Foundation.9#10# This code is distributed in the hope that it will be useful, but WITHOUT11# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13# version 2 for more details (a copy is included in the LICENSE file that14# accompanied this code).15#16# You should have received a copy of the GNU General Public License version17# 2 along with this work; if not, write to the Free Software Foundation,18# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19#20# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21# or visit www.oracle.com if you need additional information or have any22# questions.23#242526# @test27# @bug 710677328# @summary 512 bits RSA key cannot work with SHA384 and SHA51229# @requires os.family == "windows"30# @run shell ShortRSAKey1024.sh 102431# @run shell ShortRSAKey1024.sh 76832# @run shell ShortRSAKey1024.sh 5123334# set a few environment variables so that the shell-script can run stand-alone35# in the source directory36if [ "${TESTSRC}" = "" ] ; then37TESTSRC="."38fi3940if [ "${TESTCLASSES}" = "" ] ; then41TESTCLASSES="."42fi4344if [ "${TESTJAVA}" = "" ] ; then45echo "TESTJAVA not set. Test cannot execute."46echo "FAILED!!!"47exit 148fi4950OS=`uname -s`51case "$OS" in52SunOS | Linux | Darwin | CYGWIN* )53FS="/"54;;55Windows_* )56FS="\\"57;;58esac5960BITS=$16162case "$OS" in63Windows* | CYGWIN* )6465echo "Removing the keypair if it already exists (for unknown reason)..."66${TESTJAVA}${FS}bin${FS}keytool \67-delete \68-storetype Windows-My \69-debug \70-alias 7106773.$BITS7172echo "Creating a temporary RSA keypair in the Windows-My store..."73${TESTJAVA}${FS}bin${FS}keytool \74-genkeypair \75-storetype Windows-My \76-keyalg RSA \77-alias 7106773.$BITS \78-keysize $BITS \79-dname "cn=localhost,c=US" \80-debug \81-noprompt8283if [ "$?" -ne "0" ]; then84echo "Unable to generate key pair in Windows-My keystore"85exit 186fi8788echo89echo "Running the test..."90${TESTJAVA}${FS}bin${FS}javac -d . \91${TESTSRC}${FS}ShortRSAKeyWithinTLS.java92${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ShortRSAKeyWithinTLS 7106773.$BITS $BITS \93TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA9495rc=$?9697echo98echo "Removing the temporary RSA keypair from the Windows-My store..."99${TESTJAVA}${FS}bin${FS}keytool \100-delete \101-storetype Windows-My \102-debug \103-alias 7106773.$BITS104105echo "Done".106exit $rc107;;108109* )110echo "This test is not intended for '$OS' - passing test"111exit 0112;;113esac114115116