annotate jdk/test/sun/security/tools/jarsigner/onlymanifest.sh @ 24116:9f9b4ba34aad

8040321: keytool and jarsigner tests doesn't pass though VM tools to tools Reviewed-by: alanb
author weijun
date Fri, 25 Apr 2014 10:57:09 +0800
parents 6dadb192ad81
children 5d11306d6969
rev   line source
weijun@7524 1 #
lana@23010 2 # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
weijun@7524 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
weijun@7524 4 #
weijun@7524 5 # This code is free software; you can redistribute it and/or modify it
weijun@7524 6 # under the terms of the GNU General Public License version 2 only, as
weijun@7524 7 # published by the Free Software Foundation.
weijun@7524 8 #
weijun@7524 9 # This code is distributed in the hope that it will be useful, but WITHOUT
weijun@7524 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
weijun@7524 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
weijun@7524 12 # version 2 for more details (a copy is included in the LICENSE file that
weijun@7524 13 # accompanied this code).
weijun@7524 14 #
weijun@7524 15 # You should have received a copy of the GNU General Public License version
weijun@7524 16 # 2 along with this work; if not, write to the Free Software Foundation,
weijun@7524 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
weijun@7524 18 #
weijun@7524 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
weijun@7524 20 # or visit www.oracle.com if you need additional information or have any
weijun@7524 21 # questions.
weijun@7524 22 #
weijun@7524 23
weijun@7524 24 # @test
weijun@7524 25 # @bug 7004035
weijun@7524 26 # @summary signed jar with only META-INF/* inside is not verifiable
weijun@7524 27 #
weijun@7524 28
weijun@7524 29 if [ "${TESTJAVA}" = "" ] ; then
weijun@7524 30 JAVAC_CMD=`which javac`
weijun@7524 31 TESTJAVA=`dirname $JAVAC_CMD`/..
weijun@7524 32 fi
weijun@7524 33
weijun@7524 34 # set platform-dependent variables
weijun@7524 35 OS=`uname -s`
weijun@7524 36 case "$OS" in
weijun@7524 37 Windows_* )
weijun@7524 38 FS="\\"
weijun@7524 39 ;;
weijun@7524 40 * )
weijun@7524 41 FS="/"
weijun@7524 42 ;;
weijun@7524 43 esac
weijun@7524 44
weijun@7524 45 KS=onlymanifest.jks
weijun@7524 46 JFILE=onlymanifest.jar
weijun@7524 47
weijun@24116 48 KT="$TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -storepass changeit -keypass changeit \
weijun@21342 49 -keystore $KS -keyalg rsa"
weijun@24116 50 JAR="$TESTJAVA${FS}bin${FS}jar ${TESTTOOLVMOPTS}"
weijun@24116 51 JARSIGNER="$TESTJAVA${FS}bin${FS}jarsigner ${TESTTOOLVMOPTS}"
weijun@7524 52
weijun@7524 53 rm $KS $JFILE 2> /dev/null
weijun@7524 54
weijun@7524 55 # Create an empty jar file with only MANIFEST.MF
weijun@7524 56
weijun@7524 57 echo "Key: Value" > manifest
weijun@7524 58 $JAR cvfm $JFILE manifest
weijun@7524 59
weijun@7524 60 $KT -alias a -dname CN=a -genkey -validity 300 || exit 1
weijun@7524 61 $JARSIGNER -keystore $KS -storepass changeit $JFILE a -debug -strict || exit 2
weijun@7524 62 $JARSIGNER -keystore $KS -storepass changeit -verify $JFILE a -debug -strict \
weijun@7524 63 > onlymanifest.out || exit 3
weijun@7524 64
weijun@7524 65 grep unsigned onlymanifest.out && exit 4
weijun@7524 66
weijun@7524 67 exit 0
weijun@7524 68