annotate test/sun/security/tools/keytool/readjar.sh @ 1994:67e53f0f4a4d

6890872: keytool -printcert to recognize signed jar files Reviewed-by: mullan
author weijun
date Wed, 28 Oct 2009 15:32:49 +0800
parents
children
rev   line source
weijun@1994 1 #
weijun@1994 2 # Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
weijun@1994 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
weijun@1994 4 #
weijun@1994 5 # This code is free software; you can redistribute it and/or modify it
weijun@1994 6 # under the terms of the GNU General Public License version 2 only, as
weijun@1994 7 # published by the Free Software Foundation.
weijun@1994 8 #
weijun@1994 9 # This code is distributed in the hope that it will be useful, but WITHOUT
weijun@1994 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
weijun@1994 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
weijun@1994 12 # version 2 for more details (a copy is included in the LICENSE file that
weijun@1994 13 # accompanied this code).
weijun@1994 14 #
weijun@1994 15 # You should have received a copy of the GNU General Public License version
weijun@1994 16 # 2 along with this work; if not, write to the Free Software Foundation,
weijun@1994 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
weijun@1994 18 #
weijun@1994 19 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
weijun@1994 20 # CA 95054 USA or visit www.sun.com if you need additional information or
weijun@1994 21 # have any questions.
weijun@1994 22 #
weijun@1994 23
weijun@1994 24 # @test
weijun@1994 25 # @bug 6890872
weijun@1994 26 # @summary keytool -printcert to recognize signed jar files
weijun@1994 27 #
weijun@1994 28
weijun@1994 29 if [ "${TESTJAVA}" = "" ] ; then
weijun@1994 30 JAVAC_CMD=`which javac`
weijun@1994 31 TESTJAVA=`dirname $JAVAC_CMD`/..
weijun@1994 32 fi
weijun@1994 33
weijun@1994 34 # set platform-dependent variables
weijun@1994 35 OS=`uname -s`
weijun@1994 36 case "$OS" in
weijun@1994 37 Windows_* )
weijun@1994 38 FS="\\"
weijun@1994 39 ;;
weijun@1994 40 * )
weijun@1994 41 FS="/"
weijun@1994 42 ;;
weijun@1994 43 esac
weijun@1994 44
weijun@1994 45 KS=readjar.jks
weijun@1994 46 rm $KS
weijun@1994 47 $TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS \
weijun@1994 48 -alias x -dname CN=X -genkeypair
weijun@1994 49 $TESTJAVA${FS}bin${FS}jar cvf readjar.jar $KS
weijun@1994 50 $TESTJAVA${FS}bin${FS}jarsigner -storepass changeit -keystore $KS readjar.jar x
weijun@1994 51
weijun@1994 52 $TESTJAVA${FS}bin${FS}keytool -printcert -jarfile readjar.jar || exit 1
weijun@1994 53 $TESTJAVA${FS}bin${FS}keytool -printcert -jarfile readjar.jar -rfc || exit 1
weijun@1994 54
weijun@1994 55 exit 0
weijun@1994 56