20-cert-select.conf.in 30 KB

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