3209N/A#
3209N/A# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
3209N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3209N/A#
3209N/A# This code is free software; you can redistribute it and/or modify it
3209N/A# under the terms of the GNU General Public License version 2 only, as
3209N/A# published by the Free Software Foundation.
3209N/A#
3209N/A# This code is distributed in the hope that it will be useful, but WITHOUT
3209N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3209N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3209N/A# version 2 for more details (a copy is included in the LICENSE file that
3209N/A# accompanied this code).
3209N/A#
3209N/A# You should have received a copy of the GNU General Public License version
3209N/A# 2 along with this work; if not, write to the Free Software Foundation,
3209N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3209N/A#
3209N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3209N/A# or visit www.oracle.com if you need additional information or have any
3209N/A# questions.
3209N/A#
3209N/A
3209N/A# @test
3209N/A# @bug 7004035
3209N/A# @summary signed jar with only META-INF/* inside is not verifiable
3209N/A#
3209N/A
3209N/Aif [ "${TESTJAVA}" = "" ] ; then
3209N/A JAVAC_CMD=`which javac`
3209N/A TESTJAVA=`dirname $JAVAC_CMD`/..
3209N/Afi
3209N/A
3209N/A# set platform-dependent variables
3209N/AOS=`uname -s`
3209N/Acase "$OS" in
3209N/A Windows_* )
3209N/A FS="\\"
3209N/A ;;
3209N/A * )
3209N/A FS="/"
3209N/A ;;
3209N/Aesac
3209N/A
3209N/AKS=onlymanifest.jks
3209N/AJFILE=onlymanifest.jar
3209N/A
3209N/AKT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit \
3209N/A -keystore $KS"
3209N/AJAR=$TESTJAVA${FS}bin${FS}jar
3209N/AJARSIGNER=$TESTJAVA${FS}bin${FS}jarsigner
3209N/A
3209N/Arm $KS $JFILE 2> /dev/null
3209N/A
3209N/A# Create an empty jar file with only MANIFEST.MF
3209N/A
3209N/Aecho "Key: Value" > manifest
3209N/A$JAR cvfm $JFILE manifest
3209N/A
3209N/A$KT -alias a -dname CN=a -genkey -validity 300 || exit 1
3209N/A$JARSIGNER -keystore $KS -storepass changeit $JFILE a -debug -strict || exit 2
3209N/A$JARSIGNER -keystore $KS -storepass changeit -verify $JFILE a -debug -strict \
3209N/A > onlymanifest.out || exit 3
3209N/A
3209N/Agrep unsigned onlymanifest.out && exit 4
3209N/A
3209N/Aexit 0
3209N/A