70-test_sslsigalgs.t 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. #! /usr/bin/env perl
  2. # Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License 2.0 (the "License"). You may not use
  5. # this file except in compliance with the License. You can obtain a copy
  6. # in the file LICENSE in the source distribution or at
  7. # https://www.openssl.org/source/license.html
  8. use strict;
  9. use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file bldtop_dir/;
  10. use OpenSSL::Test::Utils;
  11. use TLSProxy::Proxy;
  12. my $test_name = "test_sslsigalgs";
  13. setup($test_name);
  14. plan skip_all => "TLSProxy isn't usable on $^O"
  15. if $^O =~ /^(VMS)$/;
  16. plan skip_all => "$test_name needs the dynamic engine feature enabled"
  17. if disabled("engine") || disabled("dynamic-engine");
  18. plan skip_all => "$test_name needs the sock feature enabled"
  19. if disabled("sock");
  20. plan skip_all => "$test_name needs TLS1.2 or TLS1.3 enabled"
  21. if disabled("tls1_2") && disabled("tls1_3");
  22. my $proxy = TLSProxy::Proxy->new(
  23. undef,
  24. cmdstr(app(["openssl"]), display => 1),
  25. srctop_file("apps", "server.pem"),
  26. (!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
  27. );
  28. use constant {
  29. NO_SIG_ALGS_EXT => 0,
  30. EMPTY_SIG_ALGS_EXT => 1,
  31. NO_KNOWN_SIG_ALGS => 2,
  32. NO_PSS_SIG_ALGS => 3,
  33. PSS_ONLY_SIG_ALGS => 4,
  34. PURE_SIGALGS => 5,
  35. COMPAT_SIGALGS => 6,
  36. SIGALGS_CERT_ALL => 7,
  37. SIGALGS_CERT_PKCS => 8,
  38. SIGALGS_CERT_INVALID => 9,
  39. UNRECOGNIZED_SIGALGS_CERT => 10,
  40. UNRECOGNIZED_SIGALG => 11
  41. };
  42. #Note: Throughout this test we override the default ciphersuites where TLSv1.2
  43. # is expected to ensure that a ServerKeyExchange message is sent that uses
  44. # the sigalgs
  45. #Test 1: Default sig algs should succeed
  46. $proxy->clientflags("-no_tls1_3") if disabled("ec") && disabled("dh");
  47. $proxy->start() or plan skip_all => "Unable to start up Proxy for tests";
  48. plan tests => 26;
  49. ok(TLSProxy::Message->success, "Default sigalgs");
  50. my $testtype;
  51. SKIP: {
  52. skip "TLSv1.3 disabled", 6
  53. if disabled("tls1_3") || (disabled("ec") && disabled("dh"));
  54. $proxy->filter(\&sigalgs_filter);
  55. #Test 2: Sending no sig algs extension in TLSv1.3 should fail
  56. $proxy->clear();
  57. $testtype = NO_SIG_ALGS_EXT;
  58. $proxy->start();
  59. ok(TLSProxy::Message->fail, "No TLSv1.3 sigalgs");
  60. #Test 3: Sending an empty sig algs extension in TLSv1.3 should fail
  61. $proxy->clear();
  62. $testtype = EMPTY_SIG_ALGS_EXT;
  63. $proxy->start();
  64. ok(TLSProxy::Message->fail, "Empty TLSv1.3 sigalgs");
  65. #Test 4: Sending a list with no recognised sig algs in TLSv1.3 should fail
  66. $proxy->clear();
  67. $testtype = NO_KNOWN_SIG_ALGS;
  68. $proxy->start();
  69. ok(TLSProxy::Message->fail, "No known TLSv1.3 sigalgs");
  70. #Test 5: Sending a sig algs list without pss for an RSA cert in TLSv1.3
  71. # should fail
  72. $proxy->clear();
  73. $testtype = NO_PSS_SIG_ALGS;
  74. $proxy->start();
  75. ok(TLSProxy::Message->fail, "No PSS TLSv1.3 sigalgs");
  76. #Test 6: Sending only TLSv1.3 PSS sig algs in TLSv1.3 should succeed
  77. #TODO(TLS1.3): Do we need to verify the cert to make sure its a PSS only
  78. #cert in this case?
  79. $proxy->clear();
  80. $testtype = PSS_ONLY_SIG_ALGS;
  81. $proxy->start();
  82. ok(TLSProxy::Message->success, "PSS only sigalgs in TLSv1.3");
  83. #Test 7: Modify the CertificateVerify sigalg from rsa_pss_rsae_sha256 to
  84. # rsa_pss_pss_sha256. This should fail because the public key OID
  85. # in the certificate is rsaEncryption and not rsassaPss
  86. $proxy->filter(\&modify_cert_verify_sigalg);
  87. $proxy->clear();
  88. $proxy->start();
  89. ok(TLSProxy::Message->fail,
  90. "Mismatch between CertVerify sigalg and public key OID");
  91. }
  92. SKIP: {
  93. skip "EC or TLSv1.3 disabled", 1
  94. if disabled("tls1_3") || disabled("ec");
  95. #Test 8: Sending a valid sig algs list but not including a sig type that
  96. # matches the certificate should fail in TLSv1.3.
  97. $proxy->clear();
  98. $proxy->clientflags("-sigalgs ECDSA+SHA256");
  99. $proxy->filter(undef);
  100. $proxy->start();
  101. ok(TLSProxy::Message->fail, "No matching TLSv1.3 sigalgs");
  102. }
  103. SKIP: {
  104. skip "EC, TLSv1.3 or TLSv1.2 disabled", 1
  105. if disabled("tls1_2") || disabled("tls1_3") || disabled("ec");
  106. #Test 9: Sending a full list of TLSv1.3 sig algs but negotiating TLSv1.2
  107. # should succeed
  108. $proxy->clear();
  109. $proxy->serverflags("-no_tls1_3");
  110. $proxy->ciphers("ECDHE-RSA-AES128-SHA");
  111. $proxy->filter(undef);
  112. $proxy->start();
  113. ok(TLSProxy::Message->success, "TLSv1.3 client TLSv1.2 server");
  114. }
  115. SKIP: {
  116. skip "EC or TLSv1.2 disabled", 10 if disabled("tls1_2") || disabled("ec");
  117. $proxy->filter(\&sigalgs_filter);
  118. #Test 10: Sending no sig algs extension in TLSv1.2 will make it use
  119. # SHA1, which is only supported at security level 0.
  120. $proxy->clear();
  121. $testtype = NO_SIG_ALGS_EXT;
  122. $proxy->clientflags("-no_tls1_3 -cipher DEFAULT:\@SECLEVEL=0");
  123. $proxy->ciphers("ECDHE-RSA-AES128-SHA:\@SECLEVEL=0");
  124. $proxy->start();
  125. ok(TLSProxy::Message->success, "No TLSv1.2 sigalgs seclevel 0");
  126. #Test 11: Sending no sig algs extension in TLSv1.2 should fail at security
  127. # level 1 since it will try to use SHA1. Testing client at level 0,
  128. # server level 1.
  129. $proxy->clear();
  130. $testtype = NO_SIG_ALGS_EXT;
  131. $proxy->clientflags("-tls1_2 -cipher DEFAULT:\@SECLEVEL=0");
  132. $proxy->ciphers("DEFAULT:\@SECLEVEL=1");
  133. $proxy->start();
  134. ok(TLSProxy::Message->fail, "No TLSv1.2 sigalgs server seclevel 1");
  135. #Test 12: Sending no sig algs extension in TLSv1.2 should fail at security
  136. # level 1 since it will try to use SHA1. Testing client at level 1,
  137. # server level 0.
  138. $proxy->clear();
  139. $testtype = NO_SIG_ALGS_EXT;
  140. $proxy->clientflags("-tls1_2 -cipher DEFAULT:\@SECLEVEL=1");
  141. $proxy->ciphers("DEFAULT:\@SECLEVEL=0");
  142. $proxy->start();
  143. ok(TLSProxy::Message->fail, "No TLSv1.2 sigalgs client seclevel 2");
  144. #Test 13: Sending an empty sig algs extension in TLSv1.2 should fail
  145. $proxy->clear();
  146. $testtype = EMPTY_SIG_ALGS_EXT;
  147. $proxy->clientflags("-no_tls1_3");
  148. $proxy->ciphers("ECDHE-RSA-AES128-SHA");
  149. $proxy->start();
  150. ok(TLSProxy::Message->fail, "Empty TLSv1.2 sigalgs");
  151. #Test 14: Sending a list with no recognised sig algs in TLSv1.2 should fail
  152. $proxy->clear();
  153. $testtype = NO_KNOWN_SIG_ALGS;
  154. $proxy->clientflags("-no_tls1_3");
  155. $proxy->ciphers("ECDHE-RSA-AES128-SHA");
  156. $proxy->start();
  157. ok(TLSProxy::Message->fail, "No known TLSv1.3 sigalgs");
  158. #Test 15: Sending a sig algs list without pss for an RSA cert in TLSv1.2
  159. # should succeed
  160. $proxy->clear();
  161. $testtype = NO_PSS_SIG_ALGS;
  162. $proxy->clientflags("-no_tls1_3");
  163. $proxy->ciphers("ECDHE-RSA-AES128-SHA");
  164. $proxy->start();
  165. ok(TLSProxy::Message->success, "No PSS TLSv1.2 sigalgs");
  166. #Test 16: Sending only TLSv1.3 PSS sig algs in TLSv1.2 should succeed
  167. $proxy->clear();
  168. $testtype = PSS_ONLY_SIG_ALGS;
  169. $proxy->serverflags("-no_tls1_3");
  170. $proxy->ciphers("ECDHE-RSA-AES128-SHA");
  171. $proxy->start();
  172. ok(TLSProxy::Message->success, "PSS only sigalgs in TLSv1.2");
  173. #Test 17: Responding with a sig alg we did not send in TLSv1.2 should fail
  174. # We send rsa_pkcs1_sha256 and respond with rsa_pss_rsae_sha256
  175. # TODO(TLS1.3): Add a similar test to the TLSv1.3 section above
  176. # when we have an API capable of configuring the TLSv1.3 sig algs
  177. $proxy->clear();
  178. $testtype = PSS_ONLY_SIG_ALGS;
  179. $proxy->clientflags("-no_tls1_3 -sigalgs RSA+SHA256");
  180. $proxy->ciphers("ECDHE-RSA-AES128-SHA");
  181. $proxy->start();
  182. ok(TLSProxy::Message->fail, "Sigalg we did not send in TLSv1.2");
  183. #Test 18: Sending a valid sig algs list but not including a sig type that
  184. # matches the certificate should fail in TLSv1.2
  185. $proxy->clear();
  186. $proxy->clientflags("-no_tls1_3 -sigalgs ECDSA+SHA256");
  187. $proxy->ciphers("ECDHE-RSA-AES128-SHA");
  188. $proxy->filter(undef);
  189. $proxy->start();
  190. ok(TLSProxy::Message->fail, "No matching TLSv1.2 sigalgs");
  191. $proxy->filter(\&sigalgs_filter);
  192. #Test 19: No sig algs extension, ECDSA cert, will use SHA1,
  193. # TLSv1.2 should succeed at security level 0
  194. $proxy->clear();
  195. $testtype = NO_SIG_ALGS_EXT;
  196. $proxy->clientflags("-no_tls1_3 -cipher DEFAULT:\@SECLEVEL=0");
  197. $proxy->serverflags("-cert " . srctop_file("test", "certs",
  198. "server-ecdsa-cert.pem") .
  199. " -key " . srctop_file("test", "certs",
  200. "server-ecdsa-key.pem")),
  201. $proxy->ciphers("ECDHE-ECDSA-AES128-SHA:\@SECLEVEL=0");
  202. $proxy->start();
  203. ok(TLSProxy::Message->success, "No TLSv1.2 sigalgs, ECDSA");
  204. }
  205. my ($dsa_status, $sha1_status, $sha224_status);
  206. SKIP: {
  207. skip "TLSv1.3 disabled", 2
  208. if disabled("tls1_3")
  209. || disabled("dsa")
  210. || (disabled("ec") && disabled("dh"));
  211. #Test 20: signature_algorithms with 1.3-only ClientHello
  212. $testtype = PURE_SIGALGS;
  213. $dsa_status = $sha1_status = $sha224_status = 0;
  214. $proxy->clear();
  215. $proxy->clientflags("-tls1_3");
  216. $proxy->filter(\&modify_sigalgs_filter);
  217. $proxy->start();
  218. ok($dsa_status && $sha1_status && $sha224_status,
  219. "DSA and SHA1 sigalgs not sent for 1.3-only ClientHello");
  220. #Test 21: signature_algorithms with backwards compatible ClientHello
  221. SKIP: {
  222. skip "TLSv1.2 disabled", 1 if disabled("tls1_2");
  223. $testtype = COMPAT_SIGALGS;
  224. $dsa_status = $sha1_status = $sha224_status = 0;
  225. $proxy->clear();
  226. $proxy->clientflags("-cipher AES128-SHA\@SECLEVEL=0");
  227. $proxy->filter(\&modify_sigalgs_filter);
  228. $proxy->start();
  229. ok($dsa_status && $sha1_status && $sha224_status,
  230. "backwards compatible sigalg sent for compat ClientHello");
  231. }
  232. }
  233. SKIP: {
  234. skip "TLSv1.3 disabled", 5
  235. if disabled("tls1_3") || (disabled("ec") && disabled("dh"));
  236. #Test 22: Insert signature_algorithms_cert that match normal sigalgs
  237. $testtype = SIGALGS_CERT_ALL;
  238. $proxy->clear();
  239. $proxy->filter(\&modify_sigalgs_cert_filter);
  240. $proxy->start();
  241. ok(TLSProxy::Message->success, "sigalgs_cert in TLSv1.3");
  242. #Test 23: Insert signature_algorithms_cert that forces PKCS#1 cert
  243. $testtype = SIGALGS_CERT_PKCS;
  244. $proxy->clear();
  245. $proxy->filter(\&modify_sigalgs_cert_filter);
  246. $proxy->start();
  247. ok(TLSProxy::Message->success, "sigalgs_cert in TLSv1.3 with PKCS#1 cert");
  248. #Test 24: Insert signature_algorithms_cert that fails
  249. $testtype = SIGALGS_CERT_INVALID;
  250. $proxy->clear();
  251. $proxy->filter(\&modify_sigalgs_cert_filter);
  252. $proxy->start();
  253. ok(TLSProxy::Message->fail, "No matching certificate for sigalgs_cert");
  254. #Test 25: Send an unrecognized signature_algorithms_cert
  255. # We should be able to skip over the unrecognized value and use a
  256. # valid one that appears later in the list.
  257. $proxy->clear();
  258. $proxy->filter(\&inject_unrecognized_sigalg);
  259. $proxy->clientflags("-tls1_3");
  260. # Use -xcert to get SSL_check_chain() to run in the cert_cb. This is
  261. # needed to trigger (e.g.) CVE-2020-1967
  262. $proxy->serverflags("" .
  263. " -xcert " . srctop_file("test", "certs", "servercert.pem") .
  264. " -xkey " . srctop_file("test", "certs", "serverkey.pem") .
  265. " -xchain " . srctop_file("test", "certs", "rootcert.pem"));
  266. $testtype = UNRECOGNIZED_SIGALGS_CERT;
  267. $proxy->start();
  268. ok(TLSProxy::Message->success(), "Unrecognized sigalg_cert in ClientHello");
  269. #Test 26: Send an unrecognized signature_algorithms
  270. # We should be able to skip over the unrecognized value and use a
  271. # valid one that appears later in the list.
  272. $proxy->clear();
  273. $proxy->filter(\&inject_unrecognized_sigalg);
  274. $proxy->clientflags("-tls1_3");
  275. $proxy->serverflags("" .
  276. " -xcert " . srctop_file("test", "certs", "servercert.pem") .
  277. " -xkey " . srctop_file("test", "certs", "serverkey.pem") .
  278. " -xchain " . srctop_file("test", "certs", "rootcert.pem"));
  279. $testtype = UNRECOGNIZED_SIGALG;
  280. $proxy->start();
  281. ok(TLSProxy::Message->success(), "Unrecognized sigalg in ClientHello");
  282. }
  283. sub sigalgs_filter
  284. {
  285. my $proxy = shift;
  286. # We're only interested in the initial ClientHello
  287. if ($proxy->flight != 0) {
  288. return;
  289. }
  290. foreach my $message (@{$proxy->message_list}) {
  291. if ($message->mt == TLSProxy::Message::MT_CLIENT_HELLO) {
  292. if ($testtype == NO_SIG_ALGS_EXT) {
  293. $message->delete_extension(TLSProxy::Message::EXT_SIG_ALGS);
  294. } else {
  295. my $sigalg;
  296. if ($testtype == EMPTY_SIG_ALGS_EXT) {
  297. $sigalg = pack "C2", 0x00, 0x00;
  298. } elsif ($testtype == NO_KNOWN_SIG_ALGS) {
  299. $sigalg = pack "C4", 0x00, 0x02, 0xff, 0xff;
  300. } elsif ($testtype == NO_PSS_SIG_ALGS) {
  301. #No PSS sig algs - just send rsa_pkcs1_sha256
  302. $sigalg = pack "C4", 0x00, 0x02, 0x04, 0x01;
  303. } else {
  304. #PSS sig algs only - just send rsa_pss_rsae_sha256
  305. $sigalg = pack "C4", 0x00, 0x02, 0x08, 0x04;
  306. }
  307. $message->set_extension(TLSProxy::Message::EXT_SIG_ALGS, $sigalg);
  308. }
  309. $message->repack();
  310. }
  311. }
  312. }
  313. sub modify_sigalgs_filter
  314. {
  315. my $proxy = shift;
  316. # We're only interested in the initial ClientHello
  317. return if ($proxy->flight != 0);
  318. foreach my $message (@{$proxy->message_list}) {
  319. my $ext;
  320. my @algs;
  321. if ($message->mt == TLSProxy::Message::MT_CLIENT_HELLO) {
  322. if ($testtype == PURE_SIGALGS) {
  323. my $ok = 1;
  324. $ext = $message->extension_data->{TLSProxy::Message::EXT_SIG_ALGS};
  325. @algs = unpack('S>*', $ext);
  326. # unpack will unpack the length as well
  327. shift @algs;
  328. foreach (@algs) {
  329. if ($_ == TLSProxy::Message::SIG_ALG_DSA_SHA256
  330. || $_ == TLSProxy::Message::SIG_ALG_DSA_SHA384
  331. || $_ == TLSProxy::Message::SIG_ALG_DSA_SHA512
  332. || $_ == TLSProxy::Message::OSSL_SIG_ALG_DSA_SHA224
  333. || $_ == TLSProxy::Message::SIG_ALG_RSA_PKCS1_SHA1
  334. || $_ == TLSProxy::Message::SIG_ALG_DSA_SHA1
  335. || $_ == TLSProxy::Message::SIG_ALG_ECDSA_SHA1) {
  336. $ok = 0;
  337. }
  338. }
  339. $sha1_status = $dsa_status = $sha224_status = 1 if ($ok);
  340. } elsif ($testtype == COMPAT_SIGALGS) {
  341. $ext = $message->extension_data->{TLSProxy::Message::EXT_SIG_ALGS};
  342. @algs = unpack('S>*', $ext);
  343. # unpack will unpack the length as well
  344. shift @algs;
  345. foreach (@algs) {
  346. if ($_ == TLSProxy::Message::SIG_ALG_DSA_SHA256
  347. || $_ == TLSProxy::Message::SIG_ALG_DSA_SHA384
  348. || $_ == TLSProxy::Message::SIG_ALG_DSA_SHA512) {
  349. $dsa_status = 1;
  350. }
  351. if ($_ == TLSProxy::Message::SIG_ALG_RSA_PKCS1_SHA1
  352. || $_ == TLSProxy::Message::SIG_ALG_DSA_SHA1
  353. || $_ == TLSProxy::Message::SIG_ALG_ECDSA_SHA1) {
  354. $sha1_status = 1;
  355. }
  356. if ($_ == TLSProxy::Message::OSSL_SIG_ALG_RSA_PKCS1_SHA224
  357. || $_ == TLSProxy::Message::OSSL_SIG_ALG_DSA_SHA224
  358. || $_ == TLSProxy::Message::OSSL_SIG_ALG_ECDSA_SHA224) {
  359. $sha224_status = 1;
  360. }
  361. }
  362. }
  363. }
  364. }
  365. }
  366. sub modify_sigalgs_cert_filter
  367. {
  368. my $proxy = shift;
  369. # We're only interested in the initial ClientHello
  370. if ($proxy->flight != 0) {
  371. return;
  372. }
  373. foreach my $message (@{$proxy->message_list}) {
  374. if ($message->mt == TLSProxy::Message::MT_CLIENT_HELLO) {
  375. my $sigs;
  376. # two byte length at front of sigs, then two-byte sigschemes
  377. if ($testtype == SIGALGS_CERT_ALL) {
  378. $sigs = pack "C26", 0x00, 0x18,
  379. # rsa_pkcs_sha{256,512} rsa_pss_rsae_sha{256,512}
  380. 0x04, 0x01, 0x06, 0x01, 0x08, 0x04, 0x08, 0x06,
  381. # ed25518 ed448 rsa_pss_pss_sha{256,512}
  382. 0x08, 0x07, 0x08, 0x08, 0x08, 0x09, 0x08, 0x0b,
  383. # ecdsa_secp{256,512} rsa+sha1 ecdsa+sha1
  384. 0x04, 0x03, 0x06, 0x03, 0x02, 0x01, 0x02, 0x03;
  385. } elsif ($testtype == SIGALGS_CERT_PKCS) {
  386. $sigs = pack "C10", 0x00, 0x08,
  387. # rsa_pkcs_sha{256,384,512,1}
  388. 0x04, 0x01, 0x05, 0x01, 0x06, 0x01, 0x02, 0x01;
  389. } elsif ($testtype == SIGALGS_CERT_INVALID) {
  390. $sigs = pack "C4", 0x00, 0x02,
  391. # unregistered codepoint
  392. 0xb2, 0x6f;
  393. }
  394. $message->set_extension(TLSProxy::Message::EXT_SIG_ALGS_CERT, $sigs);
  395. $message->repack();
  396. }
  397. }
  398. }
  399. sub modify_cert_verify_sigalg
  400. {
  401. my $proxy = shift;
  402. # We're only interested in the CertificateVerify
  403. if ($proxy->flight != 1) {
  404. return;
  405. }
  406. foreach my $message (@{$proxy->message_list}) {
  407. if ($message->mt == TLSProxy::Message::MT_CERTIFICATE_VERIFY) {
  408. $message->sigalg(TLSProxy::Message::SIG_ALG_RSA_PSS_PSS_SHA256);
  409. $message->repack();
  410. }
  411. }
  412. }
  413. sub inject_unrecognized_sigalg
  414. {
  415. my $proxy = shift;
  416. my $type;
  417. # We're only interested in the initial ClientHello
  418. if ($proxy->flight != 0) {
  419. return;
  420. }
  421. if ($testtype == UNRECOGNIZED_SIGALGS_CERT) {
  422. $type = TLSProxy::Message::EXT_SIG_ALGS_CERT;
  423. } elsif ($testtype == UNRECOGNIZED_SIGALG) {
  424. $type = TLSProxy::Message::EXT_SIG_ALGS;
  425. } else {
  426. return;
  427. }
  428. my $ext = pack "C8",
  429. 0x00, 0x06, #Extension length
  430. 0xfe, 0x18, #private use
  431. 0x04, 0x01, #rsa_pkcs1_sha256
  432. 0x08, 0x04; #rsa_pss_rsae_sha256;
  433. my $message = ${$proxy->message_list}[0];
  434. $message->set_extension($type, $ext);
  435. $message->repack;
  436. }