Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/sun/security/tools/jarsigner/jvindex.sh
38854 views
#1# Copyright (c) 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 802276125# @summary regression: SecurityException is NOT thrown while trying to pack a wrongly signed Indexed Jar file26#2728if [ "${TESTJAVA}" = "" ] ; then29JAVAC_CMD=`which javac`30TESTJAVA=`dirname $JAVAC_CMD`/..31fi3233# set platform-dependent variables34OS=`uname -s`35case "$OS" in36Windows_* )37FS="\\"38;;39* )40FS="/"41;;42esac4344F=abcde45KS=jvindex.jks46JFILE=jvindex.jar4748KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit \49-keystore $KS -keyalg rsa"50JAR=$TESTJAVA${FS}bin${FS}jar51JARSIGNER="$TESTJAVA${FS}bin${FS}jarsigner -keystore $KS -storepass changeit"5253rm $F $KS $JFILE 2> /dev/null5455echo 12345 > $F56$JAR cvf $JFILE $F5758ERR=""5960$KT -alias a -dname CN=a -genkey -validity 300 || ERR="$ERR 1"6162$JARSIGNER $JFILE a || ERR="$ERR 2"63$JAR i $JFILE6465# Make sure the $F line has "sm" (signed and in manifest)66$JARSIGNER -verify -verbose $JFILE | grep $F | grep sm || ERR="$ERR 3"6768if [ "$ERR" = "" ]; then69exit 070else71echo "ERR is $ERR"72exit 173fi7475767778