|
22 | 22 | */ |
23 | 23 |
|
24 | 24 | /* |
25 | | - * @test id=ARCFOUR-ARCFOUR-400 |
| 25 | + * @test |
26 | 26 | * @bug 4898461 6604496 8330842 |
27 | 27 | * @summary basic test for symmetric ciphers with padding |
28 | 28 | * @author Valerie Peng |
29 | 29 | * @library /test/lib .. |
30 | 30 | * @key randomness |
31 | 31 | * @modules jdk.crypto.cryptoki |
32 | | - * @run main/othervm TestSymmCiphers ARCFOUR ARCFOUR 400 |
| 32 | + * @run main/othervm TestSymmCiphers |
33 | 33 | */ |
34 | 34 |
|
35 | | -/* |
36 | | - * @test id=RC4-RC4-401 |
37 | | - * @bug 4898461 6604496 8330842 |
38 | | - * @summary basic test for symmetric ciphers with padding |
39 | | - * @author Valerie Peng |
40 | | - * @library /test/lib .. |
41 | | - * @key randomness |
42 | | - * @modules jdk.crypto.cryptoki |
43 | | - * @run main/othervm TestSymmCiphers RC4 RC4 401 |
44 | | - */ |
45 | | - |
46 | | -/* |
47 | | - * @test id=DES-CBC-NOPADDING-DES-400 |
48 | | - * @bug 4898461 6604496 8330842 |
49 | | - * @summary basic test for symmetric ciphers with padding |
50 | | - * @author Valerie Peng |
51 | | - * @library /test/lib .. |
52 | | - * @key randomness |
53 | | - * @modules jdk.crypto.cryptoki |
54 | | - * @run main/othervm TestSymmCiphers DES/CBC/NoPadding DES 400 |
55 | | - */ |
56 | | - |
57 | | -/* |
58 | | - * @test id=DESEDE-CBC-NOPADDING-DESEDE-160 |
59 | | - * @bug 4898461 6604496 8330842 |
60 | | - * @summary basic test for symmetric ciphers with padding |
61 | | - * @author Valerie Peng |
62 | | - * @library /test/lib .. |
63 | | - * @key randomness |
64 | | - * @modules jdk.crypto.cryptoki |
65 | | - * @run main/othervm TestSymmCiphers DESede/CBC/NoPadding DESede 160 |
66 | | - */ |
67 | | - |
68 | | -/* |
69 | | - * @test id=AES-CBC-NOPADDING-AES-4800 |
70 | | - * @bug 4898461 6604496 8330842 |
71 | | - * @summary basic test for symmetric ciphers with padding |
72 | | - * @author Valerie Peng |
73 | | - * @library /test/lib .. |
74 | | - * @key randomness |
75 | | - * @modules jdk.crypto.cryptoki |
76 | | - * @run main/othervm TestSymmCiphers AES/CBC/NoPadding AES 4800 |
77 | | - */ |
78 | | - |
79 | | -/* |
80 | | - * @test id=BLOWFISH-CBC-NOPADDING-BLOWFISH-24 |
81 | | - * @bug 4898461 6604496 8330842 |
82 | | - * @summary basic test for symmetric ciphers with padding |
83 | | - * @author Valerie Peng |
84 | | - * @library /test/lib .. |
85 | | - * @key randomness |
86 | | - * @modules jdk.crypto.cryptoki |
87 | | - * @run main/othervm TestSymmCiphers Blowfish/CBC/NoPadding Blowfish 24 |
88 | | - */ |
89 | | - |
90 | | -/* |
91 | | - * @test id=DES-CBC-PKCS5PADDING-DES-6401 |
92 | | - * @bug 4898461 6604496 8330842 |
93 | | - * @summary basic test for symmetric ciphers with padding |
94 | | - * @author Valerie Peng |
95 | | - * @library /test/lib .. |
96 | | - * @key randomness |
97 | | - * @modules jdk.crypto.cryptoki |
98 | | - * @run main/othervm TestSymmCiphers DES/cbc/PKCS5Padding DES 6401 |
99 | | - */ |
100 | | - |
101 | | -/* |
102 | | - * @test id=DESEDE-CBC-PKCS5PADDING-DESEDE-402 |
103 | | - * @bug 4898461 6604496 8330842 |
104 | | - * @summary basic test for symmetric ciphers with padding |
105 | | - * @author Valerie Peng |
106 | | - * @library /test/lib .. |
107 | | - * @key randomness |
108 | | - * @modules jdk.crypto.cryptoki |
109 | | - * @run main/othervm TestSymmCiphers DESede/CBC/PKCS5Padding DESede 402 |
110 | | - */ |
111 | | - |
112 | | -/* |
113 | | - * @test id=AES-CBC-PKCS5PADDING-AES-30 |
114 | | - * @bug 4898461 6604496 8330842 |
115 | | - * @summary basic test for symmetric ciphers with padding |
116 | | - * @author Valerie Peng |
117 | | - * @library /test/lib .. |
118 | | - * @key randomness |
119 | | - * @modules jdk.crypto.cryptoki |
120 | | - * @run main/othervm TestSymmCiphers AES/CBC/PKCS5Padding AES 30 |
121 | | - */ |
122 | | - |
123 | | -/* |
124 | | - * @test id=BLOWFISH-CBC-PKCS5PADDING-BLOWFISH-19 |
125 | | - * @bug 4898461 6604496 8330842 |
126 | | - * @summary basic test for symmetric ciphers with padding |
127 | | - * @author Valerie Peng |
128 | | - * @library /test/lib .. |
129 | | - * @key randomness |
130 | | - * @modules jdk.crypto.cryptoki |
131 | | - * @run main/othervm TestSymmCiphers Blowfish/CBC/PKCS5Padding Blowfish 19 |
132 | | - */ |
133 | | - |
134 | | -/* |
135 | | - * @test id=DES-ECB-NOPADDING-DES-400 |
136 | | - * @bug 4898461 6604496 8330842 |
137 | | - * @summary basic test for symmetric ciphers with padding |
138 | | - * @author Valerie Peng |
139 | | - * @library /test/lib .. |
140 | | - * @key randomness |
141 | | - * @modules jdk.crypto.cryptoki |
142 | | - * @run main/othervm TestSymmCiphers DES/ECB/NoPadding DES 400 |
143 | | - */ |
144 | | - |
145 | | -/* |
146 | | - * @test id=DESEDE-ECB-NOPADDING-DESEDE-160 |
147 | | - * @bug 4898461 6604496 8330842 |
148 | | - * @summary basic test for symmetric ciphers with padding |
149 | | - * @author Valerie Peng |
150 | | - * @library /test/lib .. |
151 | | - * @key randomness |
152 | | - * @modules jdk.crypto.cryptoki |
153 | | - * @run main/othervm TestSymmCiphers DESede/ECB/NoPadding DESede 160 |
154 | | - */ |
155 | | - |
156 | | -/* |
157 | | - * @test id=AES-ECB-NOPADDING-AES-4800 |
158 | | - * @bug 4898461 6604496 8330842 |
159 | | - * @summary basic test for symmetric ciphers with padding |
160 | | - * @author Valerie Peng |
161 | | - * @library /test/lib .. |
162 | | - * @key randomness |
163 | | - * @modules jdk.crypto.cryptoki |
164 | | - * @run main/othervm TestSymmCiphers AES/ECB/NoPadding AES 4800 |
165 | | - */ |
166 | | - |
167 | | -/* |
168 | | - * @test id=DES-ECB-PKCS5PADDING-DES-32 |
169 | | - * @bug 4898461 6604496 8330842 |
170 | | - * @summary basic test for symmetric ciphers with padding |
171 | | - * @author Valerie Peng |
172 | | - * @library /test/lib .. |
173 | | - * @key randomness |
174 | | - * @modules jdk.crypto.cryptoki |
175 | | - * @run main/othervm TestSymmCiphers DES/ECB/PKCS5Padding DES 32 |
176 | | - */ |
177 | | - |
178 | | -/* |
179 | | - * @test id=DES-ECB-PKCS5PADDING-DES-6400 |
180 | | - * @bug 4898461 6604496 8330842 |
181 | | - * @summary basic test for symmetric ciphers with padding |
182 | | - * @author Valerie Peng |
183 | | - * @library /test/lib .. |
184 | | - * @key randomness |
185 | | - * @modules jdk.crypto.cryptoki |
186 | | - * @run main/othervm TestSymmCiphers DES/ECB/PKCS5Padding DES 6400 |
187 | | - */ |
188 | | - |
189 | | -/* |
190 | | - * @test id=DESEDE-ECB-PKCS5PADDING-DESEDE-400 |
191 | | - * @bug 4898461 6604496 8330842 |
192 | | - * @summary basic test for symmetric ciphers with padding |
193 | | - * @author Valerie Peng |
194 | | - * @library /test/lib .. |
195 | | - * @key randomness |
196 | | - * @modules jdk.crypto.cryptoki |
197 | | - * @run main/othervm TestSymmCiphers DESede/ECB/PKCS5Padding DESede 400 |
198 | | - */ |
199 | | - |
200 | | -/* |
201 | | - * @test id=AES-ECB-PKCS5PADDING-AES-64 |
202 | | - * @bug 4898461 6604496 8330842 |
203 | | - * @summary basic test for symmetric ciphers with padding |
204 | | - * @author Valerie Peng |
205 | | - * @library /test/lib .. |
206 | | - * @key randomness |
207 | | - * @modules jdk.crypto.cryptoki |
208 | | - * @run main/othervm TestSymmCiphers AES/ECB/PKCS5Padding AES 64 |
209 | | - */ |
210 | | - |
211 | | -/* |
212 | | - * @test id=DES-DES-6400 |
213 | | - * @bug 4898461 6604496 8330842 |
214 | | - * @summary basic test for symmetric ciphers with padding |
215 | | - * @author Valerie Peng |
216 | | - * @library /test/lib .. |
217 | | - * @key randomness |
218 | | - * @modules jdk.crypto.cryptoki |
219 | | - * @run main/othervm TestSymmCiphers DES DES 6400 |
220 | | - */ |
221 | | - |
222 | | -/* |
223 | | - * @test id=DESEDE-DESEDE-408 |
224 | | - * @bug 4898461 6604496 8330842 |
225 | | - * @summary basic test for symmetric ciphers with padding |
226 | | - * @author Valerie Peng |
227 | | - * @library /test/lib .. |
228 | | - * @key randomness |
229 | | - * @modules jdk.crypto.cryptoki |
230 | | - * @run main/othervm TestSymmCiphers DESede DESede 408 |
231 | | - */ |
232 | | - |
233 | | -/* |
234 | | - * @test id=AES-AES-128 |
235 | | - * @bug 4898461 6604496 8330842 |
236 | | - * @summary basic test for symmetric ciphers with padding |
237 | | - * @author Valerie Peng |
238 | | - * @library /test/lib .. |
239 | | - * @key randomness |
240 | | - * @modules jdk.crypto.cryptoki |
241 | | - * @run main/othervm TestSymmCiphers AES AES 128 |
242 | | - */ |
243 | | - |
244 | | -/* |
245 | | - * @test id=AES-CTR-NOPADDING-AES-3200 |
246 | | - * @bug 4898461 6604496 8330842 |
247 | | - * @summary basic test for symmetric ciphers with padding |
248 | | - * @author Valerie Peng |
249 | | - * @library /test/lib .. |
250 | | - * @key randomness |
251 | | - * @modules jdk.crypto.cryptoki |
252 | | - * @run main/othervm TestSymmCiphers AES/CTR/NoPadding AES 3200 |
253 | | - */ |
254 | | - |
255 | | -/* |
256 | | - * @test id=AES-CTS-NOPADDING-AES-3200 |
257 | | - * @bug 4898461 6604496 8330842 |
258 | | - * @summary basic test for symmetric ciphers with padding |
259 | | - * @author Valerie Peng |
260 | | - * @library /test/lib .. |
261 | | - * @key randomness |
262 | | - * @modules jdk.crypto.cryptoki |
263 | | - * @run main/othervm TestSymmCiphers AES/CTS/NoPadding AES 3200 |
264 | | - */ |
265 | | - |
266 | 35 | import jtreg.SkippedException; |
267 | 36 |
|
268 | 37 | import java.io.ByteArrayOutputStream; |
269 | 38 | import java.nio.ByteBuffer; |
270 | 39 | import java.security.AlgorithmParameters; |
271 | 40 | import java.security.NoSuchAlgorithmException; |
272 | 41 | import java.security.Provider; |
| 42 | +import java.util.List; |
273 | 43 | import java.util.Random; |
274 | 44 | import javax.crypto.Cipher; |
275 | 45 | import javax.crypto.KeyGenerator; |
@@ -445,6 +215,47 @@ private static void match(ByteBuffer bb, byte[] answer) throws Exception { |
445 | 215 | } |
446 | 216 |
|
447 | 217 | public static void main(String[] args) throws Exception { |
448 | | - main(new TestSymmCiphers(args[0], args[1], Integer.parseInt(args[2])), args); |
| 218 | + |
| 219 | + final List<String[]> tests = List.of( |
| 220 | + new String[]{"ARCFOUR", "ARCFOUR", "400"}, |
| 221 | + new String[]{"RC4", "RC4", "401"}, |
| 222 | + new String[]{"DES/CBC/NoPadding", "DES", "400"}, |
| 223 | + new String[]{"DESede/CBC/NoPadding", "DESede", "160"}, |
| 224 | + new String[]{"AES/CBC/NoPadding", "AES", "4800"}, |
| 225 | + new String[]{"Blowfish/CBC/NoPadding", "Blowfish", "24"}, |
| 226 | + new String[]{"DES/cbc/PKCS5Padding", "DES", "6401"}, |
| 227 | + new String[]{"DESede/CBC/PKCS5Padding", "DESede", "402"}, |
| 228 | + new String[]{"AES/CBC/PKCS5Padding", "AES", "30"}, |
| 229 | + new String[]{"Blowfish/CBC/PKCS5Padding", "Blowfish", "19"}, |
| 230 | + new String[]{"DES/ECB/NoPadding", "DES", "400"}, |
| 231 | + new String[]{"DESede/ECB/NoPadding", "DESede", "160"}, |
| 232 | + new String[]{"AES/ECB/NoPadding", "AES", "4800"}, |
| 233 | + new String[]{"DES/ECB/PKCS5Padding", "DES", "32"}, |
| 234 | + new String[]{"DES/ECB/PKCS5Padding", "DES", "6400"}, |
| 235 | + new String[]{"DESede/ECB/PKCS5Padding", "DESede", "400"}, |
| 236 | + new String[]{"AES/ECB/PKCS5Padding", "AES", "64"}, |
| 237 | + |
| 238 | + new String[]{"DES", "DES", "6400"}, |
| 239 | + new String[]{"DESede", "DESede", "408"}, |
| 240 | + new String[]{"AES", "AES", "128"}, |
| 241 | + |
| 242 | + new String[]{"AES/CTR/NoPadding", "AES", "3200"}, |
| 243 | + new String[]{"AES/CTS/NoPadding", "AES", "3200"} |
| 244 | + |
| 245 | + ); |
| 246 | + |
| 247 | + boolean skipEncountered = false; |
| 248 | + for (final String[] t : tests) { |
| 249 | + try { |
| 250 | + main(new TestSymmCiphers(t[0], t[1], Integer.parseInt(t[2])), args); |
| 251 | + } catch (SkippedException skippedException) { |
| 252 | + skippedException.printStackTrace(System.err); |
| 253 | + skipEncountered = true; |
| 254 | + } |
| 255 | + } |
| 256 | + |
| 257 | + if (skipEncountered) { |
| 258 | + throw new SkippedException("One or more tests skipped"); |
| 259 | + } |
449 | 260 | } |
450 | 261 | } |
0 commit comments