Skip to content

Commit 2ed75be

Browse files
author
Hai-May Chao
committed
8286090: Add RC2/RC4 to jdk.security.legacyAlgorithms
Reviewed-by: mullan
1 parent f17c68c commit 2ed75be

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/java.base/share/conf/security/java.security

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ jdk.certpath.disabledAlgorithms=MD2, MD5, SHA1 jdkCA & usage TLSServer, \
654654

655655
jdk.security.legacyAlgorithms=SHA1, \
656656
RSA keySize < 2048, DSA keySize < 2048, \
657-
DES, DESede, MD5
657+
DES, DESede, MD5, RC2, ARCFOUR
658658

659659
#
660660
# Algorithm restrictions for signed JAR files

test/jdk/sun/security/tools/keytool/WeakSecretKeyTest.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 8255552
26+
* @bug 8255552 8286090
2727
* @summary Test keytool commands associated with secret key entries which use weak algorithms
2828
* @library /test/lib
2929
*/
@@ -57,12 +57,26 @@ public static void main(String[] args) throws Exception {
5757
.shouldNotMatch("The generated secret key uses the AES algorithm.*considered a security risk")
5858
.shouldHaveExitValue(0);
5959

60+
SecurityTools.keytool("-keystore ks.p12 -storepass changeit " +
61+
"-genseckey -keyalg RC2 -alias rc2key -keysize 128")
62+
.shouldContain("Warning")
63+
.shouldMatch("The generated secret key uses the RC2 algorithm.*considered a security risk")
64+
.shouldHaveExitValue(0);
65+
66+
SecurityTools.keytool("-keystore ks.p12 -storepass changeit " +
67+
"-genseckey -keyalg RC4 -alias rc4key -keysize 1024")
68+
.shouldContain("Warning")
69+
.shouldMatch("The generated secret key uses the ARCFOUR algorithm.*considered a security risk")
70+
.shouldHaveExitValue(0);
71+
6072
SecurityTools.keytool("-keystore ks.p12 -storepass changeit " +
6173
"-list -v")
6274
.shouldContain("Warning")
6375
.shouldMatch("<des3key> uses the DESede algorithm.*considered a security risk")
6476
.shouldMatch("<deskey> uses the DES algorithm.*considered a security risk")
6577
.shouldNotMatch("<aeskey> uses the AES algorithm.*considered a security risk")
78+
.shouldMatch("<rc2key> uses the RC2 algorithm.*considered a security risk")
79+
.shouldMatch("<rc4key> uses the ARCFOUR algorithm.*considered a security risk")
6680
.shouldHaveExitValue(0);
6781

6882
SecurityTools.setResponse("changeit", "changeit");
@@ -71,13 +85,17 @@ public static void main(String[] args) throws Exception {
7185
.shouldContain("Warning")
7286
.shouldMatch("<des3key> uses the DESede algorithm.*considered a security risk")
7387
.shouldMatch("<deskey> uses the DES algorithm.*considered a security risk")
88+
.shouldMatch("<rc2key> uses the RC2 algorithm.*considered a security risk")
89+
.shouldMatch("<rc4key> uses the ARCFOUR algorithm.*considered a security risk")
7490
.shouldHaveExitValue(0);
7591

7692
SecurityTools.keytool("-keystore ks.new -storepass changeit " +
7793
"-list -v")
7894
.shouldContain("Warning")
7995
.shouldMatch("<des3key> uses the DESede algorithm.*considered a security risk")
8096
.shouldMatch("<deskey> uses the DES algorithm.*considered a security risk")
97+
.shouldMatch("<rc2key> uses the RC2 algorithm.*considered a security risk")
98+
.shouldMatch("<rc4key> uses the ARCFOUR algorithm.*considered a security risk")
8199
.shouldHaveExitValue(0);
82100

83101
Files.writeString(Files.createFile(Paths.get(JAVA_SECURITY_FILE)),

0 commit comments

Comments
 (0)