jdk/test/sun/security/tools/keytool/emptysubject.sh
author weijun
Fri, 25 Apr 2014 10:57:09 +0800
changeset 24116 9f9b4ba34aad
parent 23010 6dadb192ad81
permissions -rw-r--r--
8040321: keytool and jarsigner tests doesn't pass though VM tools to tools Reviewed-by: alanb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3316
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
     1
#
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 21342
diff changeset
     2
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
3316
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
     4
#
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
     7
# published by the Free Software Foundation.
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
     8
#
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
     9
# This code is distributed in the hope that it will be useful, but WITHOUT
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    11
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    12
# version 2 for more details (a copy is included in the LICENSE file that
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    13
# accompanied this code).
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    14
#
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    15
# You should have received a copy of the GNU General Public License version
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    16
# 2 along with this work; if not, write to the Free Software Foundation,
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    17
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    18
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3316
diff changeset
    19
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3316
diff changeset
    20
# or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3316
diff changeset
    21
# questions.
3316
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    22
#
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    23
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    24
# @test
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    25
# @bug 6847026
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    26
# @summary keytool should be able to generate certreq and cert without subject name
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    27
#
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    28
# @run shell emptysubject.sh
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    29
#
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    30
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    31
if [ "${TESTJAVA}" = "" ] ; then
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    32
  JAVAC_CMD=`which javac`
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    33
  TESTJAVA=`dirname $JAVAC_CMD`/..
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    34
fi
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    35
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    36
# set platform-dependent variables
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    37
OS=`uname -s`
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    38
case "$OS" in
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    39
  Windows_* )
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    40
    FS="\\"
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    41
    ;;
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    42
  * )
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    43
    FS="/"
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    44
    ;;
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    45
esac
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    46
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    47
KS=emptysubject.jks
24116
9f9b4ba34aad 8040321: keytool and jarsigner tests doesn't pass though VM tools to tools
weijun
parents: 23010
diff changeset
    48
KT="$TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -storepass changeit -keypass changeit -keystore $KS -keyalg rsa"
3316
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    49
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    50
rm $KS
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    51
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    52
$KT -alias ca -dname CN=CA -genkeypair
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    53
$KT -alias me -dname CN=Me -genkeypair
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    54
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    55
# When -dname is recognized, SAN must be specfied, otherwise, -printcert fails.
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    56
$KT -alias me -certreq -dname "" | \
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    57
        $KT -alias ca -gencert | $KT -printcert && exit 1
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    58
$KT -alias me -certreq | \
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    59
        $KT -alias ca -gencert -dname "" | $KT -printcert && exit 2
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    60
$KT -alias me -certreq -dname "" | \
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    61
        $KT -alias ca -gencert -ext san:c=email:me@me.com | \
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    62
        $KT -printcert || exit 3
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    63
$KT -alias me -certreq | \
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    64
        $KT -alias ca -gencert -dname "" -ext san:c=email:me@me.com | \
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    65
        $KT -printcert || exit 4
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    66
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    67
exit 0
32d30c561c5a 6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff changeset
    68