Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/sun/security/pkcs11/KeyStore/ClientAuth.sh
38855 views
#1# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.2# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3#4# This code is free software; you can redistribute it and/or modify it5# under the terms of the GNU General Public License version 2 only, as6# published by the Free Software Foundation.7#8# This code is distributed in the hope that it will be useful, but WITHOUT9# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11# version 2 for more details (a copy is included in the LICENSE file that12# accompanied this code).13#14# You should have received a copy of the GNU General Public License version15# 2 along with this work; if not, write to the Free Software Foundation,16# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17#18# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19# or visit www.oracle.com if you need additional information or have any20# questions.21#2223# @test24# @bug 4938185 710677325# @summary KeyStore support for NSS cert/key databases26# 512 bits RSA key cannot work with SHA384 and SHA51227#28# @run shell ClientAuth.sh2930# set a few environment variables so that the shell-script can run stand-alone31# in the source directory3233if [ "${TESTSRC}" = "" ] ; then34TESTSRC=`pwd`35fi36if [ "${TESTCLASSES}" = "" ] ; then37TESTCLASSES=`pwd`38fi39if [ "${TESTJAVA}" = "" ] ; then40TESTJAVA="/net/radiant/export1/charlie/mustang/build/solaris-sparc"41fi42if [ "${COMPILEJAVA}" = "" ]; then43COMPILEJAVA="${TESTJAVA}"44fi45echo TESTSRC=${TESTSRC}46echo TESTCLASSES=${TESTCLASSES}47echo TESTJAVA=${TESTJAVA}48echo COMPILEJAVA=${COMPILEJAVA}49echo ""5051OS=`uname -s`52case "$OS" in53SunOS )54ARCH=`isainfo`55case "$ARCH" in56sparc* )57FS="/"58PS=":"59CP="${FS}bin${FS}cp"60CHMOD="${FS}bin${FS}chmod"61;;62i[3-6]86 )63FS="/"64PS=":"65CP="${FS}bin${FS}cp"66CHMOD="${FS}bin${FS}chmod"67;;68amd64* )69FS="/"70PS=":"71CP="${FS}bin${FS}cp"72CHMOD="${FS}bin${FS}chmod"73;;74* )75# ?itanium? )76# amd64* )77echo "Unsupported System: Solaris ${ARCH}"78exit 0;79;;80esac81;;82Linux )83ARCH=`uname -m`84case "$ARCH" in85i[3-6]86 )86FS="/"87PS=":"88CP="${FS}bin${FS}cp"89CHMOD="${FS}bin${FS}chmod"90;;91* )92# ia64 )93# x86_64 )94echo "Unsupported System: Linux ${ARCH}"95exit 0;96;;97esac98;;99Windows* )100FS="\\"101PS=";"102CP="cp"103CHMOD="chmod"104105# 'uname -m' does not give us enough information -106# should rely on $PROCESSOR_IDENTIFIER (as is done in Defs-windows.gmk),107# but JTREG does not pass this env variable when executing a shell script.108#109# execute test program - rely on it to exit if platform unsupported110111;;112* )113echo "Unsupported System: ${OS}"114exit 0;115;;116esac117118# first make cert/key DBs writable119120${CP} ${TESTSRC}${FS}ClientAuthData${FS}cert8.db ${TESTCLASSES}121${CHMOD} +w ${TESTCLASSES}${FS}cert8.db122123${CP} ${TESTSRC}${FS}ClientAuthData${FS}key3.db ${TESTCLASSES}124${CHMOD} +w ${TESTCLASSES}${FS}key3.db125126# compile test127${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \128-classpath ${TESTSRC}${FS}..${PS}${TESTSRC}${FS}loader.jar \129-d ${TESTCLASSES} \130${TESTSRC}${FS}ClientAuth.java \131${TESTSRC}${FS}..${FS}PKCS11Test.java132133# run test134echo "Run ClientAuth ..."135${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \136-classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \137-DDIR=${TESTSRC}${FS}ClientAuthData${FS} \138-DCUSTOM_DB_DIR=${TESTCLASSES} \139-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ClientAuthData${FS}p11-nss.txt \140-DNO_DEFAULT=true \141-DNO_DEIMOS=true \142-Dtest.src=${TESTSRC} \143-Dtest.classes=${TESTCLASSES} \144ClientAuth145146# save error status147status=$?148149# return if failed150if [ "${status}" != "0" ] ; then151exit $status152fi153154# run test with specified TLS protocol and cipher suite155echo "Run ClientAuth TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA"156${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \157-classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \158-DDIR=${TESTSRC}${FS}ClientAuthData${FS} \159-DCUSTOM_DB_DIR=${TESTCLASSES} \160-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ClientAuthData${FS}p11-nss.txt \161-DNO_DEFAULT=true \162-DNO_DEIMOS=true \163-Dtest.src=${TESTSRC} \164-Dtest.classes=${TESTCLASSES} \165ClientAuth TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA166167# save error status168status=$?169170# return171exit $status172173174