23
23
24
24
/*
25
25
* @test
26
- * @bug 8255552
26
+ * @bug 8255552 8286090
27
27
* @summary Test keytool commands associated with secret key entries which use weak algorithms
28
28
* @library /test/lib
29
29
*/
@@ -57,12 +57,26 @@ public static void main(String[] args) throws Exception {
57
57
.shouldNotMatch ("The generated secret key uses the AES algorithm.*considered a security risk" )
58
58
.shouldHaveExitValue (0 );
59
59
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
+
60
72
SecurityTools .keytool ("-keystore ks.p12 -storepass changeit " +
61
73
"-list -v" )
62
74
.shouldContain ("Warning" )
63
75
.shouldMatch ("<des3key> uses the DESede algorithm.*considered a security risk" )
64
76
.shouldMatch ("<deskey> uses the DES algorithm.*considered a security risk" )
65
77
.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" )
66
80
.shouldHaveExitValue (0 );
67
81
68
82
SecurityTools .setResponse ("changeit" , "changeit" );
@@ -71,13 +85,17 @@ public static void main(String[] args) throws Exception {
71
85
.shouldContain ("Warning" )
72
86
.shouldMatch ("<des3key> uses the DESede algorithm.*considered a security risk" )
73
87
.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" )
74
90
.shouldHaveExitValue (0 );
75
91
76
92
SecurityTools .keytool ("-keystore ks.new -storepass changeit " +
77
93
"-list -v" )
78
94
.shouldContain ("Warning" )
79
95
.shouldMatch ("<des3key> uses the DESede algorithm.*considered a security risk" )
80
96
.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" )
81
99
.shouldHaveExitValue (0 );
82
100
83
101
Files .writeString (Files .createFile (Paths .get (JAVA_SECURITY_FILE )),
0 commit comments