jdk/test/sun/security/tools/jarsigner/default_options.sh
author weijun
Thu, 11 Aug 2016 13:10:54 +0800
changeset 40262 1b3dd37cb96d
parent 34382 5d11306d6969
permissions -rw-r--r--
8133910: Some sun/security/tools tests failed. Reviewed-by: xuelei
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25663
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
     1
#
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
     2
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
     4
#
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
     7
# published by the Free Software Foundation.
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
     8
#
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
     9
# This code is distributed in the hope that it will be useful, but WITHOUT
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    11
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    12
# version 2 for more details (a copy is included in the LICENSE file that
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    13
# accompanied this code).
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    14
#
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    15
# You should have received a copy of the GNU General Public License version
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    16
# 2 along with this work; if not, write to the Free Software Foundation,
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    17
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    18
#
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    19
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    20
# or visit www.oracle.com if you need additional information or have any
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    21
# questions.
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    22
#
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    23
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    24
# @test
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    25
# @bug 8049834
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    26
# @summary Two security tools tests do not run with only JRE
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    27
#
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    28
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    29
if [ "${TESTJAVA}" = "" ] ; then
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    30
  JAVAC_CMD=`which javac`
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    31
  TESTJAVA=`dirname $JAVAC_CMD`/..
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    32
fi
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    33
34382
5d11306d6969 8130132: jarsigner should emit warning if weak algorithms or keysizes are used
weijun
parents: 25663
diff changeset
    34
PASS=changeit
5d11306d6969 8130132: jarsigner should emit warning if weak algorithms or keysizes are used
weijun
parents: 25663
diff changeset
    35
export PASS
5d11306d6969 8130132: jarsigner should emit warning if weak algorithms or keysizes are used
weijun
parents: 25663
diff changeset
    36
40262
1b3dd37cb96d 8133910: Some sun/security/tools tests failed.
weijun
parents: 34382
diff changeset
    37
TESTTOOLVMOPTS="$TESTTOOLVMOPTS -J-Duser.language=en -J-Duser.country=US"
1b3dd37cb96d 8133910: Some sun/security/tools tests failed.
weijun
parents: 34382
diff changeset
    38
25663
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    39
KS=ks
34382
5d11306d6969 8130132: jarsigner should emit warning if weak algorithms or keysizes are used
weijun
parents: 25663
diff changeset
    40
KEYTOOL="$TESTJAVA/bin/keytool ${TESTTOOLVMOPTS} -storepass:env PASS -keypass:env PASS -keystore $KS"
25663
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    41
JAR="$TESTJAVA/bin/jar ${TESTTOOLVMOPTS}"
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    42
JARSIGNER="$TESTJAVA/bin/jarsigner ${TESTTOOLVMOPTS}"
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    43
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    44
rm $KS 2> /dev/null
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    45
34382
5d11306d6969 8130132: jarsigner should emit warning if weak algorithms or keysizes are used
weijun
parents: 25663
diff changeset
    46
$KEYTOOL -genkeypair -dname CN=A -alias a -keyalg rsa || exit 1
5d11306d6969 8130132: jarsigner should emit warning if weak algorithms or keysizes are used
weijun
parents: 25663
diff changeset
    47
$KEYTOOL -genkeypair -dname CN=CA -alias ca -keyalg rsa || exit 2
5d11306d6969 8130132: jarsigner should emit warning if weak algorithms or keysizes are used
weijun
parents: 25663
diff changeset
    48
$KEYTOOL -alias a -certreq |
5d11306d6969 8130132: jarsigner should emit warning if weak algorithms or keysizes are used
weijun
parents: 25663
diff changeset
    49
    $KEYTOOL -alias ca -gencert |
5d11306d6969 8130132: jarsigner should emit warning if weak algorithms or keysizes are used
weijun
parents: 25663
diff changeset
    50
    $KEYTOOL -alias a -import || exit 3
25663
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    51
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    52
cat <<EOF > js.conf
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    53
jarsigner.all = -keystore \${user.dir}/$KS -storepass:env PASS -debug -strict
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    54
jarsigner.sign = -digestalg SHA1
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    55
jarsigner.verify = -verbose:summary
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    56
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    57
EOF
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    58
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    59
$JAR cvf a.jar ks js.conf
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    60
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    61
$JARSIGNER -conf js.conf a.jar a || exit 21
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    62
$JARSIGNER -conf js.conf -verify a.jar > jarsigner.out || exit 22
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    63
grep "and 1 more" jarsigner.out || exit 23
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    64
$JAR xvf a.jar META-INF/MANIFEST.MF
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    65
grep "SHA1-Digest" META-INF/MANIFEST.MF || exit 24
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    66
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    67
echo Done
9f511964aee6 8049834: Two security tools tests do not run with only JRE
weijun
parents:
diff changeset
    68
exit 0