Add a test for interleaving app data with handshake data in TLSv1.3
[openssl.git] / test / ssl-tests / 20-cert-select.conf.in
1 # -*- mode: perl; -*-
2
3 ## SSL test configurations
4
5
6 use strict;
7 use warnings;
8
9 package ssltests;
10 use OpenSSL::Test::Utils;
11
12 my $server = {
13     "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
14     "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
15     "Ed25519.Certificate" => test_pem("server-ed25519-cert.pem"),
16     "Ed25519.PrivateKey" => test_pem("server-ed25519-key.pem"),
17     "Ed448.Certificate" => test_pem("server-ed448-cert.pem"),
18     "Ed448.PrivateKey" => test_pem("server-ed448-key.pem"),
19     "MaxProtocol" => "TLSv1.2"
20 };
21
22 my $server_pss = {
23     "PSS.Certificate" => test_pem("server-pss-cert.pem"),
24     "PSS.PrivateKey" => test_pem("server-pss-key.pem"),
25     "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
26     "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
27     "Ed25519.Certificate" => test_pem("server-ed25519-cert.pem"),
28     "Ed25519.PrivateKey" => test_pem("server-ed25519-key.pem"),
29     "Ed448.Certificate" => test_pem("server-ed448-cert.pem"),
30     "Ed448.PrivateKey" => test_pem("server-ed448-key.pem"),
31     "MaxProtocol" => "TLSv1.2"
32 };
33
34 my $server_pss_only = {
35     "Certificate" => test_pem("server-pss-cert.pem"),
36     "PrivateKey" => test_pem("server-pss-key.pem"),
37 };
38
39 my $server_rsa_all = {
40     "PSS.Certificate" => test_pem("server-pss-cert.pem"),
41     "PSS.PrivateKey" => test_pem("server-pss-key.pem"),
42     "Certificate" => test_pem("servercert.pem"),
43     "PrivateKey" => test_pem("serverkey.pem"),
44 };
45
46 our @tests = (
47     {
48         name => "ECDSA CipherString Selection",
49         server => $server,
50         client => {
51             "CipherString" => "aECDSA",
52             "MaxProtocol" => "TLSv1.2",
53             "RequestCAFile" => test_pem("root-cert.pem"),
54         },
55         test   => {
56             "ExpectedServerCertType" =>, "P-256",
57             "ExpectedServerSignType" =>, "EC",
58             # Note: certificate_authorities not sent for TLS < 1.3
59             "ExpectedServerCANames" =>, "empty",
60             "ExpectedResult" => "Success"
61         },
62     },
63     {
64         name => "ECDSA CipherString Selection",
65         server => {
66             "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
67             "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
68             "MaxProtocol" => "TLSv1.2",
69             #Deliberately set supported_groups to one not in the cert. This
70             #should be tolerated
71             "Groups" => "P-384"
72         },
73         client => {
74             "CipherString" => "aECDSA",
75             "MaxProtocol" => "TLSv1.2",
76             "Groups" => "P-256:P-384",
77             "RequestCAFile" => test_pem("root-cert.pem"),
78         },
79         test   => {
80             "ExpectedServerCertType" =>, "P-256",
81             "ExpectedServerSignType" =>, "EC",
82             # Note: certificate_authorities not sent for TLS < 1.3
83             "ExpectedServerCANames" =>, "empty",
84             "ExpectedResult" => "Success"
85         },
86     },
87     {
88         name => "ECDSA CipherString Selection",
89         server => {
90             "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
91             "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
92             "MaxProtocol" => "TLSv1.2",
93             "Groups" => "P-256:P-384"
94         },
95         client => {
96             "CipherString" => "aECDSA",
97             "MaxProtocol" => "TLSv1.2",
98             #Deliberately set groups to not include the certificate group. This
99             #should fail
100             "Groups" => "P-384",
101             "RequestCAFile" => test_pem("root-cert.pem"),
102         },
103         test   => {
104             "ExpectedResult" => "ServerFail"
105         },
106     },
107     {
108         name => "Ed25519 CipherString and Signature Algorithm Selection",
109         server => $server,
110         client => {
111             "CipherString" => "aECDSA",
112             "MaxProtocol" => "TLSv1.2",
113             "SignatureAlgorithms" => "ed25519:ECDSA+SHA256",
114             "RequestCAFile" => test_pem("root-cert.pem"),
115         },
116         test   => {
117             "ExpectedServerCertType" =>, "Ed25519",
118             "ExpectedServerSignType" =>, "Ed25519",
119             # Note: certificate_authorities not sent for TLS < 1.3
120             "ExpectedServerCANames" =>, "empty",
121             "ExpectedResult" => "Success"
122         },
123     },
124     {
125         name => "Ed448 CipherString and Signature Algorithm Selection",
126         server => $server,
127         client => {
128             "CipherString" => "aECDSA",
129             "MaxProtocol" => "TLSv1.2",
130             "SignatureAlgorithms" => "ed448:ECDSA+SHA256",
131             "RequestCAFile" => test_pem("root-cert.pem"),
132         },
133         test   => {
134             "ExpectedServerCertType" =>, "Ed448",
135             "ExpectedServerSignType" =>, "Ed448",
136             # Note: certificate_authorities not sent for TLS < 1.3
137             "ExpectedServerCANames" =>, "empty",
138             "ExpectedResult" => "Success"
139         },
140     },
141     {
142         name => "ECDSA with brainpool",
143         server =>  {
144             "Certificate" => test_pem("server-ecdsa-brainpoolP256r1-cert.pem"),
145             "PrivateKey" => test_pem("server-ecdsa-brainpoolP256r1-key.pem"),
146             "Groups" => "brainpoolP256r1",
147         },
148         client => {
149             #We don't restrict this to TLSv1.2, although use of brainpool
150             #should force this anyway so that this should succeed
151             "CipherString" => "aECDSA",
152             "RequestCAFile" => test_pem("root-cert.pem"),
153             "Groups" => "brainpoolP256r1",
154         },
155         test   => {
156             "ExpectedServerCertType" =>, "brainpoolP256r1",
157             "ExpectedServerSignType" =>, "EC",
158             # Note: certificate_authorities not sent for TLS < 1.3
159             "ExpectedServerCANames" =>, "empty",
160             "ExpectedResult" => "Success"
161         },
162     },
163     {
164         name => "RSA CipherString Selection",
165         server => $server,
166         client => {
167             "CipherString" => "aRSA",
168             "MaxProtocol" => "TLSv1.2",
169         },
170         test   => {
171             "ExpectedServerCertType" =>, "RSA",
172             "ExpectedServerSignType" =>, "RSA-PSS",
173             "ExpectedResult" => "Success"
174         },
175     },
176     {
177         name => "RSA-PSS Certificate CipherString Selection",
178         server => $server_pss,
179         client => {
180             "CipherString" => "aRSA",
181             "MaxProtocol" => "TLSv1.2",
182         },
183         test   => {
184             "ExpectedServerCertType" =>, "RSA-PSS",
185             "ExpectedServerSignType" =>, "RSA-PSS",
186             "ExpectedResult" => "Success"
187         },
188     },
189     {
190         name => "P-256 CipherString and Signature Algorithm Selection",
191         server => $server,
192         client => {
193             "CipherString" => "aECDSA",
194             "MaxProtocol" => "TLSv1.2",
195             "SignatureAlgorithms" => "ECDSA+SHA256:ed25519",
196         },
197         test   => {
198             "ExpectedServerCertType" => "P-256",
199             "ExpectedServerSignHash" => "SHA256",
200             "ExpectedServerSignType" => "EC",
201             "ExpectedResult" => "Success"
202         },
203     },
204     {
205         name => "Ed25519 CipherString and Curves Selection",
206         server => $server,
207         client => {
208             "CipherString" => "aECDSA",
209             "MaxProtocol" => "TLSv1.2",
210             "SignatureAlgorithms" => "ECDSA+SHA256:ed25519",
211             # Excluding P-256 from the supported curves list means server
212             # certificate should be Ed25519 and not P-256
213             "Curves" => "X25519"
214         },
215         test   => {
216             "ExpectedServerCertType" =>, "Ed25519",
217             "ExpectedServerSignType" =>, "Ed25519",
218             "ExpectedResult" => "Success"
219         },
220     },
221     {
222         name => "Ed448 CipherString and Curves Selection",
223         server => $server,
224         client => {
225             "CipherString" => "aECDSA",
226             "MaxProtocol" => "TLSv1.2",
227             "SignatureAlgorithms" => "ECDSA+SHA256:ed448",
228             # Excluding P-256 from the supported curves list means server
229             # certificate should be Ed25519 and not P-256
230             "Curves" => "X448"
231         },
232         test   => {
233             "ExpectedServerCertType" =>, "Ed448",
234             "ExpectedServerSignType" =>, "Ed448",
235             "ExpectedResult" => "Success"
236         },
237     },
238     {
239         name => "ECDSA CipherString Selection, no ECDSA certificate",
240         server => {
241             "MaxProtocol" => "TLSv1.2"
242         },
243         client => {
244             "CipherString" => "aECDSA",
245             "MaxProtocol" => "TLSv1.2"
246         },
247         test   => {
248             "ExpectedResult" => "ServerFail"
249         },
250     },
251     {
252         name => "ECDSA Signature Algorithm Selection",
253         server => $server,
254         client => {
255             "SignatureAlgorithms" => "ECDSA+SHA256",
256         },
257         test   => {
258             "ExpectedServerCertType" => "P-256",
259             "ExpectedServerSignHash" => "SHA256",
260             "ExpectedServerSignType" => "EC",
261             "ExpectedResult" => "Success"
262         },
263     },
264     {
265         name => "ECDSA Signature Algorithm Selection SHA384",
266         server => $server,
267         client => {
268             "SignatureAlgorithms" => "ECDSA+SHA384",
269         },
270         test   => {
271             "ExpectedServerCertType" => "P-256",
272             "ExpectedServerSignHash" => "SHA384",
273             "ExpectedServerSignType" => "EC",
274             "ExpectedResult" => "Success"
275         },
276     },
277     {
278         name => "ECDSA Signature Algorithm Selection SHA1",
279         server => $server,
280         client => {
281             "SignatureAlgorithms" => "ECDSA+SHA1",
282         },
283         test   => {
284             "ExpectedServerCertType" => "P-256",
285             "ExpectedServerSignHash" => "SHA1",
286             "ExpectedServerSignType" => "EC",
287             "ExpectedResult" => "Success"
288         },
289     },
290     {
291         name => "ECDSA Signature Algorithm Selection compressed point",
292         server => {
293             "ECDSA.Certificate" => test_pem("server-cecdsa-cert.pem"),
294             "ECDSA.PrivateKey" => test_pem("server-cecdsa-key.pem"),
295             "MaxProtocol" => "TLSv1.2"
296         },
297         client => {
298             "SignatureAlgorithms" => "ECDSA+SHA256",
299         },
300         test   => {
301             "ExpectedServerCertType" => "P-256",
302             "ExpectedServerSignHash" => "SHA256",
303             "ExpectedServerSignType" => "EC",
304             "ExpectedResult" => "Success"
305         },
306     },
307     {
308         name => "ECDSA Signature Algorithm Selection, no ECDSA certificate",
309         server => {
310              "MaxProtocol" => "TLSv1.2"
311         },
312         client => {
313             "SignatureAlgorithms" => "ECDSA+SHA256",
314         },
315         test   => {
316             "ExpectedResult" => "ServerFail"
317         },
318     },
319     {
320         name => "RSA Signature Algorithm Selection",
321         server => $server,
322         client => {
323             "SignatureAlgorithms" => "RSA+SHA256",
324         },
325         test   => {
326             "ExpectedServerCertType" => "RSA",
327             "ExpectedServerSignHash" => "SHA256",
328             "ExpectedServerSignType" => "RSA",
329             "ExpectedResult" => "Success"
330         },
331     },
332     {
333         name => "RSA-PSS Signature Algorithm Selection",
334         server => $server,
335         client => {
336             "SignatureAlgorithms" => "RSA-PSS+SHA256",
337         },
338         test   => {
339             "ExpectedServerCertType" => "RSA",
340             "ExpectedServerSignHash" => "SHA256",
341             "ExpectedServerSignType" => "RSA-PSS",
342             "ExpectedResult" => "Success"
343         },
344     },
345     {
346         name => "RSA-PSS Certificate Legacy Signature Algorithm Selection",
347         server => $server_pss,
348         client => {
349             "SignatureAlgorithms" => "RSA-PSS+SHA256",
350         },
351         test   => {
352             "ExpectedServerCertType" => "RSA",
353             "ExpectedServerSignHash" => "SHA256",
354             "ExpectedServerSignType" => "RSA-PSS",
355             "ExpectedResult" => "Success"
356         },
357     },
358     {
359         name => "RSA-PSS Certificate Unified Signature Algorithm Selection",
360         server => $server_pss,
361         client => {
362             "SignatureAlgorithms" => "rsa_pss_pss_sha256",
363         },
364         test   => {
365             "ExpectedServerCertType" => "RSA-PSS",
366             "ExpectedServerSignHash" => "SHA256",
367             "ExpectedServerSignType" => "RSA-PSS",
368             "ExpectedResult" => "Success"
369         },
370     },
371     {
372         name => "Only RSA-PSS Certificate",
373         server => $server_pss_only,
374         client => {},
375         test   => {
376             "ExpectedServerCertType" => "RSA-PSS",
377             "ExpectedServerSignHash" => "SHA256",
378             "ExpectedServerSignType" => "RSA-PSS",
379             "ExpectedResult" => "Success"
380         },
381     },
382     {
383         name => "RSA-PSS Certificate, no PSS signature algorithms",
384         server => $server_pss_only,
385         client => {
386             "SignatureAlgorithms" => "RSA+SHA256",
387         },
388         test   => {
389             "ExpectedResult" => "ServerFail"
390         },
391     },
392     {
393         name => "RSA key exchange with all RSA certificate types",
394         server => $server_rsa_all,
395         client => {
396             "CipherString" => "kRSA",
397             "MaxProtocol" => "TLSv1.2",
398         },
399         test   => {
400             "ExpectedServerCertType" =>, "RSA",
401             "ExpectedResult" => "Success"
402         },
403     },
404     {
405         name => "RSA key exchange with only RSA-PSS certificate",
406         server => $server_pss_only,
407         client => {
408             "CipherString" => "kRSA",
409             "MaxProtocol" => "TLSv1.2",
410         },
411         test   => {
412             "ExpectedResult" => "ServerFail"
413         },
414     },
415     {
416         name => "Suite B P-256 Hash Algorithm Selection",
417         server =>  {
418             "ECDSA.Certificate" => test_pem("p256-server-cert.pem"),
419             "ECDSA.PrivateKey" => test_pem("p256-server-key.pem"),
420             "MaxProtocol" => "TLSv1.2",
421             "CipherString" => "SUITEB128"
422         },
423         client => {
424             "VerifyCAFile" => test_pem("p384-root.pem"),
425             "SignatureAlgorithms" => "ECDSA+SHA384:ECDSA+SHA256"
426         },
427         test   => {
428             "ExpectedServerCertType" => "P-256",
429             "ExpectedServerSignHash" => "SHA256",
430             "ExpectedServerSignType" => "EC",
431             "ExpectedResult" => "Success"
432         },
433     },
434     {
435         name => "Suite B P-384 Hash Algorithm Selection",
436         server =>  {
437             "ECDSA.Certificate" => test_pem("p384-server-cert.pem"),
438             "ECDSA.PrivateKey" => test_pem("p384-server-key.pem"),
439             "MaxProtocol" => "TLSv1.2",
440             "CipherString" => "SUITEB128"
441         },
442         client => {
443             "VerifyCAFile" => test_pem("p384-root.pem"),
444             "SignatureAlgorithms" => "ECDSA+SHA256:ECDSA+SHA384"
445         },
446         test   => {
447             "ExpectedServerCertType" => "P-384",
448             "ExpectedServerSignHash" => "SHA384",
449             "ExpectedServerSignType" => "EC",
450             "ExpectedResult" => "Success"
451         },
452     },
453     {
454         name => "TLS 1.2 Ed25519 Client Auth",
455         server => {
456             "VerifyCAFile" => test_pem("root-cert.pem"),
457             "VerifyMode" => "Require"
458         },
459         client => {
460             "Ed25519.Certificate" => test_pem("client-ed25519-cert.pem"),
461             "Ed25519.PrivateKey" => test_pem("client-ed25519-key.pem"),
462             "MinProtocol" => "TLSv1.2",
463             "MaxProtocol" => "TLSv1.2"
464         },
465         test   => {
466             "ExpectedClientCertType" => "Ed25519",
467             "ExpectedClientSignType" => "Ed25519",
468             "ExpectedResult" => "Success"
469         },
470     },
471     {
472         name => "TLS 1.2 Ed448 Client Auth",
473         server => {
474             "VerifyCAFile" => test_pem("root-cert.pem"),
475             "VerifyMode" => "Require"
476         },
477         client => {
478             "Ed448.Certificate" => test_pem("client-ed448-cert.pem"),
479             "Ed448.PrivateKey" => test_pem("client-ed448-key.pem"),
480             "MinProtocol" => "TLSv1.2",
481             "MaxProtocol" => "TLSv1.2"
482         },
483         test   => {
484             "ExpectedClientCertType" => "Ed448",
485             "ExpectedClientSignType" => "Ed448",
486             "ExpectedResult" => "Success"
487         },
488     },
489 );
490
491 my @tests_tls_1_1 = (
492     {
493         name => "Only RSA-PSS Certificate, TLS v1.1",
494         server => $server_pss_only,
495         client => {
496             "MaxProtocol" => "TLSv1.1",
497         },
498         test   => {
499             "ExpectedResult" => "ServerFail"
500         },
501     },
502 );
503
504 push @tests, @tests_tls_1_1 unless disabled("tls1_1");
505
506 my $server_tls_1_3 = {
507     "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
508     "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
509     "Ed25519.Certificate" => test_pem("server-ed25519-cert.pem"),
510     "Ed25519.PrivateKey" => test_pem("server-ed25519-key.pem"),
511     "Ed448.Certificate" => test_pem("server-ed448-cert.pem"),
512     "Ed448.PrivateKey" => test_pem("server-ed448-key.pem"),
513     "MinProtocol" => "TLSv1.3",
514     "MaxProtocol" => "TLSv1.3"
515 };
516
517 my $server_tls_1_3_pss = {
518     "PSS.Certificate" => test_pem("server-pss-cert.pem"),
519     "PSS.PrivateKey" => test_pem("server-pss-key.pem"),
520     "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
521     "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
522     "Ed25519.Certificate" => test_pem("server-ed25519-cert.pem"),
523     "Ed25519.PrivateKey" => test_pem("server-ed25519-key.pem"),
524     "Ed448.Certificate" => test_pem("server-ed448-cert.pem"),
525     "Ed448.PrivateKey" => test_pem("server-ed449-key.pem"),
526     "MinProtocol" => "TLSv1.3",
527     "MaxProtocol" => "TLSv1.3"
528 };
529
530 my $client_tls_1_3 = {
531     "RSA.Certificate" => test_pem("ee-client-chain.pem"),
532     "RSA.PrivateKey" => test_pem("ee-key.pem"),
533     "ECDSA.Certificate" => test_pem("ee-ecdsa-client-chain.pem"),
534     "ECDSA.PrivateKey" => test_pem("ee-ecdsa-key.pem"),
535     "MinProtocol" => "TLSv1.3",
536     "MaxProtocol" => "TLSv1.3"
537 };
538
539 my @tests_tls_1_3 = (
540     {
541         name => "TLS 1.3 ECDSA Signature Algorithm Selection",
542         server => $server_tls_1_3,
543         client => {
544             "SignatureAlgorithms" => "ECDSA+SHA256",
545         },
546         test   => {
547             "ExpectedServerCertType" => "P-256",
548             "ExpectedServerSignHash" => "SHA256",
549             "ExpectedServerSignType" => "EC",
550             "ExpectedServerCANames" => "empty",
551             "ExpectedResult" => "Success"
552         },
553     },
554     {
555         name => "TLS 1.3 ECDSA Signature Algorithm Selection compressed point",
556         server => {
557             "ECDSA.Certificate" => test_pem("server-cecdsa-cert.pem"),
558             "ECDSA.PrivateKey" => test_pem("server-cecdsa-key.pem"),
559             "MinProtocol" => "TLSv1.3",
560             "MaxProtocol" => "TLSv1.3"
561         },
562         client => {
563             "SignatureAlgorithms" => "ECDSA+SHA256",
564         },
565         test   => {
566             "ExpectedServerCertType" => "P-256",
567             "ExpectedServerSignHash" => "SHA256",
568             "ExpectedServerSignType" => "EC",
569             "ExpectedServerCANames" => "empty",
570             "ExpectedResult" => "Success"
571         },
572     },
573     {
574         name => "TLS 1.3 ECDSA Signature Algorithm Selection SHA1",
575         server => $server_tls_1_3,
576         client => {
577             "SignatureAlgorithms" => "ECDSA+SHA1",
578         },
579         test   => {
580             "ExpectedResult" => "ServerFail"
581         },
582     },
583     {
584         name => "TLS 1.3 ECDSA Signature Algorithm Selection with PSS",
585         server => $server_tls_1_3,
586         client => {
587             "SignatureAlgorithms" => "ECDSA+SHA256:RSA-PSS+SHA256",
588             "RequestCAFile" => test_pem("root-cert.pem"),
589         },
590         test   => {
591             "ExpectedServerCertType" => "P-256",
592             "ExpectedServerSignHash" => "SHA256",
593             "ExpectedServerSignType" => "EC",
594             "ExpectedServerCANames" => test_pem("root-cert.pem"),
595             "ExpectedResult" => "Success"
596         },
597     },
598     {
599         name => "TLS 1.3 RSA Signature Algorithm Selection SHA384 with PSS",
600         server => $server_tls_1_3,
601         client => {
602             "SignatureAlgorithms" => "ECDSA+SHA384:RSA-PSS+SHA384",
603         },
604         test   => {
605             "ExpectedServerCertType" => "RSA",
606             "ExpectedServerSignHash" => "SHA384",
607             "ExpectedServerSignType" => "RSA-PSS",
608             "ExpectedResult" => "Success"
609         },
610     },
611     {
612         name => "TLS 1.3 ECDSA Signature Algorithm Selection, no ECDSA certificate",
613         server => {
614             "MinProtocol" => "TLSv1.3",
615             "MaxProtocol" => "TLSv1.3"
616         },
617         client => {
618             "SignatureAlgorithms" => "ECDSA+SHA256",
619         },
620         test   => {
621             "ExpectedResult" => "ServerFail"
622         },
623     },
624     {
625         name => "TLS 1.3 RSA Signature Algorithm Selection, no PSS",
626         server => $server_tls_1_3,
627         client => {
628             "SignatureAlgorithms" => "RSA+SHA256",
629         },
630         test   => {
631             "ExpectedResult" => "ServerFail"
632         },
633     },
634     {
635         name => "TLS 1.3 RSA-PSS Signature Algorithm Selection",
636         server => $server_tls_1_3,
637         client => {
638             "SignatureAlgorithms" => "RSA-PSS+SHA256",
639         },
640         test   => {
641             "ExpectedServerCertType" => "RSA",
642             "ExpectedServerSignHash" => "SHA256",
643             "ExpectedServerSignType" => "RSA-PSS",
644             "ExpectedResult" => "Success"
645         },
646     },
647     {
648         name => "TLS 1.3 Ed25519 Signature Algorithm Selection",
649         server => $server_tls_1_3,
650         client => {
651             "SignatureAlgorithms" => "ed25519",
652         },
653         test   => {
654             "ExpectedServerCertType" => "Ed25519",
655             "ExpectedServerSignType" => "Ed25519",
656             "ExpectedResult" => "Success"
657         },
658     },
659     {
660         name => "TLS 1.3 Ed448 Signature Algorithm Selection",
661         server => $server_tls_1_3,
662         client => {
663             "SignatureAlgorithms" => "ed448",
664         },
665         test   => {
666             "ExpectedServerCertType" => "Ed448",
667             "ExpectedServerSignType" => "Ed448",
668             "ExpectedResult" => "Success"
669         },
670     },
671     {
672         name => "TLS 1.3 Ed25519 CipherString and Groups Selection",
673         server => $server_tls_1_3,
674         client => {
675             "SignatureAlgorithms" => "ECDSA+SHA256:ed25519",
676             # Excluding P-256 from the supported groups list should
677             # mean server still uses a P-256 certificate because supported
678             # groups is not used in signature selection for TLS 1.3
679             "Groups" => "X25519"
680         },
681         test   => {
682             "ExpectedServerCertType" =>, "P-256",
683             "ExpectedServerSignType" =>, "EC",
684             "ExpectedResult" => "Success"
685         },
686     },
687     {
688         name => "TLS 1.3 Ed448 CipherString and Groups Selection",
689         server => $server_tls_1_3,
690         client => {
691             "SignatureAlgorithms" => "ECDSA+SHA256:ed448",
692             # Excluding P-256 from the supported groups list should
693             # mean server still uses a P-256 certificate because supported
694             # groups is not used in signature selection for TLS 1.3
695             "Groups" => "X448"
696         },
697         test   => {
698             "ExpectedServerCertType" =>, "P-256",
699             "ExpectedServerSignType" =>, "EC",
700             "ExpectedResult" => "Success"
701         },
702     },
703     {
704         name => "TLS 1.3 RSA Client Auth Signature Algorithm Selection",
705         server => {
706             "ClientSignatureAlgorithms" => "PSS+SHA256",
707             "VerifyCAFile" => test_pem("root-cert.pem"),
708             "VerifyMode" => "Require"
709         },
710         client => $client_tls_1_3,
711         test   => {
712             "ExpectedClientCertType" => "RSA",
713             "ExpectedClientSignHash" => "SHA256",
714             "ExpectedClientSignType" => "RSA-PSS",
715             "ExpectedClientCANames" => "empty",
716             "ExpectedResult" => "Success"
717         },
718     },
719     {
720         name => "TLS 1.3 RSA Client Auth Signature Algorithm Selection non-empty CA Names",
721         server => {
722             "ClientSignatureAlgorithms" => "PSS+SHA256",
723             "VerifyCAFile" => test_pem("root-cert.pem"),
724             "RequestCAFile" => test_pem("root-cert.pem"),
725             "VerifyMode" => "Require"
726         },
727         client => $client_tls_1_3,
728         test   => {
729             "ExpectedClientCertType" => "RSA",
730             "ExpectedClientSignHash" => "SHA256",
731             "ExpectedClientSignType" => "RSA-PSS",
732             "ExpectedClientCANames" => test_pem("root-cert.pem"),
733             "ExpectedResult" => "Success"
734         },
735     },
736     {
737         name => "TLS 1.3 ECDSA Client Auth Signature Algorithm Selection",
738         server => {
739             "ClientSignatureAlgorithms" => "ECDSA+SHA256",
740             "VerifyCAFile" => test_pem("root-cert.pem"),
741             "VerifyMode" => "Require"
742         },
743         client => $client_tls_1_3,
744         test   => {
745             "ExpectedClientCertType" => "P-256",
746             "ExpectedClientSignHash" => "SHA256",
747             "ExpectedClientSignType" => "EC",
748             "ExpectedResult" => "Success"
749         },
750     },
751     {
752         name => "TLS 1.3 Ed25519 Client Auth",
753         server => {
754             "VerifyCAFile" => test_pem("root-cert.pem"),
755             "VerifyMode" => "Require"
756         },
757         client => {
758             "EdDSA.Certificate" => test_pem("client-ed25519-cert.pem"),
759             "EdDSA.PrivateKey" => test_pem("client-ed25519-key.pem"),
760             "MinProtocol" => "TLSv1.3",
761             "MaxProtocol" => "TLSv1.3"
762         },
763         test   => {
764             "ExpectedClientCertType" => "Ed25519",
765             "ExpectedClientSignType" => "Ed25519",
766             "ExpectedResult" => "Success"
767         },
768     },
769     {
770         name => "TLS 1.3 Ed448 Client Auth",
771         server => {
772             "VerifyCAFile" => test_pem("root-cert.pem"),
773             "VerifyMode" => "Require"
774         },
775         client => {
776             "EdDSA.Certificate" => test_pem("client-ed448-cert.pem"),
777             "EdDSA.PrivateKey" => test_pem("client-ed448-key.pem"),
778             "MinProtocol" => "TLSv1.3",
779             "MaxProtocol" => "TLSv1.3"
780         },
781         test   => {
782             "ExpectedClientCertType" => "Ed448",
783             "ExpectedClientSignType" => "Ed448",
784             "ExpectedResult" => "Success"
785         },
786     },
787     {
788         name => "TLS 1.3 ECDSA with brainpool",
789         server =>  {
790             "Certificate" => test_pem("server-ecdsa-brainpoolP256r1-cert.pem"),
791             "PrivateKey" => test_pem("server-ecdsa-brainpoolP256r1-key.pem"),
792             "Groups" => "brainpoolP256r1",
793         },
794         client => {
795             "RequestCAFile" => test_pem("root-cert.pem"),
796             "Groups" => "brainpoolP256r1",
797             "MinProtocol" => "TLSv1.3",
798             "MaxProtocol" => "TLSv1.3"
799         },
800         test   => {
801             "ExpectedResult" => "ServerFail"
802         },
803     },
804 );
805
806 push @tests, @tests_tls_1_3 unless disabled("tls1_3");
807
808 my @tests_dsa_tls_1_2 = (
809     {
810         name => "TLS 1.2 DSA Certificate Test",
811         server => {
812             "DSA.Certificate" => test_pem("server-dsa-cert.pem"),
813             "DSA.PrivateKey" => test_pem("server-dsa-key.pem"),
814             "DHParameters" => test_pem("dhp2048.pem"),
815             "MinProtocol" => "TLSv1.2",
816             "MaxProtocol" => "TLSv1.2",
817             "CipherString" => "ALL",
818         },
819         client => {
820             "SignatureAlgorithms" => "DSA+SHA256:DSA+SHA1",
821             "CipherString" => "ALL",
822         },
823         test   => {
824             "ExpectedResult" => "Success"
825         },
826     },
827 );
828
829 my @tests_dsa_tls_1_3 = (
830     {
831         name => "TLS 1.3 Client Auth No TLS 1.3 Signature Algorithms",
832         server => {
833             "ClientSignatureAlgorithms" => "ECDSA+SHA1:DSA+SHA256:RSA+SHA256",
834             "VerifyCAFile" => test_pem("root-cert.pem"),
835             "VerifyMode" => "Request"
836         },
837         client => {},
838         test   => {
839             "ExpectedResult" => "ServerFail"
840         },
841     },
842     {
843         name => "TLS 1.3 DSA Certificate Test",
844         server => {
845             "DSA.Certificate" => test_pem("server-dsa-cert.pem"),
846             "DSA.PrivateKey" => test_pem("server-dsa-key.pem"),
847             "MinProtocol" => "TLSv1.3",
848             "MaxProtocol" => "TLSv1.3",
849             "CipherString" => "ALL",
850         },
851         client => {
852             "SignatureAlgorithms" => "DSA+SHA1:DSA+SHA256:ECDSA+SHA256",
853             "CipherString" => "ALL",
854         },
855         test   => {
856             "ExpectedResult" => "ServerFail"
857         },
858     },
859 );
860
861 if (!disabled("dsa")) {
862     push @tests, @tests_dsa_tls_1_2 unless disabled("dh");
863     push @tests, @tests_dsa_tls_1_3 unless disabled("tls1_3");
864 }