20-cert-select.cnf.in 31 KB

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