blob: 83d37da787a2b9c2a3dc42dc56859c7c6fb39712 [file] [log] [blame]
Alexander Afanasyev574aa862017-01-10 19:53:28 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Junxiao Shi2bea5c42017-08-14 20:10:32 +00002/*
Davide Pesaventof6b45892023-03-13 15:00:51 -04003 * Copyright (c) 2013-2023 Regents of the University of California.
Alexander Afanasyev574aa862017-01-10 19:53:28 -08004 *
5 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6 *
7 * ndn-cxx library is free software: you can redistribute it and/or modify it under the
8 * terms of the GNU Lesser General Public License as published by the Free Software
9 * Foundation, either version 3 of the License, or (at your option) any later version.
10 *
11 * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14 *
15 * You should have received copies of the GNU General Public License and GNU Lesser
16 * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20 */
21
Davide Pesavento7e780642018-11-24 15:51:34 -050022#include "ndn-cxx/security/verification-helpers.hpp"
23#include "ndn-cxx/security/transform/public-key.hpp"
24// #include "ndn-cxx/util/string-helper.hpp"
Alexander Afanasyev574aa862017-01-10 19:53:28 -080025
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050026#include "tests/key-chain-fixture.hpp"
27#include "tests/test-common.hpp"
Alexander Afanasyev574aa862017-01-10 19:53:28 -080028
Davide Pesavento80d671f2022-06-08 04:04:52 -040029#include <openssl/opensslv.h>
Davide Pesavento77d9e812019-06-03 22:05:54 -040030#include <boost/mpl/vector.hpp>
Alexander Afanasyev574aa862017-01-10 19:53:28 -080031
32namespace ndn {
33namespace security {
34namespace tests {
35
36using namespace ndn::tests;
37
38BOOST_AUTO_TEST_SUITE(Security)
39BOOST_AUTO_TEST_SUITE(TestVerificationHelpers)
40
Eric Newberryb74bbda2020-06-18 19:33:58 -070041// // Use this test case to regenerate the dataset if the signature format changes
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050042// BOOST_FIXTURE_TEST_CASE(Generator, KeyChainFixture)
Alexander Afanasyev574aa862017-01-10 19:53:28 -080043// {
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050044// Identity wrongIdentity = m_keyChain.createIdentity("/Security/TestVerificationHelpers/Wrong");
Davide Pesavento809f7542021-03-24 18:53:05 -040045// const std::map<std::string, SigningInfo> identities = {
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050046// {"Ecdsa", signingByIdentity(m_keyChain.createIdentity("/Security/TestVerificationHelpers/EC", EcKeyParams()))},
47// {"Rsa", signingByIdentity(m_keyChain.createIdentity("/Security/TestVerificationHelpers/RSA", RsaKeyParams()))},
Alexander Afanasyev574aa862017-01-10 19:53:28 -080048// {"Sha256", signingWithSha256()}
49// };
50
Davide Pesavento258d51a2022-02-27 21:26:28 -050051// auto print = [] (const std::string& name, span<const uint8_t> buf) {
Davide Pesaventofbea4fc2022-02-08 07:26:04 -050052// std::cout << " const Block " + name + "{{\n ";
Alexander Afanasyev574aa862017-01-10 19:53:28 -080053
Davide Pesavento258d51a2022-02-27 21:26:28 -050054// std::string hex = toHex(buf);
Alexander Afanasyev574aa862017-01-10 19:53:28 -080055
56// for (size_t i = 0; i < hex.size(); i++) {
57// if (i > 0 && i % 32 == 0)
58// std::cout << "\n ";
59
60// std::cout << "0x" << hex[i];
61// std::cout << hex[++i];
62
63// if ((i + 1) != hex.size())
64// std::cout << ", ";
65// }
Davide Pesaventofbea4fc2022-02-08 07:26:04 -050066// std::cout << "\n }};";
Alexander Afanasyev574aa862017-01-10 19:53:28 -080067// };
68
69// for (const auto& i : identities) {
70// const std::string& type = i.first;
71// const SigningInfo& signingInfo = i.second;
72
73// std::cout << "struct " + type + "Dataset\n{\n";
74// std::cout << " const std::string name = \"" << type << "\";\n";
75
Junxiao Shife1239a2017-01-27 20:36:12 +000076// if (signingInfo.getSignerType() == SigningInfo::SIGNER_TYPE_ID) {
Davide Pesavento258d51a2022-02-27 21:26:28 -050077// print("cert", signingInfo.getPibIdentity().getDefaultKey().getDefaultCertificate().wireEncode());
Alexander Afanasyev574aa862017-01-10 19:53:28 -080078// }
79// else {
Davide Pesavento258d51a2022-02-27 21:26:28 -050080// print("cert", {});
Alexander Afanasyev574aa862017-01-10 19:53:28 -080081// }
82// std::cout << "\n";
83
84// // Create data that can be verified by cert
85// Data data(Name("/test/data").append(type));
86// m_keyChain.sign(data, signingInfo);
Davide Pesavento258d51a2022-02-27 21:26:28 -050087// print("goodData", data.wireEncode());
Alexander Afanasyev574aa862017-01-10 19:53:28 -080088// std::cout << "\n";
89
90// // Create data that cannot be verified by cert
91// m_keyChain.sign(data, signingByIdentity(wrongIdentity));
Davide Pesavento258d51a2022-02-27 21:26:28 -050092// print("badSigData", data.wireEncode());
Alexander Afanasyev574aa862017-01-10 19:53:28 -080093// std::cout << "\n";
94
95// // Create interest that can be verified by cert
Eric Newberryb74bbda2020-06-18 19:33:58 -070096// Interest interest1(Name("/test/interest").append(type));
97// SigningInfo signingInfoV03(signingInfo);
98// signingInfoV03.setSignedInterestFormat(SignedInterestFormat::V03);
Eric Newberryb74bbda2020-06-18 19:33:58 -070099// interest1.setNonce(0xF72C8A4B);
100// m_keyChain.sign(interest1, signingInfoV03);
Davide Pesavento258d51a2022-02-27 21:26:28 -0500101// print("goodInterest", interest1.wireEncode());
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800102// std::cout << "\n";
103
104// // Create interest that cannot be verified by cert
Eric Newberryb74bbda2020-06-18 19:33:58 -0700105// m_keyChain.sign(interest1, signingByIdentity(wrongIdentity)
106// .setSignedInterestFormat(SignedInterestFormat::V03));
Davide Pesavento258d51a2022-02-27 21:26:28 -0500107// print("badSigInterest", interest1.wireEncode());
Eric Newberryb74bbda2020-06-18 19:33:58 -0700108// std::cout << "\n";
109
110// // Create interest that can be verified by cert (old signed Interest format)
111// Interest interest2(Name("/test/interest").append(type));
112// SigningInfo signingInfoV02(signingInfo);
113// signingInfoV02.setSignedInterestFormat(SignedInterestFormat::V03);
Eric Newberryb74bbda2020-06-18 19:33:58 -0700114// interest2.setNonce(0xF72C8A4B);
115// m_keyChain.sign(interest2, signingInfoV02);
Davide Pesavento258d51a2022-02-27 21:26:28 -0500116// print("goodInterestOldFormat", interest2.wireEncode());
Eric Newberryb74bbda2020-06-18 19:33:58 -0700117// std::cout << "\n";
118
119// // Create interest that cannot be verified by cert (old signed Interest format)
120// m_keyChain.sign(interest2, signingByIdentity(wrongIdentity)
121// .setSignedInterestFormat(SignedInterestFormat::V02));
Davide Pesavento258d51a2022-02-27 21:26:28 -0500122// print("badSigInterestOldFormat", interest2.wireEncode());
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800123// std::cout << "\n};\n\n";
124// }
125// }
126
127struct EcdsaDataset
128{
129 const std::string name = "Ecdsa";
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500130 const Block cert{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700131 0x06, 0xFD, 0x01, 0x62, 0x07, 0x47, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800132 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
133 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700134 0x45, 0x59, 0x08, 0x08, 0xA5, 0x8F, 0x5F, 0x7F, 0x18, 0x1A, 0x98, 0x14, 0x08, 0x04, 0x73, 0x65,
135 0x6C, 0x66, 0x08, 0x09, 0xFD, 0x00, 0x00, 0x01, 0x72, 0xCE, 0xA8, 0xE7, 0x53, 0x14, 0x09, 0x18,
136 0x01, 0x02, 0x19, 0x04, 0x00, 0x36, 0xEE, 0x80, 0x15, 0x5B, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07,
137 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01,
138 0x07, 0x03, 0x42, 0x00, 0x04, 0x15, 0x94, 0xDF, 0xBF, 0x2D, 0x83, 0x2C, 0x1F, 0xB7, 0x9D, 0x55,
139 0x9A, 0x6A, 0xC2, 0xDB, 0x03, 0xE9, 0xB2, 0x6B, 0x77, 0x6D, 0xF6, 0x42, 0x81, 0x2F, 0xC8, 0xDE,
140 0x3F, 0x8B, 0xF4, 0x27, 0x1C, 0x4F, 0xE9, 0x47, 0x0C, 0x44, 0x83, 0x52, 0xA0, 0xA2, 0x4E, 0x52,
141 0x49, 0xC5, 0xAD, 0x2D, 0x9B, 0x9C, 0xAE, 0xF5, 0x4C, 0x2A, 0xB5, 0xC4, 0xF5, 0xFB, 0xF3, 0x93,
142 0xD4, 0x86, 0x61, 0xE6, 0x70, 0x16, 0x67, 0x1B, 0x01, 0x03, 0x1C, 0x38, 0x07, 0x36, 0x08, 0x08,
143 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
144 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
145 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xA5, 0x8F, 0x5F, 0x7F,
146 0x18, 0x1A, 0x98, 0x14, 0xFD, 0x00, 0xFD, 0x26, 0xFD, 0x00, 0xFE, 0x0F, 0x31, 0x39, 0x37, 0x30,
147 0x30, 0x31, 0x30, 0x31, 0x54, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xFD, 0x00, 0xFF, 0x0F, 0x32,
148 0x30, 0x34, 0x30, 0x30, 0x36, 0x31, 0x34, 0x54, 0x32, 0x32, 0x31, 0x37, 0x35, 0x35, 0x17, 0x46,
149 0x30, 0x44, 0x02, 0x20, 0x4B, 0xF7, 0x85, 0xB8, 0x01, 0x7D, 0x65, 0x02, 0x6C, 0xFB, 0x69, 0x00,
150 0x8B, 0x4D, 0xCC, 0x0F, 0xB5, 0x87, 0xF8, 0x4C, 0x69, 0xE0, 0x7C, 0x16, 0xCC, 0x52, 0xB2, 0x29,
151 0x6B, 0x24, 0xF5, 0x7F, 0x02, 0x20, 0x1C, 0x88, 0xDE, 0x32, 0x3F, 0x1A, 0xE6, 0x60, 0xA2, 0x29,
152 0x94, 0xD9, 0x05, 0x8F, 0x57, 0x14, 0xD6, 0x17, 0x3C, 0x78, 0xBF, 0x85, 0xF5, 0x1D, 0xCC, 0x03,
153 0x35, 0x9E, 0xC9, 0xA9, 0x6B, 0x09
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500154 }};
155 const Block goodData{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700156 0x06, 0xA2, 0x07, 0x13, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
157 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x14, 0x00, 0x15, 0x00, 0x16, 0x3D, 0x1B, 0x01, 0x03,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800158 0x1C, 0x38, 0x07, 0x36, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17,
159 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E,
160 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, 0x45, 0x59,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700161 0x08, 0x08, 0xA5, 0x8F, 0x5F, 0x7F, 0x18, 0x1A, 0x98, 0x14, 0x17, 0x48, 0x30, 0x46, 0x02, 0x21,
162 0x00, 0xD2, 0x35, 0xAD, 0xA9, 0xE6, 0x1E, 0x0F, 0xF3, 0xDE, 0x1D, 0xEA, 0x18, 0xCA, 0xEE, 0x5D,
163 0x05, 0xD1, 0xE0, 0x6A, 0x1E, 0xA5, 0x1A, 0xD6, 0xE6, 0x88, 0xB3, 0x24, 0xA9, 0xD5, 0x97, 0x4D,
164 0xC3, 0x02, 0x21, 0x00, 0xB5, 0xA3, 0x87, 0xD8, 0x9B, 0xB6, 0x92, 0xAD, 0x19, 0x84, 0xAE, 0x4D,
165 0xF5, 0x64, 0xEC, 0x1C, 0xF2, 0xA0, 0xB7, 0x4D, 0x6B, 0x74, 0xFF, 0x39, 0x38, 0xFD, 0x5D, 0x9D,
166 0x46, 0xE0, 0xD2, 0xB4
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500167 }};
168 const Block badSigData{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700169 0x06, 0xA5, 0x07, 0x13, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
170 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x14, 0x00, 0x15, 0x00, 0x16, 0x40, 0x1B, 0x01, 0x03,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800171 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17,
172 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E,
173 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700174 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x17, 0x48, 0x30,
175 0x46, 0x02, 0x21, 0x00, 0xBB, 0x15, 0xAC, 0x92, 0xFB, 0x7D, 0x6F, 0x6C, 0x90, 0xC9, 0x45, 0x71,
176 0x97, 0x39, 0xCD, 0x8C, 0x30, 0xA0, 0x8C, 0x69, 0xCA, 0x39, 0xDB, 0xE5, 0xC2, 0x95, 0x55, 0xB4,
177 0x13, 0xB4, 0xB8, 0x95, 0x02, 0x21, 0x00, 0xDA, 0x54, 0x99, 0xF8, 0xE5, 0xC1, 0x74, 0xAC, 0xE0,
178 0xF2, 0xDF, 0x0D, 0xC5, 0xE1, 0xCF, 0x99, 0x28, 0x6C, 0xB0, 0x2D, 0x55, 0xC8, 0x74, 0x63, 0x56,
179 0x2A, 0x1A, 0xB0, 0x00, 0xBD, 0xFF, 0xC5
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500180 }};
181 const Block goodInterest{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700182 0x05, 0xCA, 0x07, 0x39, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
183 0x72, 0x65, 0x73, 0x74, 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x02, 0x20, 0x8F, 0x41, 0x49,
184 0x40, 0xDA, 0x38, 0xC1, 0x0E, 0x75, 0x5A, 0x6D, 0x4A, 0xD4, 0xFC, 0xE2, 0xDF, 0xBA, 0x52, 0xAF,
185 0x0C, 0x9E, 0xEB, 0xD6, 0xC5, 0xD1, 0x1B, 0x51, 0x43, 0xBD, 0x19, 0xA7, 0x62, 0x0A, 0x04, 0xF7,
186 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3D, 0x1B, 0x01, 0x03, 0x1C, 0x38, 0x07, 0x36, 0x08, 0x08,
187 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
188 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
189 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xA5, 0x8F, 0x5F, 0x7F,
190 0x18, 0x1A, 0x98, 0x14, 0x2E, 0x46, 0x30, 0x44, 0x02, 0x20, 0x14, 0x1A, 0xF5, 0x9C, 0xD2, 0x3F,
191 0xA9, 0x71, 0x3B, 0x37, 0xD7, 0x97, 0xE6, 0x29, 0x12, 0x40, 0x44, 0x7B, 0xF1, 0x98, 0x03, 0xC1,
192 0xDB, 0xEA, 0x3A, 0x71, 0x83, 0x0D, 0xC4, 0x26, 0xB7, 0x24, 0x02, 0x20, 0x0F, 0x14, 0x10, 0xDB,
193 0xDB, 0x24, 0xCB, 0xB3, 0xD2, 0x4B, 0x45, 0x6D, 0xA0, 0xBB, 0x4B, 0x87, 0xC1, 0x59, 0x9F, 0xC8,
194 0xBE, 0x75, 0xF5, 0xCC, 0xCB, 0xD2, 0x4F, 0xD8, 0x87, 0x26, 0x51, 0xBF
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500195 }};
196 const Block badSigInterest{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700197 0x05, 0xCF, 0x07, 0x39, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
198 0x72, 0x65, 0x73, 0x74, 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x02, 0x20, 0x53, 0x14, 0x5E,
199 0xA3, 0x31, 0x41, 0xD8, 0xA1, 0x10, 0x06, 0x3C, 0x8E, 0xF3, 0x51, 0xA0, 0xC2, 0x8A, 0xBC, 0xFC,
200 0x01, 0x5F, 0x12, 0x12, 0x11, 0x27, 0xD2, 0x18, 0xE5, 0xE7, 0xE4, 0xBD, 0x57, 0x0A, 0x04, 0xF7,
201 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08,
202 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
203 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
204 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3,
205 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x2E, 0x48, 0x30, 0x46, 0x02, 0x21, 0x00, 0xC9, 0x69,
206 0xD8, 0xB8, 0x59, 0x38, 0x31, 0x0B, 0x44, 0x66, 0xAE, 0x1C, 0x1C, 0x88, 0x2A, 0x95, 0xD0, 0xE5,
207 0x31, 0x61, 0xA6, 0x94, 0x1F, 0x9B, 0xAD, 0x47, 0x1C, 0x9D, 0x56, 0x37, 0x50, 0xBE, 0x02, 0x21,
208 0x00, 0xC7, 0x23, 0x25, 0xF7, 0xFA, 0x6A, 0x2D, 0x3D, 0xF4, 0xD8, 0xDB, 0xE9, 0x76, 0x6A, 0x63,
209 0xD4, 0x11, 0x17, 0x4A, 0xDB, 0x7F, 0x85, 0x52, 0x97, 0xFC, 0x5B, 0x0B, 0x1B, 0xBA, 0xE5, 0xED,
210 0x9A
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500211 }};
212 const Block goodInterestOldFormat{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700213 0x05, 0xCB, 0x07, 0x39, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
214 0x72, 0x65, 0x73, 0x74, 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x02, 0x20, 0xDB, 0x6D, 0x5E,
215 0xA7, 0xBF, 0xAF, 0xEC, 0xA0, 0xC6, 0x20, 0x4E, 0xF2, 0x04, 0xF8, 0xFF, 0x39, 0x2A, 0x5F, 0xE6,
216 0x5F, 0x5B, 0xCE, 0x02, 0xA6, 0xBE, 0x82, 0x3F, 0xD2, 0x26, 0x47, 0x92, 0x62, 0x0A, 0x04, 0xF7,
217 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3D, 0x1B, 0x01, 0x03, 0x1C, 0x38, 0x07, 0x36, 0x08, 0x08,
218 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
219 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
220 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xA5, 0x8F, 0x5F, 0x7F,
221 0x18, 0x1A, 0x98, 0x14, 0x2E, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xCA, 0xFD, 0x19, 0x4C, 0x6C,
222 0x1B, 0x95, 0xD4, 0x2B, 0x15, 0x01, 0xE3, 0x87, 0x1F, 0xD7, 0xF2, 0x3D, 0x3E, 0x2E, 0x64, 0xAA,
223 0x60, 0x63, 0x51, 0xB3, 0x52, 0xBC, 0x6D, 0x24, 0x0C, 0x6D, 0x38, 0x02, 0x20, 0x0E, 0x21, 0xF1,
224 0x51, 0x39, 0x2D, 0x4A, 0x45, 0x05, 0x45, 0xFA, 0x85, 0xA7, 0xCC, 0x00, 0xFE, 0x89, 0x8A, 0xD6,
225 0xD7, 0x34, 0x0D, 0x31, 0x6A, 0x94, 0xAE, 0x1F, 0xD8, 0x07, 0xF1, 0xDF, 0x80
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500226 }};
227 const Block badSigInterestOldFormat{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700228 0x05, 0xFD, 0x01, 0x5B, 0x07, 0xC9, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E,
229 0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x02, 0x20, 0xDB,
230 0x6D, 0x5E, 0xA7, 0xBF, 0xAF, 0xEC, 0xA0, 0xC6, 0x20, 0x4E, 0xF2, 0x04, 0xF8, 0xFF, 0x39, 0x2A,
231 0x5F, 0xE6, 0x5F, 0x5B, 0xCE, 0x02, 0xA6, 0xBE, 0x82, 0x3F, 0xD2, 0x26, 0x47, 0x92, 0x62, 0x08,
232 0x42, 0x16, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75,
233 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69,
234 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57,
235 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87,
236 0x5D, 0x6E, 0x43, 0x08, 0x4A, 0x17, 0x48, 0x30, 0x46, 0x02, 0x21, 0x00, 0xD0, 0x33, 0x6A, 0x5D,
237 0x8A, 0x1B, 0x04, 0xF9, 0xE5, 0xEE, 0x3A, 0x5A, 0x73, 0x63, 0xBF, 0xD4, 0x39, 0x07, 0x53, 0xA9,
238 0xF5, 0xBB, 0xB3, 0xD4, 0x7E, 0x65, 0x7B, 0xCB, 0x5A, 0xB1, 0x4B, 0xCE, 0x02, 0x21, 0x00, 0xD4,
239 0xA0, 0x7F, 0x40, 0x7A, 0xCF, 0xA5, 0xAD, 0x11, 0x44, 0x2F, 0xB1, 0xE0, 0x48, 0x25, 0x0B, 0x1C,
240 0x84, 0x76, 0x1F, 0x1B, 0x28, 0x4B, 0x36, 0x5F, 0x23, 0x3F, 0x91, 0xB3, 0xEF, 0x38, 0x2F, 0x0A,
241 0x04, 0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3D, 0x1B, 0x01, 0x03, 0x1C, 0x38, 0x07, 0x36,
242 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74,
243 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70,
244 0x65, 0x72, 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xA5, 0x8F,
245 0x5F, 0x7F, 0x18, 0x1A, 0x98, 0x14, 0x2E, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xCA, 0xFD, 0x19,
246 0x4C, 0x6C, 0x1B, 0x95, 0xD4, 0x2B, 0x15, 0x01, 0xE3, 0x87, 0x1F, 0xD7, 0xF2, 0x3D, 0x3E, 0x2E,
247 0x64, 0xAA, 0x60, 0x63, 0x51, 0xB3, 0x52, 0xBC, 0x6D, 0x24, 0x0C, 0x6D, 0x38, 0x02, 0x20, 0x0E,
248 0x21, 0xF1, 0x51, 0x39, 0x2D, 0x4A, 0x45, 0x05, 0x45, 0xFA, 0x85, 0xA7, 0xCC, 0x00, 0xFE, 0x89,
249 0x8A, 0xD6, 0xD7, 0x34, 0x0D, 0x31, 0x6A, 0x94, 0xAE, 0x1F, 0xD8, 0x07, 0xF1, 0xDF, 0x80
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500250 }};
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800251};
252
253struct RsaDataset
254{
255 const std::string name = "Rsa";
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500256 const Block cert{{
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800257 0x06, 0xFD, 0x02, 0xED, 0x07, 0x48, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79,
258 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
259 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700260 0x4B, 0x45, 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE, 0xDB, 0xE7, 0x2E, 0xC6, 0xC7, 0x08, 0x04, 0x73,
261 0x65, 0x6C, 0x66, 0x08, 0x09, 0xFD, 0x00, 0x00, 0x01, 0x72, 0xCE, 0xA8, 0xE7, 0xA4, 0x14, 0x09,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800262 0x18, 0x01, 0x02, 0x19, 0x04, 0x00, 0x36, 0xEE, 0x80, 0x15, 0xFD, 0x01, 0x26, 0x30, 0x82, 0x01,
263 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700264 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xED, 0x32,
265 0x03, 0x4A, 0xC1, 0xC4, 0x73, 0xA7, 0xC3, 0x3C, 0xB3, 0x09, 0x62, 0xF7, 0xA7, 0x5F, 0x83, 0x98,
266 0xBD, 0x8A, 0x9F, 0xB3, 0x02, 0x02, 0x53, 0xF1, 0x62, 0x78, 0xE0, 0x08, 0x42, 0x48, 0xC7, 0x81,
267 0x2E, 0xA5, 0xD4, 0x9E, 0x7D, 0xD1, 0x38, 0x51, 0x8C, 0xAB, 0x18, 0x87, 0xC5, 0x0B, 0x57, 0x1C,
268 0x01, 0xD7, 0xA9, 0x4B, 0xA8, 0xD8, 0xEB, 0x96, 0x95, 0xAC, 0x09, 0xBC, 0xCE, 0xF4, 0x3E, 0xE5,
269 0x8D, 0x72, 0x81, 0x30, 0x30, 0xBA, 0xB7, 0xA2, 0x0D, 0xFE, 0x21, 0x2F, 0x97, 0x76, 0x59, 0x80,
270 0xC2, 0x92, 0x1B, 0x16, 0xF9, 0x15, 0xE3, 0xF5, 0xA0, 0x2C, 0x87, 0xAB, 0x88, 0x5B, 0x6E, 0x73,
271 0x36, 0xDB, 0xE4, 0xF0, 0x19, 0x78, 0x93, 0x26, 0xC3, 0x39, 0x33, 0x27, 0xBE, 0x06, 0x33, 0x84,
272 0x9C, 0xA8, 0x8A, 0xF7, 0x41, 0x82, 0xAD, 0xE4, 0x25, 0x86, 0xCC, 0x32, 0x1D, 0x5A, 0x8C, 0x52,
273 0x2F, 0x91, 0xD9, 0xD1, 0x31, 0x3F, 0x07, 0xF9, 0x43, 0xF9, 0xA8, 0xE7, 0x92, 0x70, 0xF4, 0xB0,
274 0x2F, 0xE1, 0x76, 0x91, 0x42, 0x9C, 0xB9, 0xF3, 0x69, 0x88, 0xD3, 0x36, 0x75, 0x5C, 0x13, 0x18,
275 0x85, 0xAA, 0x17, 0xCE, 0x5F, 0x0D, 0x49, 0xED, 0x79, 0xB2, 0x7F, 0x00, 0xF4, 0x5F, 0xD7, 0x29,
276 0xD2, 0xB3, 0x1E, 0xA6, 0xFC, 0x7E, 0x0C, 0xCD, 0x6A, 0x5F, 0xC6, 0x68, 0x46, 0x4C, 0x8A, 0x71,
277 0x57, 0x08, 0x86, 0xCD, 0xD4, 0xD2, 0x89, 0x37, 0x46, 0xAA, 0x79, 0xA9, 0x3A, 0x13, 0xB0, 0xA0,
278 0x63, 0x86, 0xA2, 0x18, 0xC6, 0xB3, 0x8C, 0x59, 0x5D, 0xF7, 0x6F, 0x77, 0xC3, 0x16, 0x42, 0xA7,
279 0x9A, 0x3F, 0xF9, 0x07, 0xB4, 0x5A, 0x7B, 0xE3, 0xA6, 0xF1, 0x76, 0xC5, 0x58, 0xB2, 0xC2, 0xAC,
280 0x7C, 0x02, 0x9A, 0xB2, 0xD1, 0x2B, 0xBC, 0x23, 0x11, 0x9F, 0xEB, 0x6F, 0xB4, 0x73, 0x02, 0x03,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800281 0x01, 0x00, 0x01, 0x16, 0x68, 0x1B, 0x01, 0x01, 0x1C, 0x39, 0x07, 0x37, 0x08, 0x08, 0x53, 0x65,
282 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69,
283 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700284 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE, 0xDB, 0xE7,
285 0x2E, 0xC6, 0xC7, 0xFD, 0x00, 0xFD, 0x26, 0xFD, 0x00, 0xFE, 0x0F, 0x31, 0x39, 0x37, 0x30, 0x30,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800286 0x31, 0x30, 0x31, 0x54, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xFD, 0x00, 0xFF, 0x0F, 0x32, 0x30,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700287 0x34, 0x30, 0x30, 0x36, 0x31, 0x34, 0x54, 0x32, 0x32, 0x31, 0x37, 0x35, 0x35, 0x17, 0xFD, 0x01,
288 0x00, 0x0F, 0x4D, 0x43, 0x2F, 0x6E, 0xCC, 0xB3, 0xAA, 0x8A, 0x50, 0xBB, 0x3D, 0x92, 0xE6, 0xB7,
289 0xFB, 0xD4, 0xEA, 0x20, 0xB4, 0xF8, 0xF0, 0xD8, 0x03, 0x45, 0xB3, 0xFB, 0x82, 0xCE, 0xDB, 0xCE,
290 0x1F, 0xC7, 0x61, 0x58, 0x9D, 0x33, 0xAD, 0xA8, 0xFC, 0xB9, 0x31, 0x7F, 0xCF, 0x8D, 0x9C, 0xDF,
291 0x4C, 0x29, 0x25, 0xD6, 0x78, 0x8F, 0xCC, 0xC4, 0xF9, 0xF8, 0x88, 0xA9, 0x66, 0x7E, 0xD9, 0x4A,
292 0xB2, 0x6F, 0x2A, 0x60, 0xB8, 0x43, 0xCC, 0x46, 0xC3, 0x88, 0x93, 0xC8, 0x0C, 0xD3, 0x87, 0x70,
293 0xDA, 0x59, 0x16, 0xF1, 0x37, 0xD0, 0xB5, 0xF0, 0x92, 0x9E, 0xBC, 0xAE, 0xA2, 0x3A, 0x96, 0xB1,
294 0x36, 0x26, 0x8E, 0x43, 0xA7, 0x33, 0xEB, 0x13, 0x8C, 0x57, 0x02, 0x20, 0xCB, 0x97, 0xB7, 0x78,
295 0x08, 0x58, 0x07, 0x77, 0x66, 0xE9, 0x5D, 0xCB, 0xCD, 0x1E, 0x0D, 0x36, 0x43, 0x23, 0x64, 0x8E,
296 0x48, 0x66, 0x60, 0xF6, 0xF4, 0x4C, 0xD6, 0x9E, 0xAF, 0x3C, 0xC6, 0x23, 0x03, 0x09, 0x8A, 0xB1,
297 0x26, 0xDA, 0x82, 0x6D, 0xA2, 0x3D, 0x0C, 0x36, 0x56, 0x76, 0x9A, 0x62, 0xBB, 0xDD, 0x0C, 0x91,
298 0xB3, 0x8D, 0x0D, 0x9B, 0x55, 0x17, 0xC3, 0xFA, 0x26, 0xC3, 0xE5, 0x77, 0xB3, 0x55, 0x5C, 0xB7,
299 0xC9, 0x74, 0x86, 0xD1, 0xEE, 0xDF, 0xEB, 0xAF, 0xC6, 0x4D, 0x42, 0x3F, 0x09, 0x6A, 0x44, 0x7F,
300 0xB9, 0xC1, 0xE9, 0xAB, 0xBF, 0xBA, 0xED, 0xDD, 0xE9, 0x09, 0x11, 0x8C, 0x03, 0x1E, 0x5A, 0xA6,
301 0x74, 0xF1, 0x39, 0x71, 0xF3, 0x71, 0x26, 0xD5, 0xF2, 0x87, 0xBC, 0x1A, 0x6D, 0xD2, 0x37, 0xC6,
302 0x3E, 0xFA, 0xE6, 0xB9, 0x8E, 0x08, 0x82, 0x50, 0xCA, 0xEE, 0x7F, 0x5D, 0x80, 0x65, 0xBA, 0x10,
303 0x1F, 0x24, 0xC1, 0x15, 0x78, 0xB7, 0x90, 0xE5, 0x3D, 0xDA, 0x0F, 0x0E, 0x03, 0x20, 0xC1, 0xEA,
304 0x85
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500305 }};
306 const Block goodData{{
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800307 0x06, 0xFD, 0x01, 0x5B, 0x07, 0x11, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61,
308 0x74, 0x61, 0x08, 0x03, 0x52, 0x73, 0x61, 0x14, 0x00, 0x15, 0x00, 0x16, 0x3E, 0x1B, 0x01, 0x01,
309 0x1C, 0x39, 0x07, 0x37, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17,
310 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E,
311 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, 0x4B, 0x45,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700312 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE, 0xDB, 0xE7, 0x2E, 0xC6, 0xC7, 0x17, 0xFD, 0x01, 0x00, 0x15,
313 0x5E, 0x36, 0xEB, 0x43, 0x60, 0x9E, 0x06, 0xC1, 0x2A, 0xC8, 0x92, 0xAC, 0x0B, 0xC9, 0x8D, 0xEB,
314 0x54, 0x4A, 0x3A, 0xC4, 0x88, 0x3C, 0x51, 0x67, 0x19, 0x93, 0x68, 0xC7, 0xD5, 0x70, 0xE7, 0x2C,
315 0xB1, 0x78, 0xEA, 0x6A, 0x84, 0x5A, 0x7A, 0x5E, 0xAA, 0x43, 0xE7, 0x09, 0x3E, 0xF8, 0xF1, 0x7C,
316 0x9C, 0xE7, 0x72, 0x2D, 0x7B, 0x77, 0xD0, 0xD9, 0x86, 0x6B, 0x05, 0xE9, 0xA7, 0x83, 0x7C, 0xAB,
317 0x16, 0xDF, 0x0D, 0x36, 0x37, 0x74, 0x6E, 0xBC, 0x42, 0x2F, 0xFE, 0xDE, 0x40, 0x03, 0x2B, 0xC0,
318 0x7E, 0xF8, 0x67, 0xD7, 0x38, 0xD7, 0xE8, 0x7C, 0xCF, 0xCE, 0x9D, 0x14, 0x39, 0xDE, 0xF1, 0x02,
319 0x9E, 0xC4, 0x9B, 0xD6, 0x46, 0xBA, 0x57, 0xF9, 0x76, 0xB2, 0x25, 0xD4, 0x0A, 0xB5, 0x31, 0x09,
320 0x36, 0x77, 0xF4, 0xDB, 0xC7, 0xD2, 0xD9, 0x14, 0xB0, 0x98, 0xAC, 0x48, 0x7C, 0x30, 0x90, 0xE2,
321 0x1E, 0xF1, 0xF5, 0xC5, 0x69, 0xE4, 0xA5, 0xBE, 0xF7, 0x9C, 0x74, 0x97, 0x97, 0xE6, 0xA4, 0x41,
322 0x75, 0xDF, 0x8D, 0xFB, 0x2E, 0x9E, 0xA0, 0x57, 0xBB, 0x96, 0xE5, 0x81, 0x9F, 0xF7, 0x95, 0x7B,
323 0x6A, 0x2C, 0xE3, 0xF8, 0x48, 0x0C, 0xB2, 0x3F, 0xB6, 0xCF, 0xB8, 0x7F, 0x08, 0x24, 0x77, 0x44,
324 0x9A, 0x7F, 0x34, 0x35, 0xFF, 0x68, 0x7E, 0x61, 0x2C, 0x09, 0xF9, 0x0A, 0xAD, 0xBE, 0x57, 0xD3,
325 0x2A, 0x2A, 0x9E, 0xE0, 0x8E, 0x5B, 0x79, 0x1C, 0x4C, 0x32, 0x8D, 0xFA, 0xBF, 0xEE, 0xBB, 0xA0,
326 0x4F, 0xD9, 0xEB, 0xC1, 0x5D, 0x53, 0x15, 0xBF, 0x8C, 0x7C, 0x6B, 0x22, 0xB9, 0x24, 0x70, 0xAE,
327 0x63, 0x13, 0x96, 0x3B, 0x2A, 0xDA, 0x7F, 0x64, 0x0D, 0x9E, 0xA7, 0x90, 0x20, 0x2A, 0x2A, 0xAB,
328 0xA9, 0xA6, 0xC9, 0xB2, 0x37, 0x8E, 0xE3, 0x09, 0xFD, 0xA3, 0x68, 0x06, 0xCB, 0x96, 0x80
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500329 }};
330 const Block badSigData{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700331 0x06, 0xA2, 0x07, 0x11, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800332 0x08, 0x03, 0x52, 0x73, 0x61, 0x14, 0x00, 0x15, 0x00, 0x16, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B,
333 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65,
334 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65,
335 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700336 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x17, 0x47, 0x30, 0x45, 0x02,
337 0x20, 0x15, 0xFC, 0x4C, 0xA4, 0xBA, 0x18, 0xF9, 0x6A, 0x92, 0xC8, 0xA9, 0x62, 0x96, 0x60, 0x39,
338 0x6B, 0x74, 0x4A, 0x7C, 0x38, 0x1A, 0x83, 0x33, 0xB2, 0x40, 0x03, 0x59, 0x2C, 0xA4, 0x1A, 0xD1,
339 0x1E, 0x02, 0x21, 0x00, 0xA5, 0x62, 0xA5, 0x04, 0x60, 0xBC, 0x96, 0x54, 0x2C, 0x9E, 0x6F, 0xA8,
340 0x1B, 0xDB, 0xF9, 0xF0, 0x7E, 0xFF, 0xED, 0x92, 0x3A, 0x4B, 0xDE, 0x3D, 0x20, 0x02, 0x7B, 0xD7,
341 0x1C, 0xD0, 0xAA, 0xAB
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500342 }};
343 const Block goodInterest{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700344 0x05, 0xFD, 0x01, 0x85, 0x07, 0x37, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E,
345 0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x08, 0x03, 0x52, 0x73, 0x61, 0x02, 0x20, 0x08, 0x39, 0xEE,
346 0x12, 0xF1, 0x10, 0xB7, 0x8B, 0x49, 0xF2, 0xE2, 0x54, 0x23, 0xFF, 0x66, 0xB3, 0x0F, 0xC6, 0x91,
347 0x89, 0x59, 0x99, 0x20, 0xAA, 0x06, 0xEA, 0x8F, 0xB3, 0x3A, 0x8F, 0xB3, 0xB1, 0x0A, 0x04, 0xF7,
348 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3E, 0x1B, 0x01, 0x01, 0x1C, 0x39, 0x07, 0x37, 0x08, 0x08,
349 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
350 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
351 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE,
352 0xDB, 0xE7, 0x2E, 0xC6, 0xC7, 0x2E, 0xFD, 0x01, 0x00, 0x54, 0xD8, 0xED, 0xAB, 0x63, 0xE0, 0x89,
353 0x9D, 0x31, 0x0B, 0xD7, 0x2F, 0xF6, 0x4C, 0x4B, 0xCE, 0x2A, 0xB9, 0x65, 0x55, 0x65, 0x15, 0x4F,
354 0x1B, 0x59, 0xFF, 0xF7, 0x10, 0xB8, 0xA6, 0x33, 0x88, 0xA6, 0xCF, 0x9B, 0x23, 0x7E, 0x48, 0x83,
355 0x60, 0x59, 0xF9, 0xB5, 0x7F, 0x68, 0x2B, 0x1E, 0x2F, 0x35, 0x3B, 0x48, 0x64, 0x15, 0xD8, 0xE1,
356 0x27, 0x1F, 0xDE, 0x0A, 0x27, 0xBE, 0x7A, 0xA6, 0xFE, 0x8B, 0x01, 0x7C, 0x94, 0xDC, 0x2D, 0x4B,
357 0x2E, 0x78, 0xA0, 0xF4, 0xA2, 0x9B, 0x63, 0x47, 0x5B, 0x8C, 0x57, 0x04, 0xF3, 0x92, 0x3F, 0x4C,
358 0x84, 0x70, 0x06, 0x16, 0xD2, 0xF0, 0x49, 0x9E, 0x4E, 0x2E, 0x9A, 0xC5, 0xB0, 0xC8, 0x0F, 0x4C,
359 0xB9, 0xD0, 0x37, 0x9F, 0xEB, 0x53, 0x68, 0x1B, 0xC9, 0xBF, 0x77, 0x12, 0xBD, 0x25, 0x23, 0x38,
360 0x56, 0x63, 0x22, 0xA4, 0x52, 0xA1, 0x00, 0x47, 0x08, 0xEB, 0xC7, 0x36, 0x33, 0x46, 0xC1, 0x92,
361 0x89, 0xE4, 0xC8, 0x52, 0x05, 0xB7, 0x01, 0x2B, 0x24, 0x04, 0x56, 0xC3, 0x8C, 0x1F, 0x18, 0x78,
362 0x73, 0x99, 0xFF, 0x7B, 0x0E, 0x92, 0x3D, 0x92, 0x61, 0xF1, 0xDC, 0x55, 0xDB, 0x55, 0x8B, 0xBA,
363 0xDB, 0xD9, 0x14, 0x7C, 0x7B, 0x9B, 0xDC, 0x90, 0x15, 0xC6, 0x59, 0x80, 0xE7, 0xFC, 0x03, 0x71,
364 0x7E, 0x35, 0x05, 0x30, 0xBE, 0xED, 0xC4, 0xB2, 0x2E, 0x39, 0xDB, 0xAA, 0x2A, 0x7E, 0x50, 0x37,
365 0x4D, 0xC8, 0x3F, 0x00, 0xD8, 0xE9, 0xF1, 0x9D, 0x57, 0x43, 0x2B, 0x1C, 0x5F, 0x09, 0x18, 0xA3,
366 0xE3, 0x11, 0x85, 0xCC, 0x0E, 0xAF, 0x56, 0x6B, 0xE1, 0xAC, 0xB3, 0x20, 0xF2, 0x47, 0xFE, 0x95,
367 0xC8, 0x71, 0x99, 0xCC, 0x52, 0x8A, 0x6F, 0xF1, 0x01, 0xD6, 0xE9, 0x2E, 0x6C, 0x27, 0xC3, 0xED,
368 0xE3, 0xF2, 0xDD, 0x78, 0xB4, 0x7F, 0xFA, 0xD0, 0xC2
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500369 }};
370 const Block badSigInterest{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700371 0x05, 0xCC, 0x07, 0x37, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
372 0x72, 0x65, 0x73, 0x74, 0x08, 0x03, 0x52, 0x73, 0x61, 0x02, 0x20, 0x64, 0xE3, 0x6F, 0xD5, 0x73,
373 0x21, 0xBC, 0xAB, 0xDE, 0xDE, 0x0F, 0x99, 0xCB, 0x49, 0x7F, 0x46, 0xE7, 0xF0, 0x7A, 0xF1, 0x2C,
374 0xF9, 0x36, 0xE0, 0xBD, 0x3A, 0x8A, 0x1C, 0x08, 0x6A, 0xD1, 0x21, 0x0A, 0x04, 0xF7, 0x2C, 0x8A,
375 0x4B, 0x24, 0x00, 0x2C, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65,
376 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69,
377 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08,
378 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A,
379 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x2E, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xC3, 0x9A, 0xDC, 0x5A,
380 0x59, 0x10, 0x4D, 0x29, 0x9A, 0x64, 0x8D, 0x18, 0xBD, 0x27, 0x73, 0xBB, 0x98, 0xAB, 0xE9, 0xF2,
381 0x4A, 0xBF, 0xC0, 0x5B, 0xA8, 0x05, 0xA2, 0xC8, 0x61, 0xC4, 0x2E, 0x64, 0x02, 0x20, 0x1F, 0x5E,
382 0xF5, 0x8E, 0xC9, 0xDC, 0x9E, 0x15, 0x1C, 0xFA, 0x58, 0x5F, 0xDF, 0xAE, 0xA0, 0xFD, 0xDA, 0x34,
383 0x21, 0xE0, 0xA8, 0x2D, 0x32, 0x47, 0x9E, 0x44, 0x83, 0x79, 0x23, 0x5F, 0xBE, 0x16
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500384 }};
385 const Block goodInterestOldFormat{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700386 0x05, 0xFD, 0x01, 0x85, 0x07, 0x37, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E,
387 0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x08, 0x03, 0x52, 0x73, 0x61, 0x02, 0x20, 0x08, 0x39, 0xEE,
388 0x12, 0xF1, 0x10, 0xB7, 0x8B, 0x49, 0xF2, 0xE2, 0x54, 0x23, 0xFF, 0x66, 0xB3, 0x0F, 0xC6, 0x91,
389 0x89, 0x59, 0x99, 0x20, 0xAA, 0x06, 0xEA, 0x8F, 0xB3, 0x3A, 0x8F, 0xB3, 0xB1, 0x0A, 0x04, 0xF7,
390 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3E, 0x1B, 0x01, 0x01, 0x1C, 0x39, 0x07, 0x37, 0x08, 0x08,
391 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
392 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
393 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE,
394 0xDB, 0xE7, 0x2E, 0xC6, 0xC7, 0x2E, 0xFD, 0x01, 0x00, 0x54, 0xD8, 0xED, 0xAB, 0x63, 0xE0, 0x89,
395 0x9D, 0x31, 0x0B, 0xD7, 0x2F, 0xF6, 0x4C, 0x4B, 0xCE, 0x2A, 0xB9, 0x65, 0x55, 0x65, 0x15, 0x4F,
396 0x1B, 0x59, 0xFF, 0xF7, 0x10, 0xB8, 0xA6, 0x33, 0x88, 0xA6, 0xCF, 0x9B, 0x23, 0x7E, 0x48, 0x83,
397 0x60, 0x59, 0xF9, 0xB5, 0x7F, 0x68, 0x2B, 0x1E, 0x2F, 0x35, 0x3B, 0x48, 0x64, 0x15, 0xD8, 0xE1,
398 0x27, 0x1F, 0xDE, 0x0A, 0x27, 0xBE, 0x7A, 0xA6, 0xFE, 0x8B, 0x01, 0x7C, 0x94, 0xDC, 0x2D, 0x4B,
399 0x2E, 0x78, 0xA0, 0xF4, 0xA2, 0x9B, 0x63, 0x47, 0x5B, 0x8C, 0x57, 0x04, 0xF3, 0x92, 0x3F, 0x4C,
400 0x84, 0x70, 0x06, 0x16, 0xD2, 0xF0, 0x49, 0x9E, 0x4E, 0x2E, 0x9A, 0xC5, 0xB0, 0xC8, 0x0F, 0x4C,
401 0xB9, 0xD0, 0x37, 0x9F, 0xEB, 0x53, 0x68, 0x1B, 0xC9, 0xBF, 0x77, 0x12, 0xBD, 0x25, 0x23, 0x38,
402 0x56, 0x63, 0x22, 0xA4, 0x52, 0xA1, 0x00, 0x47, 0x08, 0xEB, 0xC7, 0x36, 0x33, 0x46, 0xC1, 0x92,
403 0x89, 0xE4, 0xC8, 0x52, 0x05, 0xB7, 0x01, 0x2B, 0x24, 0x04, 0x56, 0xC3, 0x8C, 0x1F, 0x18, 0x78,
404 0x73, 0x99, 0xFF, 0x7B, 0x0E, 0x92, 0x3D, 0x92, 0x61, 0xF1, 0xDC, 0x55, 0xDB, 0x55, 0x8B, 0xBA,
405 0xDB, 0xD9, 0x14, 0x7C, 0x7B, 0x9B, 0xDC, 0x90, 0x15, 0xC6, 0x59, 0x80, 0xE7, 0xFC, 0x03, 0x71,
406 0x7E, 0x35, 0x05, 0x30, 0xBE, 0xED, 0xC4, 0xB2, 0x2E, 0x39, 0xDB, 0xAA, 0x2A, 0x7E, 0x50, 0x37,
407 0x4D, 0xC8, 0x3F, 0x00, 0xD8, 0xE9, 0xF1, 0x9D, 0x57, 0x43, 0x2B, 0x1C, 0x5F, 0x09, 0x18, 0xA3,
408 0xE3, 0x11, 0x85, 0xCC, 0x0E, 0xAF, 0x56, 0x6B, 0xE1, 0xAC, 0xB3, 0x20, 0xF2, 0x47, 0xFE, 0x95,
409 0xC8, 0x71, 0x99, 0xCC, 0x52, 0x8A, 0x6F, 0xF1, 0x01, 0xD6, 0xE9, 0x2E, 0x6C, 0x27, 0xC3, 0xED,
410 0xE3, 0xF2, 0xDD, 0x78, 0xB4, 0x7F, 0xFA, 0xD0, 0xC2
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500411 }};
412 const Block badSigInterestOldFormat{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700413 0x05, 0xFD, 0x02, 0x15, 0x07, 0xC7, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E,
414 0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x08, 0x03, 0x52, 0x73, 0x61, 0x02, 0x20, 0x08, 0x39, 0xEE,
415 0x12, 0xF1, 0x10, 0xB7, 0x8B, 0x49, 0xF2, 0xE2, 0x54, 0x23, 0xFF, 0x66, 0xB3, 0x0F, 0xC6, 0x91,
416 0x89, 0x59, 0x99, 0x20, 0xAA, 0x06, 0xEA, 0x8F, 0xB3, 0x3A, 0x8F, 0xB3, 0xB1, 0x08, 0x42, 0x16,
417 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800418 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700419 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F,
420 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E,
421 0x43, 0x08, 0x4A, 0x17, 0x48, 0x30, 0x46, 0x02, 0x21, 0x00, 0x9D, 0x24, 0x46, 0x3D, 0x37, 0xAE,
422 0x81, 0xB7, 0x7C, 0x2C, 0x86, 0x8A, 0x34, 0xEF, 0xC8, 0xC8, 0xB0, 0x18, 0x78, 0x3E, 0xA3, 0xE5,
423 0xED, 0x31, 0x93, 0x26, 0x73, 0x0E, 0x58, 0xE8, 0xF8, 0x47, 0x02, 0x21, 0x00, 0xFD, 0x82, 0xD2,
424 0x69, 0xEF, 0xB0, 0x72, 0xE8, 0xCA, 0x33, 0x43, 0xEB, 0x27, 0xB1, 0xDD, 0xB6, 0xD1, 0x97, 0x14,
425 0x43, 0xC5, 0xA9, 0xFC, 0x87, 0x59, 0xAF, 0x87, 0xF3, 0x02, 0x2C, 0x59, 0x2E, 0x0A, 0x04, 0xF7,
426 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3E, 0x1B, 0x01, 0x01, 0x1C, 0x39, 0x07, 0x37, 0x08, 0x08,
427 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
428 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
429 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE,
430 0xDB, 0xE7, 0x2E, 0xC6, 0xC7, 0x2E, 0xFD, 0x01, 0x00, 0x54, 0xD8, 0xED, 0xAB, 0x63, 0xE0, 0x89,
431 0x9D, 0x31, 0x0B, 0xD7, 0x2F, 0xF6, 0x4C, 0x4B, 0xCE, 0x2A, 0xB9, 0x65, 0x55, 0x65, 0x15, 0x4F,
432 0x1B, 0x59, 0xFF, 0xF7, 0x10, 0xB8, 0xA6, 0x33, 0x88, 0xA6, 0xCF, 0x9B, 0x23, 0x7E, 0x48, 0x83,
433 0x60, 0x59, 0xF9, 0xB5, 0x7F, 0x68, 0x2B, 0x1E, 0x2F, 0x35, 0x3B, 0x48, 0x64, 0x15, 0xD8, 0xE1,
434 0x27, 0x1F, 0xDE, 0x0A, 0x27, 0xBE, 0x7A, 0xA6, 0xFE, 0x8B, 0x01, 0x7C, 0x94, 0xDC, 0x2D, 0x4B,
435 0x2E, 0x78, 0xA0, 0xF4, 0xA2, 0x9B, 0x63, 0x47, 0x5B, 0x8C, 0x57, 0x04, 0xF3, 0x92, 0x3F, 0x4C,
436 0x84, 0x70, 0x06, 0x16, 0xD2, 0xF0, 0x49, 0x9E, 0x4E, 0x2E, 0x9A, 0xC5, 0xB0, 0xC8, 0x0F, 0x4C,
437 0xB9, 0xD0, 0x37, 0x9F, 0xEB, 0x53, 0x68, 0x1B, 0xC9, 0xBF, 0x77, 0x12, 0xBD, 0x25, 0x23, 0x38,
438 0x56, 0x63, 0x22, 0xA4, 0x52, 0xA1, 0x00, 0x47, 0x08, 0xEB, 0xC7, 0x36, 0x33, 0x46, 0xC1, 0x92,
439 0x89, 0xE4, 0xC8, 0x52, 0x05, 0xB7, 0x01, 0x2B, 0x24, 0x04, 0x56, 0xC3, 0x8C, 0x1F, 0x18, 0x78,
440 0x73, 0x99, 0xFF, 0x7B, 0x0E, 0x92, 0x3D, 0x92, 0x61, 0xF1, 0xDC, 0x55, 0xDB, 0x55, 0x8B, 0xBA,
441 0xDB, 0xD9, 0x14, 0x7C, 0x7B, 0x9B, 0xDC, 0x90, 0x15, 0xC6, 0x59, 0x80, 0xE7, 0xFC, 0x03, 0x71,
442 0x7E, 0x35, 0x05, 0x30, 0xBE, 0xED, 0xC4, 0xB2, 0x2E, 0x39, 0xDB, 0xAA, 0x2A, 0x7E, 0x50, 0x37,
443 0x4D, 0xC8, 0x3F, 0x00, 0xD8, 0xE9, 0xF1, 0x9D, 0x57, 0x43, 0x2B, 0x1C, 0x5F, 0x09, 0x18, 0xA3,
444 0xE3, 0x11, 0x85, 0xCC, 0x0E, 0xAF, 0x56, 0x6B, 0xE1, 0xAC, 0xB3, 0x20, 0xF2, 0x47, 0xFE, 0x95,
445 0xC8, 0x71, 0x99, 0xCC, 0x52, 0x8A, 0x6F, 0xF1, 0x01, 0xD6, 0xE9, 0x2E, 0x6C, 0x27, 0xC3, 0xED,
446 0xE3, 0xF2, 0xDD, 0x78, 0xB4, 0x7F, 0xFA, 0xD0, 0xC2
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500447 }};
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800448};
449
450struct Sha256Dataset
451{
452 const std::string name = "Sha256";
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500453 const Block cert{{
454 }};
455 const Block goodData{{
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800456 0x06, 0x41, 0x07, 0x14, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
457 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x14, 0x00, 0x15, 0x00, 0x16, 0x03, 0x1B, 0x01,
458 0x00, 0x17, 0x20, 0xE2, 0xE2, 0x2F, 0x02, 0x70, 0xA7, 0xF7, 0x48, 0x70, 0x45, 0x29, 0x46, 0xBD,
459 0xD2, 0x62, 0x24, 0xA6, 0x1E, 0x1D, 0x75, 0x2A, 0x26, 0x98, 0x04, 0xAD, 0x9C, 0x47, 0x63, 0xF8,
460 0x98, 0x5A, 0x49
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500461 }};
462 const Block badSigData{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700463 0x06, 0xA6, 0x07, 0x14, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800464 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x14, 0x00, 0x15, 0x00, 0x16, 0x40, 0x1B, 0x01,
465 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08,
466 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F,
467 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700468 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x17, 0x48,
469 0x30, 0x46, 0x02, 0x21, 0x00, 0xF0, 0x72, 0x9A, 0x68, 0x36, 0xC5, 0xAA, 0x9D, 0x75, 0x03, 0x36,
470 0xDA, 0xAA, 0x80, 0x0C, 0x29, 0xEE, 0xC9, 0x48, 0x95, 0xA2, 0xEC, 0xAB, 0x78, 0x28, 0x3B, 0x9D,
471 0x28, 0x19, 0x6C, 0x5C, 0xD6, 0x02, 0x21, 0x00, 0xF0, 0xD2, 0x23, 0xEA, 0xD9, 0x43, 0x6D, 0x8A,
472 0xD2, 0x02, 0x3F, 0xF1, 0x41, 0x12, 0xA6, 0xED, 0x87, 0xB3, 0xD5, 0x5A, 0x27, 0x5D, 0x4E, 0xEB,
473 0x13, 0x29, 0x01, 0xBC, 0x3C, 0xCC, 0x50, 0x61
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500474 }};
475 const Block goodInterest{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700476 0x05, 0x6B, 0x07, 0x3A, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
477 0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x8F, 0x03,
478 0x0B, 0x85, 0xA7, 0x05, 0xD8, 0x05, 0x31, 0x8E, 0x80, 0x81, 0xD3, 0xE2, 0xA8, 0x5E, 0x74, 0xD7,
479 0x4F, 0x3A, 0xDC, 0xFF, 0x9C, 0x44, 0xF6, 0xA1, 0xC6, 0x6B, 0x97, 0x99, 0x8E, 0xDA, 0x0A, 0x04,
480 0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x03, 0x1B, 0x01, 0x00, 0x2E, 0x20, 0xEF, 0x45, 0x55,
481 0x75, 0xC8, 0x18, 0x5E, 0xE9, 0x2A, 0xAE, 0x52, 0x61, 0x0A, 0x94, 0x41, 0x03, 0x36, 0x4C, 0x13,
482 0x59, 0xD4, 0xC7, 0xA4, 0x3A, 0xA0, 0x40, 0x61, 0x44, 0x33, 0x93, 0x5E, 0x99
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500483 }};
484 const Block badSigInterest{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700485 0x05, 0xCE, 0x07, 0x3A, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
486 0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x32, 0x3F,
487 0x2F, 0xA3, 0xDC, 0x15, 0x7E, 0x8C, 0xA9, 0x75, 0xF7, 0x66, 0xFF, 0xFD, 0x13, 0x42, 0x1B, 0xE1,
488 0x3A, 0x27, 0xDD, 0xE4, 0x98, 0x42, 0x77, 0xFA, 0xAD, 0x8F, 0x3E, 0x91, 0x75, 0xF9, 0x0A, 0x04,
489 0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08,
490 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56,
491 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65,
492 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08,
493 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x2E, 0x46, 0x30, 0x44, 0x02, 0x20, 0x0C, 0xA0,
494 0x6F, 0x90, 0xEF, 0x5E, 0x04, 0x15, 0xAF, 0x94, 0x8E, 0x33, 0x12, 0x1F, 0xF9, 0x50, 0xDD, 0x49,
495 0x73, 0xB3, 0xA6, 0xD2, 0x99, 0x32, 0x26, 0xE2, 0x46, 0x3A, 0xE0, 0x69, 0xDF, 0xB2, 0x02, 0x20,
496 0x6A, 0x03, 0xCE, 0xB6, 0x85, 0x1E, 0x01, 0x5E, 0xF8, 0x48, 0xDE, 0x65, 0xB9, 0xE1, 0xEB, 0x9A,
497 0xF8, 0x47, 0x43, 0x5B, 0xBA, 0x63, 0xCB, 0xBA, 0xFB, 0x62, 0x1C, 0x38, 0xE8, 0x53, 0xF7, 0x29
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500498 }};
499 const Block goodInterestOldFormat{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700500 0x05, 0x6B, 0x07, 0x3A, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
501 0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x8F, 0x03,
502 0x0B, 0x85, 0xA7, 0x05, 0xD8, 0x05, 0x31, 0x8E, 0x80, 0x81, 0xD3, 0xE2, 0xA8, 0x5E, 0x74, 0xD7,
503 0x4F, 0x3A, 0xDC, 0xFF, 0x9C, 0x44, 0xF6, 0xA1, 0xC6, 0x6B, 0x97, 0x99, 0x8E, 0xDA, 0x0A, 0x04,
504 0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x03, 0x1B, 0x01, 0x00, 0x2E, 0x20, 0xEF, 0x45, 0x55,
505 0x75, 0xC8, 0x18, 0x5E, 0xE9, 0x2A, 0xAE, 0x52, 0x61, 0x0A, 0x94, 0x41, 0x03, 0x36, 0x4C, 0x13,
506 0x59, 0xD4, 0xC7, 0xA4, 0x3A, 0xA0, 0x40, 0x61, 0x44, 0x33, 0x93, 0x5E, 0x99
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500507 }};
508 const Block badSigInterestOldFormat{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700509 0x05, 0xFA, 0x07, 0xC9, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
510 0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x8F, 0x03,
511 0x0B, 0x85, 0xA7, 0x05, 0xD8, 0x05, 0x31, 0x8E, 0x80, 0x81, 0xD3, 0xE2, 0xA8, 0x5E, 0x74, 0xD7,
512 0x4F, 0x3A, 0xDC, 0xFF, 0x9C, 0x44, 0xF6, 0xA1, 0xC6, 0x6B, 0x97, 0x99, 0x8E, 0xDA, 0x08, 0x42,
513 0x16, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72,
514 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63,
515 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, 0x72,
516 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D,
517 0x6E, 0x43, 0x08, 0x49, 0x17, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xB3, 0x30, 0x0A, 0x93, 0x16,
518 0x16, 0xBB, 0xD0, 0x3C, 0x73, 0x01, 0xED, 0x0D, 0x40, 0xEE, 0x28, 0x69, 0xA6, 0xAA, 0xF0, 0x34,
519 0x44, 0xBD, 0x7E, 0x1F, 0xBF, 0x6D, 0x7C, 0x52, 0xA1, 0x85, 0x1D, 0x02, 0x20, 0x3F, 0x18, 0x66,
520 0x48, 0xC9, 0x0F, 0x5B, 0x18, 0xB0, 0xD0, 0x45, 0xDE, 0x93, 0xA6, 0x21, 0xA0, 0xDC, 0x7E, 0x47,
521 0x3A, 0x61, 0x56, 0xD2, 0xAE, 0x70, 0x8D, 0xE8, 0xD5, 0xB7, 0xD0, 0x12, 0x35, 0x0A, 0x04, 0xF7,
522 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x03, 0x1B, 0x01, 0x00, 0x2E, 0x20, 0xEF, 0x45, 0x55, 0x75,
523 0xC8, 0x18, 0x5E, 0xE9, 0x2A, 0xAE, 0x52, 0x61, 0x0A, 0x94, 0x41, 0x03, 0x36, 0x4C, 0x13, 0x59,
524 0xD4, 0xC7, 0xA4, 0x3A, 0xA0, 0x40, 0x61, 0x44, 0x33, 0x93, 0x5E, 0x99
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500525 }};
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800526};
527
528// Note about the datasets:
529// - .cert a valid certificate
Eric Newberryb74bbda2020-06-18 19:33:58 -0700530// - .goodData is a Data packet that can be verified against .cert
531// - .badSigData a valid and signed Data packet that cannot be verified against cert (signed using
532// a different private key)
533// - .goodInterest is an Interest packet that can be verified against .cert
534// - .badSigInterest is a valid and signed Interest packet that cannot be verified against .cert
535// (signed using a different private key)
536// - .goodInterestOldFormat is an Interest packet that can be verified against .cert (in the old
537// signed Interest format)
538// - .badSigInterestOldFormat is a valid and signed Interest packet that cannot be verified against
539// .cert (signed using a different private key and in the old signed Interest format)
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800540
Davide Pesavento77d9e812019-06-03 22:05:54 -0400541using SignatureDatasets = boost::mpl::vector<EcdsaDataset, RsaDataset>;
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800542
543BOOST_AUTO_TEST_CASE_TEMPLATE(VerifySignature, Dataset, SignatureDatasets)
544{
Davide Pesavento809f7542021-03-24 18:53:05 -0400545 const Dataset dataset;
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500546 Certificate cert(dataset.cert);
547 auto keyRaw = cert.getPublicKey();
Davide Pesavento77d9e812019-06-03 22:05:54 -0400548 transform::PublicKey key;
Davide Pesavento765abc92021-12-27 00:44:04 -0500549 key.loadPkcs8(keyRaw);
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500550
551 Data data(dataset.goodData);
552 Data badSigData(dataset.badSigData);
553 Interest interest(dataset.goodInterest);
554 Interest badSigInterest(dataset.badSigInterest);
555 Interest interestOldFormat(dataset.goodInterestOldFormat);
556 Interest badSigInterestOldFormat(dataset.badSigInterestOldFormat);
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800557
558 BOOST_CHECK(verifySignature(data, key));
Davide Pesavento35c63792022-01-17 02:06:03 -0500559 BOOST_CHECK(verifySignature(data, keyRaw));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800560 BOOST_CHECK(verifySignature(data, cert));
561 BOOST_CHECK(verifySignature(interest, key));
Davide Pesavento35c63792022-01-17 02:06:03 -0500562 BOOST_CHECK(verifySignature(interest, keyRaw));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800563 BOOST_CHECK(verifySignature(interest, cert));
Eric Newberryb74bbda2020-06-18 19:33:58 -0700564 BOOST_CHECK(verifySignature(interestOldFormat, key));
Davide Pesavento35c63792022-01-17 02:06:03 -0500565 BOOST_CHECK(verifySignature(interestOldFormat, keyRaw));
Eric Newberryb74bbda2020-06-18 19:33:58 -0700566 BOOST_CHECK(verifySignature(interestOldFormat, cert));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800567
568 BOOST_CHECK(!verifySignature(badSigData, key));
Davide Pesavento35c63792022-01-17 02:06:03 -0500569 BOOST_CHECK(!verifySignature(badSigData, keyRaw));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800570 BOOST_CHECK(!verifySignature(badSigData, cert));
571 BOOST_CHECK(!verifySignature(badSigInterest, key));
Davide Pesavento35c63792022-01-17 02:06:03 -0500572 BOOST_CHECK(!verifySignature(badSigInterest, keyRaw));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800573 BOOST_CHECK(!verifySignature(badSigInterest, cert));
Eric Newberryb74bbda2020-06-18 19:33:58 -0700574 BOOST_CHECK(!verifySignature(badSigInterestOldFormat, key));
Davide Pesavento35c63792022-01-17 02:06:03 -0500575 BOOST_CHECK(!verifySignature(badSigInterestOldFormat, keyRaw));
Eric Newberryb74bbda2020-06-18 19:33:58 -0700576 BOOST_CHECK(!verifySignature(badSigInterestOldFormat, cert));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800577
578 Data unsignedData("/some/data");
579 Interest unsignedInterest1("/some/interest/with/several/name/components");
580 Interest unsignedInterest2("/interest-with-one-name-component");
581
582 BOOST_CHECK(!verifySignature(unsignedData, cert));
583 BOOST_CHECK(!verifySignature(unsignedData, key));
584 BOOST_CHECK(!verifySignature(unsignedInterest1, cert));
585 BOOST_CHECK(!verifySignature(unsignedInterest1, key));
586 BOOST_CHECK(!verifySignature(unsignedInterest2, cert));
587 BOOST_CHECK(!verifySignature(unsignedInterest2, key));
588
Davide Pesavento35c63792022-01-17 02:06:03 -0500589 const uint8_t invalidKey[] = {0x00, 0x00};
590 BOOST_CHECK(!verifySignature(unsignedData, invalidKey));
591 BOOST_CHECK(!verifySignature(unsignedInterest1, invalidKey));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800592
593 // - base version of verifySignature is tested transitively
Alexander Afanasyev09236c22020-06-03 13:42:38 -0400594 // - pib::Key version is tested as part of key-chain.t.cpp (Security/TestKeyChain)
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800595}
596
Davide Pesavento94dfcf12021-09-26 14:18:45 -0400597#if OPENSSL_VERSION_NUMBER < 0x30000000L // FIXME #5154
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500598BOOST_FIXTURE_TEST_CASE(VerifyHmac, KeyChainFixture)
laqinfanbc997e52019-06-25 22:11:09 -0500599{
600 const Tpm& tpm = m_keyChain.getTpm();
601 Data data("/data");
602 Interest interest("/interest");
Eric Newberryb74bbda2020-06-18 19:33:58 -0700603 Interest interestOldFormat("/interest");
laqinfanbc997e52019-06-25 22:11:09 -0500604 SigningInfo signingInfo;
605 signingInfo.setSigningHmacKey("QjM3NEEyNkE3MTQ5MDQzN0FBMDI0RTRGQURENUI0OTdGREZGMUE4RUE2RkYxMkY2"
606 "RkI2NUFGMjcyMEI1OUNDRg==");
607 signingInfo.setDigestAlgorithm(DigestAlgorithm::SHA256);
608
609 BOOST_CHECK(!verifySignature(data, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256));
610 BOOST_CHECK(!verifySignature(interest, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256));
611
612 m_keyChain.sign(data, signingInfo);
Eric Newberryb74bbda2020-06-18 19:33:58 -0700613 signingInfo.setSignedInterestFormat(SignedInterestFormat::V03);
laqinfanbc997e52019-06-25 22:11:09 -0500614 m_keyChain.sign(interest, signingInfo);
Eric Newberryb74bbda2020-06-18 19:33:58 -0700615 signingInfo.setSignedInterestFormat(SignedInterestFormat::V02);
616 m_keyChain.sign(interestOldFormat, signingInfo);
laqinfanbc997e52019-06-25 22:11:09 -0500617 BOOST_CHECK(verifySignature(data, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256));
618 BOOST_CHECK(verifySignature(interest, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256));
Eric Newberryb74bbda2020-06-18 19:33:58 -0700619 BOOST_CHECK(verifySignature(interestOldFormat, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256));
laqinfanbc997e52019-06-25 22:11:09 -0500620}
Davide Pesavento94dfcf12021-09-26 14:18:45 -0400621#endif
laqinfanbc997e52019-06-25 22:11:09 -0500622
Davide Pesavento77d9e812019-06-03 22:05:54 -0400623using DigestDatasets = boost::mpl::vector<Sha256Dataset>;
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800624
625BOOST_AUTO_TEST_CASE_TEMPLATE(VerifyDigest, Dataset, DigestDatasets)
626{
Davide Pesavento809f7542021-03-24 18:53:05 -0400627 const Dataset dataset;
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500628 Data data(dataset.goodData);
629 Data badSigData(dataset.badSigData);
630 Interest interest(dataset.goodInterest);
631 Interest badSigInterest(dataset.badSigInterest);
632 Interest interestOldFormat(dataset.goodInterestOldFormat);
633 Interest badSigInterestOldFormat(dataset.badSigInterestOldFormat);
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800634
Davide Pesaventof6b45892023-03-13 15:00:51 -0400635 BOOST_CHECK(verifySignature(data, std::nullopt));
636 BOOST_CHECK(verifySignature(interest, std::nullopt));
637 BOOST_CHECK(verifySignature(interestOldFormat, std::nullopt));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800638
Davide Pesaventof6b45892023-03-13 15:00:51 -0400639 BOOST_CHECK(!verifySignature(badSigData, std::nullopt));
640 BOOST_CHECK(!verifySignature(badSigInterest, std::nullopt));
641 BOOST_CHECK(!verifySignature(badSigInterestOldFormat, std::nullopt));
Justin Labryaef53b62021-03-10 06:07:27 +0000642
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800643 Data unsignedData("/some/data");
644 Interest unsignedInterest1("/some/interest/with/several/name/components");
645 Interest unsignedInterest2("/interest-with-one-name-component");
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800646
Davide Pesaventof6b45892023-03-13 15:00:51 -0400647 BOOST_CHECK(!verifySignature(unsignedData, std::nullopt));
648 BOOST_CHECK(!verifySignature(unsignedInterest1, std::nullopt));
649 BOOST_CHECK(!verifySignature(unsignedInterest2, std::nullopt));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800650}
651
Eric Newberrye36aae12020-08-31 22:23:13 -0700652const uint8_t sha256DataUnrecognizedElements[] = {
653 0x06, 0x47, 0x07, 0x14, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
654 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x14, 0x00, 0x15, 0x00, 0x16, 0x03, 0x1B, 0x01,
655 0x00, 0x17, 0x20, 0xE2, 0xE2, 0x2F, 0x02, 0x70, 0xA7, 0xF7, 0x48, 0x70, 0x45, 0x29, 0x46, 0xBD,
656 0xD2, 0x62, 0x24, 0xA6, 0x1E, 0x1D, 0x75, 0x2A, 0x26, 0x98, 0x04, 0xAD, 0x9C, 0x47, 0x63, 0xF8,
657 0x98, 0x5A, 0x49, 0xAA, 0x04, 0x01, 0x02, 0x03, 0x04
658};
659
660const uint8_t sha256InterestUnrecognizedElements[] = {
661 0x05, 0x71, 0x07, 0x3A, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
662 0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x9A, 0x55,
663 0xC0, 0xB5, 0x36, 0xC6, 0x6C, 0x0E, 0x11, 0x41, 0xAF, 0xA5, 0x7F, 0x0B, 0x45, 0x53, 0x3D, 0xEE,
664 0x40, 0x1B, 0x9B, 0xAF, 0xEA, 0xBF, 0x3D, 0x56, 0x89, 0x12, 0xE0, 0x18, 0x98, 0x26, 0x0A, 0x04,
665 0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x03, 0x1B, 0x01, 0x00, 0x2E, 0x20, 0xEF, 0x45, 0x55,
666 0x75, 0xC8, 0x18, 0x5E, 0xE9, 0x2A, 0xAE, 0x52, 0x61, 0x0A, 0x94, 0x41, 0x03, 0x36, 0x4C, 0x13,
667 0x59, 0xD4, 0xC7, 0xA4, 0x3A, 0xA0, 0x40, 0x61, 0x44, 0x33, 0x93, 0x5E, 0x99, 0xAA, 0x04, 0x01,
668 0x02, 0x03, 0x04
669};
670
671BOOST_AUTO_TEST_CASE(VerifyWithUnrecognizedElements) // Bug #4583
672{
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500673 Data data(Block{sha256DataUnrecognizedElements});
674 Interest interest(Block{sha256InterestUnrecognizedElements});
Eric Newberrye36aae12020-08-31 22:23:13 -0700675
Davide Pesaventof6b45892023-03-13 15:00:51 -0400676 BOOST_CHECK(verifySignature(data, std::nullopt));
677 BOOST_CHECK(verifySignature(interest, std::nullopt));
Eric Newberrye36aae12020-08-31 22:23:13 -0700678}
679
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800680BOOST_AUTO_TEST_SUITE_END() // TestVerificationHelpers
681BOOST_AUTO_TEST_SUITE_END() // Security
682
683} // namespace tests
684} // namespace security
685} // namespace ndn