jdk/test/sun/security/mscapi/SignUsingSHA2withRSA.sh
author darcy
Wed, 29 Apr 2015 08:37:57 -0700
changeset 30045 719de2e9d356
parent 14786 a9f61e0cbe61
child 33868 9c1bde39fe18
permissions -rw-r--r--
8078880: Mark a few more intermittently failuring security-libs Reviewed-by: xuelei
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9524
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
     1
#!/bin/sh
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
     2
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
     3
#
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
     4
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
     5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
     6
#
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
     7
# This code is free software; you can redistribute it and/or modify it
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
     8
# under the terms of the GNU General Public License version 2 only, as
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
     9
# published by the Free Software Foundation.
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    10
#
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    15
# accompanied this code).
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    16
#
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    20
#
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    23
# questions.
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    24
#
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    25
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    26
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    27
# @test
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    28
# @bug 6753664
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    29
# @run shell SignUsingSHA2withRSA.sh
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    30
# @summary Support SHA256 (and higher) in SunMSCAPI
30045
719de2e9d356 8078880: Mark a few more intermittently failuring security-libs
darcy
parents: 14786
diff changeset
    31
# @key intermittent
9524
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    32
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    33
# set a few environment variables so that the shell-script can run stand-alone
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    34
# in the source directory
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    35
if [ "${TESTSRC}" = "" ] ; then
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    36
   TESTSRC="."
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    37
fi
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    38
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    39
if [ "${TESTCLASSES}" = "" ] ; then
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    40
   TESTCLASSES="."
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    41
fi
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    42
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    43
if [ "${TESTJAVA}" = "" ] ; then
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    44
   echo "TESTJAVA not set.  Test cannot execute."
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    45
   echo "FAILED!!!"
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    46
   exit 1
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    47
fi
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    48
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    49
OS=`uname -s`
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    50
case "$OS" in
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    51
    Windows* | CYGWIN* )
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    52
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    53
        echo "Creating a temporary RSA keypair in the Windows-My store..."
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    54
        ${TESTJAVA}/bin/keytool \
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    55
	    -genkeypair \
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    56
	    -storetype Windows-My \
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    57
	    -keyalg RSA \
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    58
	    -alias 6753664 \
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    59
	    -dname "cn=6753664,c=US" \
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    60
	    -noprompt
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    61
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    62
        echo
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    63
	echo "Running the test..."
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    64
        ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\SignUsingSHA2withRSA.java
14786
a9f61e0cbe61 8003890: corelibs test scripts should pass TESTVMOPTS
chegar
parents: 9524
diff changeset
    65
        ${TESTJAVA}/bin/java ${TESTVMOPTS} SignUsingSHA2withRSA
9524
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    66
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    67
        rc=$?
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    68
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    69
        echo
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    70
        echo "Removing the temporary RSA keypair from the Windows-My store..."
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    71
        ${TESTJAVA}/bin/keytool \
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    72
	    -delete \
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    73
	    -storetype Windows-My \
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    74
	    -alias 6753664
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    75
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    76
	echo done.
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    77
        exit $rc
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    78
        ;;
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    79
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    80
    * )
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    81
        echo "This test is not intended for '$OS' - passing test"
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    82
        exit 0
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    83
        ;;
8417d0e74ac5 6753664: Support SHA256 (and higher) in SunMSCAPI
vinnie
parents:
diff changeset
    84
esac