test/jdk/sun/security/tools/jarsigner/newsize7.sh
changeset 54521 8de62c4af8c7
parent 54520 f48312257bc6
child 54522 60bc754b9744
equal deleted inserted replaced
54520:f48312257bc6 54521:8de62c4af8c7
     1 #
       
     2 # Copyright (c) 2009, 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 6561126
       
    26 # @summary keytool should use larger default keysize for keypairs
       
    27 #
       
    28 # @run shell newsize7.sh
       
    29 
       
    30 # set a few environment variables so that the shell-script can run stand-alone
       
    31 # in the source directory
       
    32 if [ "${TESTSRC}" = "" ] ; then
       
    33    TESTSRC="."
       
    34 fi
       
    35 
       
    36 if [ "${TESTJAVA}" = "" ] ; then
       
    37   JAVA_CMD=`which java`
       
    38   TESTJAVA=`dirname $JAVA_CMD`/..
       
    39 fi
       
    40 
       
    41 # set platform-dependent variables
       
    42 OS=`uname -s`
       
    43 case "$OS" in
       
    44   Windows_* )
       
    45     FS="\\"
       
    46     ;;
       
    47   * )
       
    48     FS="/"
       
    49     ;;
       
    50 esac
       
    51 
       
    52 KSFILE=ns7.jks
       
    53 
       
    54 KT="${TESTJAVA}${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -keystore ns7.jks -storepass changeit -keypass changeit -keyalg rsa"
       
    55 JAR="${TESTJAVA}${FS}bin${FS}jar ${TESTTOOLVMOPTS}"
       
    56 JS="${TESTJAVA}${FS}bin${FS}jarsigner ${TESTTOOLVMOPTS} -keystore ns7.jks -storepass changeit"
       
    57 
       
    58 rm ns7.*
       
    59 
       
    60 $KT -genkeypair -alias me -dname CN=Me
       
    61 
       
    62 touch ns7.txt
       
    63 $JAR cvf ns7.jar ns7.txt
       
    64 
       
    65 $JS ns7.jar me
       
    66 $JAR xvf ns7.jar
       
    67 
       
    68 grep SHA-256 META-INF/MANIFEST.MF || exit 1
       
    69 grep SHA-256 META-INF/ME.SF || exit 2
       
    70 
       
    71 #rm -rf META-INF
       
    72 
       
    73 exit 0