author | weijun |
Wed, 22 Jul 2009 16:40:04 +0800 | |
changeset 3316 | 32d30c561c5a |
child 5506 | 202f599c92aa |
permissions | -rw-r--r-- |
3316
32d30c561c5a
6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff
changeset
|
1 |
# |
32d30c561c5a
6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff
changeset
|
2 |
# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. |
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 |
# |
32d30c561c5a
6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff
changeset
|
19 |
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
32d30c561c5a
6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff
changeset
|
20 |
# CA 95054 USA or visit www.sun.com if you need additional information or |
32d30c561c5a
6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff
changeset
|
21 |
# have any questions. |
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 |
32d30c561c5a
6847026: keytool should be able to generate certreq and cert without subject name
weijun
parents:
diff
changeset
|
48 |
KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS" |
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 |