1 # 2 # Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 # 5 # This code is free software; you can redistribute it and/or modify it 6 # under the terms of the GNU General Public License version 2 only, as 7 # published by the Free Software Foundation. 8 # 9 # This code is distributed in the hope that it will be useful, but WITHOUT 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 # version 2 for more details (a copy is included in the LICENSE file that 13 # accompanied this code). 14 # 15 # You should have received a copy of the GNU General Public License version 16 # 2 along with this work; if not, write to the Free Software Foundation, 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 # 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 # or visit www.oracle.com if you need additional information or have any 21 # questions. 22 # 23 24 # @test 25 # @bug 4938185 7106773 26 # @summary KeyStore support for NSS cert/key databases 27 # 512 bits RSA key cannot work with SHA384 and SHA512 28 # 29 # @run shell ClientAuth.sh 30 31 # set a few environment variables so that the shell-script can run stand-alone 32 # in the source directory 33 34 if [ "${TESTSRC}" = "" ] ; then 35 TESTSRC=`pwd` 36 fi 37 if [ "${TESTCLASSES}" = "" ] ; then 38 TESTCLASSES=`pwd` 39 fi 40 if [ "${TESTJAVA}" = "" ] ; then 41 TESTJAVA="/net/radiant/export1/charlie/mustang/build/solaris-sparc" 42 fi 43 if [ "${COMPILEJAVA}" = "" ]; then 44 COMPILEJAVA="${TESTJAVA}" 45 fi 46 echo TESTSRC=${TESTSRC} 47 echo TESTCLASSES=${TESTCLASSES} 48 echo TESTJAVA=${TESTJAVA} 49 echo COMPILEJAVA=${COMPILEJAVA} 50 echo "" 51 52 OS=`uname -s` 53 case "$OS" in 54 SunOS ) 55 ARCH=`isainfo` 56 case "$ARCH" in 57 sparc* ) 58 FS="/" 59 PS=":" 60 CP="${FS}bin${FS}cp" 61 CHMOD="${FS}bin${FS}chmod" 62 ;; 63 i[3-6]86 ) 64 FS="/" 65 PS=":" 66 CP="${FS}bin${FS}cp" 67 CHMOD="${FS}bin${FS}chmod" 68 ;; 69 amd64* ) 70 FS="/" 71 PS=":" 72 CP="${FS}bin${FS}cp" 73 CHMOD="${FS}bin${FS}chmod" 74 ;; 75 * ) 76 # ?itanium? ) 77 # amd64* ) 78 echo "Unsupported System: Solaris ${ARCH}" 79 exit 0; 80 ;; 81 esac 82 ;; 83 Linux ) 84 ARCH=`uname -m` 85 case "$ARCH" in 86 i[3-6]86 ) 87 FS="/" 88 PS=":" 89 CP="${FS}bin${FS}cp" 90 CHMOD="${FS}bin${FS}chmod" 91 ;; 92 * ) 93 # ia64 ) 94 # x86_64 ) 95 echo "Unsupported System: Linux ${ARCH}" 96 exit 0; 97 ;; 98 esac 99 ;; 100 Windows* ) 101 FS="\\" 102 PS=";" 103 CP="cp" 104 CHMOD="chmod" 105 106 # 'uname -m' does not give us enough information - 107 # should rely on $PROCESSOR_IDENTIFIER (as is done in Defs-windows.gmk), 108 # but JTREG does not pass this env variable when executing a shell script. 109 # 110 # execute test program - rely on it to exit if platform unsupported 111 112 ;; 113 * ) 114 echo "Unsupported System: ${OS}" 115 exit 0; 116 ;; 117 esac 118 119 # first make cert/key DBs writable 120 121 ${CP} ${TESTSRC}${FS}ClientAuthData${FS}cert8.db ${TESTCLASSES} 122 ${CHMOD} +w ${TESTCLASSES}${FS}cert8.db 123 124 ${CP} ${TESTSRC}${FS}ClientAuthData${FS}key3.db ${TESTCLASSES} 125 ${CHMOD} +w ${TESTCLASSES}${FS}key3.db 126 127 # compile test 128 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \ 129 -classpath ${TESTSRC}${FS}..${PS}${TESTSRC}${FS}loader.jar \ 130 -d ${TESTCLASSES} \ 131 ${TESTSRC}${FS}ClientAuth.java \ 132 ${TESTSRC}${FS}..${FS}PKCS11Test.java 133 134 # run test 135 echo "Run ClientAuth ..." 136 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${TESTJAVAOPTS} \ 137 -classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \ 138 -DDIR=${TESTSRC}${FS}ClientAuthData${FS} \ 139 -DCUSTOM_DB_DIR=${TESTCLASSES} \ 140 -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ClientAuthData${FS}p11-nss.txt \ 141 -DNO_DEFAULT=true \ 142 -DNO_DEIMOS=true \ 143 -Dtest.src=${TESTSRC} \ 144 -Dtest.classes=${TESTCLASSES} \ 145 ClientAuth 146 147 # save error status 148 status=$? 149 150 # return if failed 151 if [ "${status}" != "0" ] ; then 152 exit $status 153 fi 154 155 # run test with specified TLS protocol and cipher suite 156 echo "Run ClientAuth TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA" 157 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${TESTJAVAOPTS} \ 158 -classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \ 159 -DDIR=${TESTSRC}${FS}ClientAuthData${FS} \ 160 -DCUSTOM_DB_DIR=${TESTCLASSES} \ 161 -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ClientAuthData${FS}p11-nss.txt \ 162 -DNO_DEFAULT=true \ 163 -DNO_DEIMOS=true \ 164 -Dtest.src=${TESTSRC} \ 165 -Dtest.classes=${TESTCLASSES} \ 166 ClientAuth TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA 167 168 # save error status 169 status=$? 170 171 # return 172 exit $status