#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 7004168
# @summary jarsigner -verify checks for KeyUsage codesigning ext on all certs
# instead of just signing cert
#
# @run shell checkusage.sh
#
if [ "${TESTJAVA}" = "" ] ; then
TESTJAVA=`dirname $JAVAC_CMD`/..
fi
# set platform-dependent variables
Windows_* )
FS="\\"
;;
* )
FS="/"
;;
esac
echo x > x
################### 3 Keystores #######################
# Keystore js.jks: including CA and Publisher
# CA contains a non-empty KeyUsage
# Publisher contains the correct KeyUsage
# Keystore trust.jks: including CA only
# Keystore unrelated.jks: unrelated
################### 4 Tests #######################
# Test 1: Sign should be OK
RESULT=$?
echo $RESULT
#[ $RESULT = 0 ] || exit 1
# Test 2: Verify should be OK
RESULT=$?
echo $RESULT
#[ $RESULT = 0 ] || exit 2
# Test 3: When no keystore is specified, the error is only
# "chain not validated"
RESULT=$?
echo $RESULT
#[ $RESULT = 4 ] || exit 3
# Test 4: When unrelated keystore is specified, the error is
# "chain not validated" and "not alias in keystore"
RESULT=$?
echo $RESULT
#[ $RESULT = 36 ] || exit 4
exit 0