jdk/test/sun/security/mscapi/PublicKeyInterop.sh
author mchung
Wed, 10 Aug 2016 15:51:25 -0700
changeset 40261 86a49ba76f52
parent 36511 9d0388c6b336
child 45028 b0ea3c0bfb81
permissions -rw-r--r--
8136930: Simplify use of module-system options by custom launchers Reviewed-by: alanb, ksrini, henryjen, sundar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9505
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
     1
#!/bin/sh
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
     2
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
     3
#
33868
9c1bde39fe18 8139436: sun.security.mscapi.KeyStore might load incomplete data
clanger
parents: 24116
diff changeset
     4
# Copyright (c) 2011, 2015 Oracle and/or its affiliates. All rights reserved.
9505
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
     5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
     6
#
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
     7
# This code is free software; you can redistribute it and/or modify it
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
     8
# under the terms of the GNU General Public License version 2 only, as
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
     9
# published by the Free Software Foundation.
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    10
#
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    15
# accompanied this code).
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    16
#
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    20
#
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    23
# questions.
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    24
#
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    25
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    26
# @test
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    27
# @bug 6888925
33868
9c1bde39fe18 8139436: sun.security.mscapi.KeyStore might load incomplete data
clanger
parents: 24116
diff changeset
    28
# @requires os.family == "windows"
9505
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    29
# @run shell PublicKeyInterop.sh
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    30
# @summary SunMSCAPI's Cipher can't use RSA public keys obtained from other
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    31
#          sources.
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    32
#
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    33
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    34
# set a few environment variables so that the shell-script can run stand-alone
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    35
# in the source directory
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    36
if [ "${TESTSRC}" = "" ] ; then
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    37
   TESTSRC="."
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    38
fi
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    39
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    40
if [ "${TESTCLASSES}" = "" ] ; then
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    41
   TESTCLASSES="."
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    42
fi
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    43
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    44
if [ "${TESTJAVA}" = "" ] ; then
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    45
   echo "TESTJAVA not set.  Test cannot execute."
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    46
   echo "FAILED!!!"
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    47
   exit 1
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    48
fi
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    49
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    50
OS=`uname -s`
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    51
case "$OS" in
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    52
    Windows* | CYGWIN* )
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    53
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    54
        echo "Creating a temporary RSA keypair in the Windows-My store..."
24116
9f9b4ba34aad 8040321: keytool and jarsigner tests doesn't pass though VM tools to tools
weijun
parents: 14786
diff changeset
    55
        ${TESTJAVA}/bin/keytool ${TESTTOOLVMOPTS} \
9505
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    56
	    -genkeypair \
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    57
	    -storetype Windows-My \
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    58
	    -keyalg RSA \
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    59
	    -alias 6888925 \
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    60
	    -dname "cn=6888925,c=US" \
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    61
	    -noprompt
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    62
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    63
        echo
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 34687
diff changeset
    64
        echo "Running the test..."
40261
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 36511
diff changeset
    65
        ${TESTJAVA}/bin/javac --add-exports java.base/sun.security.util=ALL-UNNAMED \
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 34687
diff changeset
    66
            ${TESTTOOLVMOPTS} ${TESTJAVACOPTS} -d . ${TESTSRC}\\PublicKeyInterop.java
40261
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 36511
diff changeset
    67
        ${TESTJAVA}/bin/java --add-exports java.base/sun.security.util=ALL-UNNAMED \
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 34687
diff changeset
    68
            ${TESTVMOPTS} PublicKeyInterop
9505
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    69
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    70
        rc=$?
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    71
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    72
        echo
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    73
        echo "Removing the temporary RSA keypair from the Windows-My store..."
24116
9f9b4ba34aad 8040321: keytool and jarsigner tests doesn't pass though VM tools to tools
weijun
parents: 14786
diff changeset
    74
        ${TESTJAVA}/bin/keytool ${TESTTOOLVMOPTS} \
9505
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    75
	    -delete \
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    76
	    -storetype Windows-My \
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    77
	    -alias 6888925
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    78
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    79
	echo done.
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    80
        exit $rc
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    81
        ;;
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    82
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    83
    * )
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    84
        echo "This test is not intended for '$OS' - passing test"
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    85
        exit 0
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    86
        ;;
3bbc6ff8a905 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
diff changeset
    87
esac