author | lana |
Tue, 24 Jul 2012 11:05:30 -0700 | |
changeset 13268 | 23117496a054 |
parent 12699 | 6142d1da5851 |
permissions | -rw-r--r-- |
11521
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
1 |
#!/bin/sh |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
2 |
|
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
3 |
# |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
4 |
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
5 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
6 |
# |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
7 |
# This code is free software; you can redistribute it and/or modify it |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
8 |
# under the terms of the GNU General Public License version 2 only, as |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
9 |
# published by the Free Software Foundation. |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
10 |
# |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
15 |
# accompanied this code). |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
16 |
# |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
17 |
# You should have received a copy of the GNU General Public License version |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
20 |
# |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
21 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
22 |
# or visit www.oracle.com if you need additional information or have any |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
23 |
# questions. |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
24 |
# |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
25 |
|
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
26 |
|
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
27 |
# @test |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
28 |
# @bug 7106773 |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
29 |
# @summary 512 bits RSA key cannot work with SHA384 and SHA512 |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
30 |
# @run shell ShortRSAKey768.sh |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
31 |
|
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
32 |
# set a few environment variables so that the shell-script can run stand-alone |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
33 |
# in the source directory |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
34 |
if [ "${TESTSRC}" = "" ] ; then |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
35 |
TESTSRC="." |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
36 |
fi |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
37 |
|
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
38 |
if [ "${TESTCLASSES}" = "" ] ; then |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
39 |
TESTCLASSES="." |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
40 |
fi |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
41 |
|
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
42 |
if [ "${TESTJAVA}" = "" ] ; then |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
43 |
echo "TESTJAVA not set. Test cannot execute." |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
44 |
echo "FAILED!!!" |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
45 |
exit 1 |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
46 |
fi |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
47 |
|
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
48 |
OS=`uname -s` |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
49 |
case "$OS" in |
12699
6142d1da5851
7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows
xuelei
parents:
11521
diff
changeset
|
50 |
SunOS | Linux | Darwin | CYGWIN* ) |
6142d1da5851
7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows
xuelei
parents:
11521
diff
changeset
|
51 |
FS="/" |
6142d1da5851
7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows
xuelei
parents:
11521
diff
changeset
|
52 |
;; |
6142d1da5851
7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows
xuelei
parents:
11521
diff
changeset
|
53 |
Windows_* ) |
6142d1da5851
7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows
xuelei
parents:
11521
diff
changeset
|
54 |
FS="\\" |
6142d1da5851
7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows
xuelei
parents:
11521
diff
changeset
|
55 |
;; |
6142d1da5851
7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows
xuelei
parents:
11521
diff
changeset
|
56 |
esac |
6142d1da5851
7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows
xuelei
parents:
11521
diff
changeset
|
57 |
|
6142d1da5851
7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows
xuelei
parents:
11521
diff
changeset
|
58 |
case "$OS" in |
11521
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
59 |
Windows* | CYGWIN* ) |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
60 |
|
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
61 |
echo "Creating a temporary RSA keypair in the Windows-My store..." |
12699
6142d1da5851
7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows
xuelei
parents:
11521
diff
changeset
|
62 |
${TESTJAVA}${FS}bin${FS}keytool \ |
11521
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
63 |
-genkeypair \ |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
64 |
-storetype Windows-My \ |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
65 |
-keyalg RSA \ |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
66 |
-alias 7106773.768 \ |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
67 |
-keysize 768 \ |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
68 |
-dname "cn=localhost,c=US" \ |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
69 |
-noprompt |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
70 |
|
12699
6142d1da5851
7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows
xuelei
parents:
11521
diff
changeset
|
71 |
if [ "$?" -ne "0" ]; then |
6142d1da5851
7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows
xuelei
parents:
11521
diff
changeset
|
72 |
echo "Unable to generate key pair in Windows-My keystore" |
6142d1da5851
7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows
xuelei
parents:
11521
diff
changeset
|
73 |
exit 1 |
6142d1da5851
7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows
xuelei
parents:
11521
diff
changeset
|
74 |
fi |
6142d1da5851
7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows
xuelei
parents:
11521
diff
changeset
|
75 |
|
11521
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
76 |
echo |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
77 |
echo "Running the test..." |
12699
6142d1da5851
7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows
xuelei
parents:
11521
diff
changeset
|
78 |
${TESTJAVA}${FS}bin${FS}javac -d . \ |
6142d1da5851
7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows
xuelei
parents:
11521
diff
changeset
|
79 |
${TESTSRC}${FS}ShortRSAKeyWithinTLS.java |
6142d1da5851
7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows
xuelei
parents:
11521
diff
changeset
|
80 |
${TESTJAVA}${FS}bin${FS}java ShortRSAKeyWithinTLS 7106773.768 768 \ |
11521
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
81 |
TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
82 |
|
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
83 |
rc=$? |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
84 |
|
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
85 |
echo |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
86 |
echo "Removing the temporary RSA keypair from the Windows-My store..." |
12699
6142d1da5851
7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows
xuelei
parents:
11521
diff
changeset
|
87 |
${TESTJAVA}${FS}bin${FS}keytool \ |
11521
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
88 |
-delete \ |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
89 |
-storetype Windows-My \ |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
90 |
-alias 7106773.768 |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
91 |
|
12699
6142d1da5851
7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows
xuelei
parents:
11521
diff
changeset
|
92 |
echo "Done". |
11521
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
93 |
exit $rc |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
94 |
;; |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
95 |
|
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
96 |
* ) |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
97 |
echo "This test is not intended for '$OS' - passing test" |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
98 |
exit 0 |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
99 |
;; |
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
diff
changeset
|
100 |
esac |