< prev index next >

test/sun/security/tools/jarsigner/warnings.sh

Print this page


   1 #
   2 # Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.
   8 #
   9 # This code is distributed in the hope that it will be useful, but WITHOUT
  10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12 # version 2 for more details (a copy is included in the LICENSE file that
  13 # accompanied this code).
  14 #
  15 # You should have received a copy of the GNU General Public License version
  16 # 2 along with this work; if not, write to the Free Software Foundation,
  17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18 #
  19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20 # or visit www.oracle.com if you need additional information or have any
  21 # questions.
  22 #
  23 
  24 # @test
  25 # @bug 8024302
  26 # @bug 8026037
  27 # @summary Clarify jar verifications
  28 #
  29 
  30 if [ "${TESTJAVA}" = "" ] ; then
  31   JAVAC_CMD=`which javac`
  32   TESTJAVA=`dirname $JAVAC_CMD`/..
  33 fi
  34 
  35 # set platform-dependent variables
  36 OS=`uname -s`
  37 case "$OS" in
  38   Windows_* )
  39     FS="\\"
  40     ;;
  41   * )
  42     FS="/"
  43     ;;
  44 esac
  45 



  46 KS=warnings.jks
  47 JFILE=warnings.jar
  48 
  49 KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit \
  50         -keystore $KS"
  51 JAR=$TESTJAVA${FS}bin${FS}jar
  52 JARSIGNER="$TESTJAVA${FS}bin${FS}jarsigner -keystore $KS -storepass changeit"
  53 
  54 rm $KS 2> /dev/null
  55 
  56 LANG=C
  57 export LANG
  58 
  59 echo 12345 > file
  60 
  61 ERR=""
  62 
  63 # Normal signer expiring on 2100-01-01
  64 $KT -alias s1 -dname CN=s1 -genkey -startdate 2000/01/01 -validity 36525 || ERR="$ERR keytool s1,"
  65 # Cert expiring soon, informational warning
  66 $KT -alias s2 -dname CN=s2 -genkey -validity 100 || ERR="$ERR keytool s2,"
  67 # Cert expired, severe warning
  68 $KT -alias s3 -dname CN=s3 -genkey -startdate -200d -validity 100 || ERR="$ERR keytool s3,"
  69 
  70 # noTimestamp is informatiional warning and includes a date
  71 $JAR cvf $JFILE file
  72 $JARSIGNER $JFILE s1 > output1 || ERR="$ERR jarsigner s1,"


   1 #
   2 # Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.
   8 #
   9 # This code is distributed in the hope that it will be useful, but WITHOUT
  10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12 # version 2 for more details (a copy is included in the LICENSE file that
  13 # accompanied this code).
  14 #
  15 # You should have received a copy of the GNU General Public License version
  16 # 2 along with this work; if not, write to the Free Software Foundation,
  17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18 #
  19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20 # or visit www.oracle.com if you need additional information or have any
  21 # questions.
  22 #
  23 
  24 # @test
  25 # @bug 8024302
  26 # @bug 8026037 8134124
  27 # @summary Clarify jar verifications
  28 #
  29 
  30 if [ "${TESTJAVA}" = "" ] ; then
  31   JAVAC_CMD=`which javac`
  32   TESTJAVA=`dirname $JAVAC_CMD`/..
  33 fi
  34 
  35 # set platform-dependent variables
  36 OS=`uname -s`
  37 case "$OS" in
  38   Windows_* )
  39     FS="\\"
  40     ;;
  41   * )
  42     FS="/"
  43     ;;
  44 esac
  45 
  46 # make the test locale independent
  47 TESTTOOLVMOPTS="$TESTTOOLVMOPTS -J-Duser.language=en -J-Duser.country=US"
  48 
  49 KS=warnings.jks
  50 JFILE=warnings.jar
  51 
  52 KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit \
  53         -keystore $KS"
  54 JAR=$TESTJAVA${FS}bin${FS}jar
  55 JARSIGNER="$TESTJAVA${FS}bin${FS}jarsigner ${TESTTOOLVMOPTS} -keystore $KS -storepass changeit"
  56 
  57 rm $KS 2> /dev/null
  58 
  59 LANG=C
  60 export LANG
  61 
  62 echo 12345 > file
  63 
  64 ERR=""
  65 
  66 # Normal signer expiring on 2100-01-01
  67 $KT -alias s1 -dname CN=s1 -genkey -startdate 2000/01/01 -validity 36525 || ERR="$ERR keytool s1,"
  68 # Cert expiring soon, informational warning
  69 $KT -alias s2 -dname CN=s2 -genkey -validity 100 || ERR="$ERR keytool s2,"
  70 # Cert expired, severe warning
  71 $KT -alias s3 -dname CN=s3 -genkey -startdate -200d -validity 100 || ERR="$ERR keytool s3,"
  72 
  73 # noTimestamp is informatiional warning and includes a date
  74 $JAR cvf $JFILE file
  75 $JARSIGNER $JFILE s1 > output1 || ERR="$ERR jarsigner s1,"


< prev index next >