blob: 0e34bcdd3449f15a1e428b2570192f3821b34f14 [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 Pesavento49e1e872023-11-11 00:45:23 -050029#include <boost/mp11/list.hpp>
Alexander Afanasyev574aa862017-01-10 19:53:28 -080030
Davide Pesavento47ce2ee2023-05-09 01:33:33 -040031namespace ndn::tests {
Alexander Afanasyev574aa862017-01-10 19:53:28 -080032
Davide Pesavento47ce2ee2023-05-09 01:33:33 -040033using namespace ndn::security;
Alexander Afanasyev574aa862017-01-10 19:53:28 -080034
35BOOST_AUTO_TEST_SUITE(Security)
36BOOST_AUTO_TEST_SUITE(TestVerificationHelpers)
37
Eric Newberryb74bbda2020-06-18 19:33:58 -070038// // Use this test case to regenerate the dataset if the signature format changes
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050039// BOOST_FIXTURE_TEST_CASE(Generator, KeyChainFixture)
Alexander Afanasyev574aa862017-01-10 19:53:28 -080040// {
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050041// Identity wrongIdentity = m_keyChain.createIdentity("/Security/TestVerificationHelpers/Wrong");
Davide Pesavento809f7542021-03-24 18:53:05 -040042// const std::map<std::string, SigningInfo> identities = {
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050043// {"Ecdsa", signingByIdentity(m_keyChain.createIdentity("/Security/TestVerificationHelpers/EC", EcKeyParams()))},
44// {"Rsa", signingByIdentity(m_keyChain.createIdentity("/Security/TestVerificationHelpers/RSA", RsaKeyParams()))},
Alexander Afanasyev574aa862017-01-10 19:53:28 -080045// {"Sha256", signingWithSha256()}
46// };
47
Davide Pesavento258d51a2022-02-27 21:26:28 -050048// auto print = [] (const std::string& name, span<const uint8_t> buf) {
Davide Pesaventofbea4fc2022-02-08 07:26:04 -050049// std::cout << " const Block " + name + "{{\n ";
Alexander Afanasyev574aa862017-01-10 19:53:28 -080050
Davide Pesavento258d51a2022-02-27 21:26:28 -050051// std::string hex = toHex(buf);
Alexander Afanasyev574aa862017-01-10 19:53:28 -080052
53// for (size_t i = 0; i < hex.size(); i++) {
54// if (i > 0 && i % 32 == 0)
55// std::cout << "\n ";
56
57// std::cout << "0x" << hex[i];
58// std::cout << hex[++i];
59
60// if ((i + 1) != hex.size())
61// std::cout << ", ";
62// }
Davide Pesaventofbea4fc2022-02-08 07:26:04 -050063// std::cout << "\n }};";
Alexander Afanasyev574aa862017-01-10 19:53:28 -080064// };
65
66// for (const auto& i : identities) {
67// const std::string& type = i.first;
68// const SigningInfo& signingInfo = i.second;
69
70// std::cout << "struct " + type + "Dataset\n{\n";
71// std::cout << " const std::string name = \"" << type << "\";\n";
72
Junxiao Shife1239a2017-01-27 20:36:12 +000073// if (signingInfo.getSignerType() == SigningInfo::SIGNER_TYPE_ID) {
Davide Pesavento258d51a2022-02-27 21:26:28 -050074// print("cert", signingInfo.getPibIdentity().getDefaultKey().getDefaultCertificate().wireEncode());
Alexander Afanasyev574aa862017-01-10 19:53:28 -080075// }
76// else {
Davide Pesavento258d51a2022-02-27 21:26:28 -050077// print("cert", {});
Alexander Afanasyev574aa862017-01-10 19:53:28 -080078// }
79// std::cout << "\n";
80
81// // Create data that can be verified by cert
82// Data data(Name("/test/data").append(type));
83// m_keyChain.sign(data, signingInfo);
Davide Pesavento258d51a2022-02-27 21:26:28 -050084// print("goodData", data.wireEncode());
Alexander Afanasyev574aa862017-01-10 19:53:28 -080085// std::cout << "\n";
86
87// // Create data that cannot be verified by cert
88// m_keyChain.sign(data, signingByIdentity(wrongIdentity));
Davide Pesavento258d51a2022-02-27 21:26:28 -050089// print("badSigData", data.wireEncode());
Alexander Afanasyev574aa862017-01-10 19:53:28 -080090// std::cout << "\n";
91
92// // Create interest that can be verified by cert
Eric Newberryb74bbda2020-06-18 19:33:58 -070093// Interest interest1(Name("/test/interest").append(type));
94// SigningInfo signingInfoV03(signingInfo);
95// signingInfoV03.setSignedInterestFormat(SignedInterestFormat::V03);
Eric Newberryb74bbda2020-06-18 19:33:58 -070096// interest1.setNonce(0xF72C8A4B);
97// m_keyChain.sign(interest1, signingInfoV03);
Davide Pesavento258d51a2022-02-27 21:26:28 -050098// print("goodInterest", interest1.wireEncode());
Alexander Afanasyev574aa862017-01-10 19:53:28 -080099// std::cout << "\n";
100
101// // Create interest that cannot be verified by cert
Eric Newberryb74bbda2020-06-18 19:33:58 -0700102// m_keyChain.sign(interest1, signingByIdentity(wrongIdentity)
103// .setSignedInterestFormat(SignedInterestFormat::V03));
Davide Pesavento258d51a2022-02-27 21:26:28 -0500104// print("badSigInterest", interest1.wireEncode());
Eric Newberryb74bbda2020-06-18 19:33:58 -0700105// std::cout << "\n";
106
107// // Create interest that can be verified by cert (old signed Interest format)
108// Interest interest2(Name("/test/interest").append(type));
109// SigningInfo signingInfoV02(signingInfo);
110// signingInfoV02.setSignedInterestFormat(SignedInterestFormat::V03);
Eric Newberryb74bbda2020-06-18 19:33:58 -0700111// interest2.setNonce(0xF72C8A4B);
112// m_keyChain.sign(interest2, signingInfoV02);
Davide Pesavento258d51a2022-02-27 21:26:28 -0500113// print("goodInterestOldFormat", interest2.wireEncode());
Eric Newberryb74bbda2020-06-18 19:33:58 -0700114// std::cout << "\n";
115
116// // Create interest that cannot be verified by cert (old signed Interest format)
117// m_keyChain.sign(interest2, signingByIdentity(wrongIdentity)
118// .setSignedInterestFormat(SignedInterestFormat::V02));
Davide Pesavento258d51a2022-02-27 21:26:28 -0500119// print("badSigInterestOldFormat", interest2.wireEncode());
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800120// std::cout << "\n};\n\n";
121// }
122// }
123
124struct EcdsaDataset
125{
126 const std::string name = "Ecdsa";
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500127 const Block cert{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700128 0x06, 0xFD, 0x01, 0x62, 0x07, 0x47, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800129 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
130 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700131 0x45, 0x59, 0x08, 0x08, 0xA5, 0x8F, 0x5F, 0x7F, 0x18, 0x1A, 0x98, 0x14, 0x08, 0x04, 0x73, 0x65,
132 0x6C, 0x66, 0x08, 0x09, 0xFD, 0x00, 0x00, 0x01, 0x72, 0xCE, 0xA8, 0xE7, 0x53, 0x14, 0x09, 0x18,
133 0x01, 0x02, 0x19, 0x04, 0x00, 0x36, 0xEE, 0x80, 0x15, 0x5B, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07,
134 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01,
135 0x07, 0x03, 0x42, 0x00, 0x04, 0x15, 0x94, 0xDF, 0xBF, 0x2D, 0x83, 0x2C, 0x1F, 0xB7, 0x9D, 0x55,
136 0x9A, 0x6A, 0xC2, 0xDB, 0x03, 0xE9, 0xB2, 0x6B, 0x77, 0x6D, 0xF6, 0x42, 0x81, 0x2F, 0xC8, 0xDE,
137 0x3F, 0x8B, 0xF4, 0x27, 0x1C, 0x4F, 0xE9, 0x47, 0x0C, 0x44, 0x83, 0x52, 0xA0, 0xA2, 0x4E, 0x52,
138 0x49, 0xC5, 0xAD, 0x2D, 0x9B, 0x9C, 0xAE, 0xF5, 0x4C, 0x2A, 0xB5, 0xC4, 0xF5, 0xFB, 0xF3, 0x93,
139 0xD4, 0x86, 0x61, 0xE6, 0x70, 0x16, 0x67, 0x1B, 0x01, 0x03, 0x1C, 0x38, 0x07, 0x36, 0x08, 0x08,
140 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
141 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
142 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xA5, 0x8F, 0x5F, 0x7F,
143 0x18, 0x1A, 0x98, 0x14, 0xFD, 0x00, 0xFD, 0x26, 0xFD, 0x00, 0xFE, 0x0F, 0x31, 0x39, 0x37, 0x30,
144 0x30, 0x31, 0x30, 0x31, 0x54, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xFD, 0x00, 0xFF, 0x0F, 0x32,
145 0x30, 0x34, 0x30, 0x30, 0x36, 0x31, 0x34, 0x54, 0x32, 0x32, 0x31, 0x37, 0x35, 0x35, 0x17, 0x46,
146 0x30, 0x44, 0x02, 0x20, 0x4B, 0xF7, 0x85, 0xB8, 0x01, 0x7D, 0x65, 0x02, 0x6C, 0xFB, 0x69, 0x00,
147 0x8B, 0x4D, 0xCC, 0x0F, 0xB5, 0x87, 0xF8, 0x4C, 0x69, 0xE0, 0x7C, 0x16, 0xCC, 0x52, 0xB2, 0x29,
148 0x6B, 0x24, 0xF5, 0x7F, 0x02, 0x20, 0x1C, 0x88, 0xDE, 0x32, 0x3F, 0x1A, 0xE6, 0x60, 0xA2, 0x29,
149 0x94, 0xD9, 0x05, 0x8F, 0x57, 0x14, 0xD6, 0x17, 0x3C, 0x78, 0xBF, 0x85, 0xF5, 0x1D, 0xCC, 0x03,
150 0x35, 0x9E, 0xC9, 0xA9, 0x6B, 0x09
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500151 }};
152 const Block goodData{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700153 0x06, 0xA2, 0x07, 0x13, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
154 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x14, 0x00, 0x15, 0x00, 0x16, 0x3D, 0x1B, 0x01, 0x03,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800155 0x1C, 0x38, 0x07, 0x36, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17,
156 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E,
157 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, 0x45, 0x59,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700158 0x08, 0x08, 0xA5, 0x8F, 0x5F, 0x7F, 0x18, 0x1A, 0x98, 0x14, 0x17, 0x48, 0x30, 0x46, 0x02, 0x21,
159 0x00, 0xD2, 0x35, 0xAD, 0xA9, 0xE6, 0x1E, 0x0F, 0xF3, 0xDE, 0x1D, 0xEA, 0x18, 0xCA, 0xEE, 0x5D,
160 0x05, 0xD1, 0xE0, 0x6A, 0x1E, 0xA5, 0x1A, 0xD6, 0xE6, 0x88, 0xB3, 0x24, 0xA9, 0xD5, 0x97, 0x4D,
161 0xC3, 0x02, 0x21, 0x00, 0xB5, 0xA3, 0x87, 0xD8, 0x9B, 0xB6, 0x92, 0xAD, 0x19, 0x84, 0xAE, 0x4D,
162 0xF5, 0x64, 0xEC, 0x1C, 0xF2, 0xA0, 0xB7, 0x4D, 0x6B, 0x74, 0xFF, 0x39, 0x38, 0xFD, 0x5D, 0x9D,
163 0x46, 0xE0, 0xD2, 0xB4
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500164 }};
165 const Block badSigData{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700166 0x06, 0xA5, 0x07, 0x13, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
167 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x14, 0x00, 0x15, 0x00, 0x16, 0x40, 0x1B, 0x01, 0x03,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800168 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17,
169 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E,
170 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700171 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x17, 0x48, 0x30,
172 0x46, 0x02, 0x21, 0x00, 0xBB, 0x15, 0xAC, 0x92, 0xFB, 0x7D, 0x6F, 0x6C, 0x90, 0xC9, 0x45, 0x71,
173 0x97, 0x39, 0xCD, 0x8C, 0x30, 0xA0, 0x8C, 0x69, 0xCA, 0x39, 0xDB, 0xE5, 0xC2, 0x95, 0x55, 0xB4,
174 0x13, 0xB4, 0xB8, 0x95, 0x02, 0x21, 0x00, 0xDA, 0x54, 0x99, 0xF8, 0xE5, 0xC1, 0x74, 0xAC, 0xE0,
175 0xF2, 0xDF, 0x0D, 0xC5, 0xE1, 0xCF, 0x99, 0x28, 0x6C, 0xB0, 0x2D, 0x55, 0xC8, 0x74, 0x63, 0x56,
176 0x2A, 0x1A, 0xB0, 0x00, 0xBD, 0xFF, 0xC5
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500177 }};
178 const Block goodInterest{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700179 0x05, 0xCA, 0x07, 0x39, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
180 0x72, 0x65, 0x73, 0x74, 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x02, 0x20, 0x8F, 0x41, 0x49,
181 0x40, 0xDA, 0x38, 0xC1, 0x0E, 0x75, 0x5A, 0x6D, 0x4A, 0xD4, 0xFC, 0xE2, 0xDF, 0xBA, 0x52, 0xAF,
182 0x0C, 0x9E, 0xEB, 0xD6, 0xC5, 0xD1, 0x1B, 0x51, 0x43, 0xBD, 0x19, 0xA7, 0x62, 0x0A, 0x04, 0xF7,
183 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3D, 0x1B, 0x01, 0x03, 0x1C, 0x38, 0x07, 0x36, 0x08, 0x08,
184 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
185 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
186 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xA5, 0x8F, 0x5F, 0x7F,
187 0x18, 0x1A, 0x98, 0x14, 0x2E, 0x46, 0x30, 0x44, 0x02, 0x20, 0x14, 0x1A, 0xF5, 0x9C, 0xD2, 0x3F,
188 0xA9, 0x71, 0x3B, 0x37, 0xD7, 0x97, 0xE6, 0x29, 0x12, 0x40, 0x44, 0x7B, 0xF1, 0x98, 0x03, 0xC1,
189 0xDB, 0xEA, 0x3A, 0x71, 0x83, 0x0D, 0xC4, 0x26, 0xB7, 0x24, 0x02, 0x20, 0x0F, 0x14, 0x10, 0xDB,
190 0xDB, 0x24, 0xCB, 0xB3, 0xD2, 0x4B, 0x45, 0x6D, 0xA0, 0xBB, 0x4B, 0x87, 0xC1, 0x59, 0x9F, 0xC8,
191 0xBE, 0x75, 0xF5, 0xCC, 0xCB, 0xD2, 0x4F, 0xD8, 0x87, 0x26, 0x51, 0xBF
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500192 }};
193 const Block badSigInterest{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700194 0x05, 0xCF, 0x07, 0x39, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
195 0x72, 0x65, 0x73, 0x74, 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x02, 0x20, 0x53, 0x14, 0x5E,
196 0xA3, 0x31, 0x41, 0xD8, 0xA1, 0x10, 0x06, 0x3C, 0x8E, 0xF3, 0x51, 0xA0, 0xC2, 0x8A, 0xBC, 0xFC,
197 0x01, 0x5F, 0x12, 0x12, 0x11, 0x27, 0xD2, 0x18, 0xE5, 0xE7, 0xE4, 0xBD, 0x57, 0x0A, 0x04, 0xF7,
198 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08,
199 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
200 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
201 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3,
202 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x2E, 0x48, 0x30, 0x46, 0x02, 0x21, 0x00, 0xC9, 0x69,
203 0xD8, 0xB8, 0x59, 0x38, 0x31, 0x0B, 0x44, 0x66, 0xAE, 0x1C, 0x1C, 0x88, 0x2A, 0x95, 0xD0, 0xE5,
204 0x31, 0x61, 0xA6, 0x94, 0x1F, 0x9B, 0xAD, 0x47, 0x1C, 0x9D, 0x56, 0x37, 0x50, 0xBE, 0x02, 0x21,
205 0x00, 0xC7, 0x23, 0x25, 0xF7, 0xFA, 0x6A, 0x2D, 0x3D, 0xF4, 0xD8, 0xDB, 0xE9, 0x76, 0x6A, 0x63,
206 0xD4, 0x11, 0x17, 0x4A, 0xDB, 0x7F, 0x85, 0x52, 0x97, 0xFC, 0x5B, 0x0B, 0x1B, 0xBA, 0xE5, 0xED,
207 0x9A
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500208 }};
209 const Block goodInterestOldFormat{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700210 0x05, 0xCB, 0x07, 0x39, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
211 0x72, 0x65, 0x73, 0x74, 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x02, 0x20, 0xDB, 0x6D, 0x5E,
212 0xA7, 0xBF, 0xAF, 0xEC, 0xA0, 0xC6, 0x20, 0x4E, 0xF2, 0x04, 0xF8, 0xFF, 0x39, 0x2A, 0x5F, 0xE6,
213 0x5F, 0x5B, 0xCE, 0x02, 0xA6, 0xBE, 0x82, 0x3F, 0xD2, 0x26, 0x47, 0x92, 0x62, 0x0A, 0x04, 0xF7,
214 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3D, 0x1B, 0x01, 0x03, 0x1C, 0x38, 0x07, 0x36, 0x08, 0x08,
215 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
216 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
217 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xA5, 0x8F, 0x5F, 0x7F,
218 0x18, 0x1A, 0x98, 0x14, 0x2E, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xCA, 0xFD, 0x19, 0x4C, 0x6C,
219 0x1B, 0x95, 0xD4, 0x2B, 0x15, 0x01, 0xE3, 0x87, 0x1F, 0xD7, 0xF2, 0x3D, 0x3E, 0x2E, 0x64, 0xAA,
220 0x60, 0x63, 0x51, 0xB3, 0x52, 0xBC, 0x6D, 0x24, 0x0C, 0x6D, 0x38, 0x02, 0x20, 0x0E, 0x21, 0xF1,
221 0x51, 0x39, 0x2D, 0x4A, 0x45, 0x05, 0x45, 0xFA, 0x85, 0xA7, 0xCC, 0x00, 0xFE, 0x89, 0x8A, 0xD6,
222 0xD7, 0x34, 0x0D, 0x31, 0x6A, 0x94, 0xAE, 0x1F, 0xD8, 0x07, 0xF1, 0xDF, 0x80
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500223 }};
224 const Block badSigInterestOldFormat{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700225 0x05, 0xFD, 0x01, 0x5B, 0x07, 0xC9, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E,
226 0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x02, 0x20, 0xDB,
227 0x6D, 0x5E, 0xA7, 0xBF, 0xAF, 0xEC, 0xA0, 0xC6, 0x20, 0x4E, 0xF2, 0x04, 0xF8, 0xFF, 0x39, 0x2A,
228 0x5F, 0xE6, 0x5F, 0x5B, 0xCE, 0x02, 0xA6, 0xBE, 0x82, 0x3F, 0xD2, 0x26, 0x47, 0x92, 0x62, 0x08,
229 0x42, 0x16, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75,
230 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69,
231 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57,
232 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87,
233 0x5D, 0x6E, 0x43, 0x08, 0x4A, 0x17, 0x48, 0x30, 0x46, 0x02, 0x21, 0x00, 0xD0, 0x33, 0x6A, 0x5D,
234 0x8A, 0x1B, 0x04, 0xF9, 0xE5, 0xEE, 0x3A, 0x5A, 0x73, 0x63, 0xBF, 0xD4, 0x39, 0x07, 0x53, 0xA9,
235 0xF5, 0xBB, 0xB3, 0xD4, 0x7E, 0x65, 0x7B, 0xCB, 0x5A, 0xB1, 0x4B, 0xCE, 0x02, 0x21, 0x00, 0xD4,
236 0xA0, 0x7F, 0x40, 0x7A, 0xCF, 0xA5, 0xAD, 0x11, 0x44, 0x2F, 0xB1, 0xE0, 0x48, 0x25, 0x0B, 0x1C,
237 0x84, 0x76, 0x1F, 0x1B, 0x28, 0x4B, 0x36, 0x5F, 0x23, 0x3F, 0x91, 0xB3, 0xEF, 0x38, 0x2F, 0x0A,
238 0x04, 0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3D, 0x1B, 0x01, 0x03, 0x1C, 0x38, 0x07, 0x36,
239 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74,
240 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70,
241 0x65, 0x72, 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xA5, 0x8F,
242 0x5F, 0x7F, 0x18, 0x1A, 0x98, 0x14, 0x2E, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xCA, 0xFD, 0x19,
243 0x4C, 0x6C, 0x1B, 0x95, 0xD4, 0x2B, 0x15, 0x01, 0xE3, 0x87, 0x1F, 0xD7, 0xF2, 0x3D, 0x3E, 0x2E,
244 0x64, 0xAA, 0x60, 0x63, 0x51, 0xB3, 0x52, 0xBC, 0x6D, 0x24, 0x0C, 0x6D, 0x38, 0x02, 0x20, 0x0E,
245 0x21, 0xF1, 0x51, 0x39, 0x2D, 0x4A, 0x45, 0x05, 0x45, 0xFA, 0x85, 0xA7, 0xCC, 0x00, 0xFE, 0x89,
246 0x8A, 0xD6, 0xD7, 0x34, 0x0D, 0x31, 0x6A, 0x94, 0xAE, 0x1F, 0xD8, 0x07, 0xF1, 0xDF, 0x80
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500247 }};
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800248};
249
250struct RsaDataset
251{
252 const std::string name = "Rsa";
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500253 const Block cert{{
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800254 0x06, 0xFD, 0x02, 0xED, 0x07, 0x48, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79,
255 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
256 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700257 0x4B, 0x45, 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE, 0xDB, 0xE7, 0x2E, 0xC6, 0xC7, 0x08, 0x04, 0x73,
258 0x65, 0x6C, 0x66, 0x08, 0x09, 0xFD, 0x00, 0x00, 0x01, 0x72, 0xCE, 0xA8, 0xE7, 0xA4, 0x14, 0x09,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800259 0x18, 0x01, 0x02, 0x19, 0x04, 0x00, 0x36, 0xEE, 0x80, 0x15, 0xFD, 0x01, 0x26, 0x30, 0x82, 0x01,
260 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700261 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xED, 0x32,
262 0x03, 0x4A, 0xC1, 0xC4, 0x73, 0xA7, 0xC3, 0x3C, 0xB3, 0x09, 0x62, 0xF7, 0xA7, 0x5F, 0x83, 0x98,
263 0xBD, 0x8A, 0x9F, 0xB3, 0x02, 0x02, 0x53, 0xF1, 0x62, 0x78, 0xE0, 0x08, 0x42, 0x48, 0xC7, 0x81,
264 0x2E, 0xA5, 0xD4, 0x9E, 0x7D, 0xD1, 0x38, 0x51, 0x8C, 0xAB, 0x18, 0x87, 0xC5, 0x0B, 0x57, 0x1C,
265 0x01, 0xD7, 0xA9, 0x4B, 0xA8, 0xD8, 0xEB, 0x96, 0x95, 0xAC, 0x09, 0xBC, 0xCE, 0xF4, 0x3E, 0xE5,
266 0x8D, 0x72, 0x81, 0x30, 0x30, 0xBA, 0xB7, 0xA2, 0x0D, 0xFE, 0x21, 0x2F, 0x97, 0x76, 0x59, 0x80,
267 0xC2, 0x92, 0x1B, 0x16, 0xF9, 0x15, 0xE3, 0xF5, 0xA0, 0x2C, 0x87, 0xAB, 0x88, 0x5B, 0x6E, 0x73,
268 0x36, 0xDB, 0xE4, 0xF0, 0x19, 0x78, 0x93, 0x26, 0xC3, 0x39, 0x33, 0x27, 0xBE, 0x06, 0x33, 0x84,
269 0x9C, 0xA8, 0x8A, 0xF7, 0x41, 0x82, 0xAD, 0xE4, 0x25, 0x86, 0xCC, 0x32, 0x1D, 0x5A, 0x8C, 0x52,
270 0x2F, 0x91, 0xD9, 0xD1, 0x31, 0x3F, 0x07, 0xF9, 0x43, 0xF9, 0xA8, 0xE7, 0x92, 0x70, 0xF4, 0xB0,
271 0x2F, 0xE1, 0x76, 0x91, 0x42, 0x9C, 0xB9, 0xF3, 0x69, 0x88, 0xD3, 0x36, 0x75, 0x5C, 0x13, 0x18,
272 0x85, 0xAA, 0x17, 0xCE, 0x5F, 0x0D, 0x49, 0xED, 0x79, 0xB2, 0x7F, 0x00, 0xF4, 0x5F, 0xD7, 0x29,
273 0xD2, 0xB3, 0x1E, 0xA6, 0xFC, 0x7E, 0x0C, 0xCD, 0x6A, 0x5F, 0xC6, 0x68, 0x46, 0x4C, 0x8A, 0x71,
274 0x57, 0x08, 0x86, 0xCD, 0xD4, 0xD2, 0x89, 0x37, 0x46, 0xAA, 0x79, 0xA9, 0x3A, 0x13, 0xB0, 0xA0,
275 0x63, 0x86, 0xA2, 0x18, 0xC6, 0xB3, 0x8C, 0x59, 0x5D, 0xF7, 0x6F, 0x77, 0xC3, 0x16, 0x42, 0xA7,
276 0x9A, 0x3F, 0xF9, 0x07, 0xB4, 0x5A, 0x7B, 0xE3, 0xA6, 0xF1, 0x76, 0xC5, 0x58, 0xB2, 0xC2, 0xAC,
277 0x7C, 0x02, 0x9A, 0xB2, 0xD1, 0x2B, 0xBC, 0x23, 0x11, 0x9F, 0xEB, 0x6F, 0xB4, 0x73, 0x02, 0x03,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800278 0x01, 0x00, 0x01, 0x16, 0x68, 0x1B, 0x01, 0x01, 0x1C, 0x39, 0x07, 0x37, 0x08, 0x08, 0x53, 0x65,
279 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69,
280 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700281 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE, 0xDB, 0xE7,
282 0x2E, 0xC6, 0xC7, 0xFD, 0x00, 0xFD, 0x26, 0xFD, 0x00, 0xFE, 0x0F, 0x31, 0x39, 0x37, 0x30, 0x30,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800283 0x31, 0x30, 0x31, 0x54, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xFD, 0x00, 0xFF, 0x0F, 0x32, 0x30,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700284 0x34, 0x30, 0x30, 0x36, 0x31, 0x34, 0x54, 0x32, 0x32, 0x31, 0x37, 0x35, 0x35, 0x17, 0xFD, 0x01,
285 0x00, 0x0F, 0x4D, 0x43, 0x2F, 0x6E, 0xCC, 0xB3, 0xAA, 0x8A, 0x50, 0xBB, 0x3D, 0x92, 0xE6, 0xB7,
286 0xFB, 0xD4, 0xEA, 0x20, 0xB4, 0xF8, 0xF0, 0xD8, 0x03, 0x45, 0xB3, 0xFB, 0x82, 0xCE, 0xDB, 0xCE,
287 0x1F, 0xC7, 0x61, 0x58, 0x9D, 0x33, 0xAD, 0xA8, 0xFC, 0xB9, 0x31, 0x7F, 0xCF, 0x8D, 0x9C, 0xDF,
288 0x4C, 0x29, 0x25, 0xD6, 0x78, 0x8F, 0xCC, 0xC4, 0xF9, 0xF8, 0x88, 0xA9, 0x66, 0x7E, 0xD9, 0x4A,
289 0xB2, 0x6F, 0x2A, 0x60, 0xB8, 0x43, 0xCC, 0x46, 0xC3, 0x88, 0x93, 0xC8, 0x0C, 0xD3, 0x87, 0x70,
290 0xDA, 0x59, 0x16, 0xF1, 0x37, 0xD0, 0xB5, 0xF0, 0x92, 0x9E, 0xBC, 0xAE, 0xA2, 0x3A, 0x96, 0xB1,
291 0x36, 0x26, 0x8E, 0x43, 0xA7, 0x33, 0xEB, 0x13, 0x8C, 0x57, 0x02, 0x20, 0xCB, 0x97, 0xB7, 0x78,
292 0x08, 0x58, 0x07, 0x77, 0x66, 0xE9, 0x5D, 0xCB, 0xCD, 0x1E, 0x0D, 0x36, 0x43, 0x23, 0x64, 0x8E,
293 0x48, 0x66, 0x60, 0xF6, 0xF4, 0x4C, 0xD6, 0x9E, 0xAF, 0x3C, 0xC6, 0x23, 0x03, 0x09, 0x8A, 0xB1,
294 0x26, 0xDA, 0x82, 0x6D, 0xA2, 0x3D, 0x0C, 0x36, 0x56, 0x76, 0x9A, 0x62, 0xBB, 0xDD, 0x0C, 0x91,
295 0xB3, 0x8D, 0x0D, 0x9B, 0x55, 0x17, 0xC3, 0xFA, 0x26, 0xC3, 0xE5, 0x77, 0xB3, 0x55, 0x5C, 0xB7,
296 0xC9, 0x74, 0x86, 0xD1, 0xEE, 0xDF, 0xEB, 0xAF, 0xC6, 0x4D, 0x42, 0x3F, 0x09, 0x6A, 0x44, 0x7F,
297 0xB9, 0xC1, 0xE9, 0xAB, 0xBF, 0xBA, 0xED, 0xDD, 0xE9, 0x09, 0x11, 0x8C, 0x03, 0x1E, 0x5A, 0xA6,
298 0x74, 0xF1, 0x39, 0x71, 0xF3, 0x71, 0x26, 0xD5, 0xF2, 0x87, 0xBC, 0x1A, 0x6D, 0xD2, 0x37, 0xC6,
299 0x3E, 0xFA, 0xE6, 0xB9, 0x8E, 0x08, 0x82, 0x50, 0xCA, 0xEE, 0x7F, 0x5D, 0x80, 0x65, 0xBA, 0x10,
300 0x1F, 0x24, 0xC1, 0x15, 0x78, 0xB7, 0x90, 0xE5, 0x3D, 0xDA, 0x0F, 0x0E, 0x03, 0x20, 0xC1, 0xEA,
301 0x85
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500302 }};
303 const Block goodData{{
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800304 0x06, 0xFD, 0x01, 0x5B, 0x07, 0x11, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61,
305 0x74, 0x61, 0x08, 0x03, 0x52, 0x73, 0x61, 0x14, 0x00, 0x15, 0x00, 0x16, 0x3E, 0x1B, 0x01, 0x01,
306 0x1C, 0x39, 0x07, 0x37, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17,
307 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E,
308 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, 0x4B, 0x45,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700309 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE, 0xDB, 0xE7, 0x2E, 0xC6, 0xC7, 0x17, 0xFD, 0x01, 0x00, 0x15,
310 0x5E, 0x36, 0xEB, 0x43, 0x60, 0x9E, 0x06, 0xC1, 0x2A, 0xC8, 0x92, 0xAC, 0x0B, 0xC9, 0x8D, 0xEB,
311 0x54, 0x4A, 0x3A, 0xC4, 0x88, 0x3C, 0x51, 0x67, 0x19, 0x93, 0x68, 0xC7, 0xD5, 0x70, 0xE7, 0x2C,
312 0xB1, 0x78, 0xEA, 0x6A, 0x84, 0x5A, 0x7A, 0x5E, 0xAA, 0x43, 0xE7, 0x09, 0x3E, 0xF8, 0xF1, 0x7C,
313 0x9C, 0xE7, 0x72, 0x2D, 0x7B, 0x77, 0xD0, 0xD9, 0x86, 0x6B, 0x05, 0xE9, 0xA7, 0x83, 0x7C, 0xAB,
314 0x16, 0xDF, 0x0D, 0x36, 0x37, 0x74, 0x6E, 0xBC, 0x42, 0x2F, 0xFE, 0xDE, 0x40, 0x03, 0x2B, 0xC0,
315 0x7E, 0xF8, 0x67, 0xD7, 0x38, 0xD7, 0xE8, 0x7C, 0xCF, 0xCE, 0x9D, 0x14, 0x39, 0xDE, 0xF1, 0x02,
316 0x9E, 0xC4, 0x9B, 0xD6, 0x46, 0xBA, 0x57, 0xF9, 0x76, 0xB2, 0x25, 0xD4, 0x0A, 0xB5, 0x31, 0x09,
317 0x36, 0x77, 0xF4, 0xDB, 0xC7, 0xD2, 0xD9, 0x14, 0xB0, 0x98, 0xAC, 0x48, 0x7C, 0x30, 0x90, 0xE2,
318 0x1E, 0xF1, 0xF5, 0xC5, 0x69, 0xE4, 0xA5, 0xBE, 0xF7, 0x9C, 0x74, 0x97, 0x97, 0xE6, 0xA4, 0x41,
319 0x75, 0xDF, 0x8D, 0xFB, 0x2E, 0x9E, 0xA0, 0x57, 0xBB, 0x96, 0xE5, 0x81, 0x9F, 0xF7, 0x95, 0x7B,
320 0x6A, 0x2C, 0xE3, 0xF8, 0x48, 0x0C, 0xB2, 0x3F, 0xB6, 0xCF, 0xB8, 0x7F, 0x08, 0x24, 0x77, 0x44,
321 0x9A, 0x7F, 0x34, 0x35, 0xFF, 0x68, 0x7E, 0x61, 0x2C, 0x09, 0xF9, 0x0A, 0xAD, 0xBE, 0x57, 0xD3,
322 0x2A, 0x2A, 0x9E, 0xE0, 0x8E, 0x5B, 0x79, 0x1C, 0x4C, 0x32, 0x8D, 0xFA, 0xBF, 0xEE, 0xBB, 0xA0,
323 0x4F, 0xD9, 0xEB, 0xC1, 0x5D, 0x53, 0x15, 0xBF, 0x8C, 0x7C, 0x6B, 0x22, 0xB9, 0x24, 0x70, 0xAE,
324 0x63, 0x13, 0x96, 0x3B, 0x2A, 0xDA, 0x7F, 0x64, 0x0D, 0x9E, 0xA7, 0x90, 0x20, 0x2A, 0x2A, 0xAB,
325 0xA9, 0xA6, 0xC9, 0xB2, 0x37, 0x8E, 0xE3, 0x09, 0xFD, 0xA3, 0x68, 0x06, 0xCB, 0x96, 0x80
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500326 }};
327 const Block badSigData{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700328 0x06, 0xA2, 0x07, 0x11, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800329 0x08, 0x03, 0x52, 0x73, 0x61, 0x14, 0x00, 0x15, 0x00, 0x16, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B,
330 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65,
331 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65,
332 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700333 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x17, 0x47, 0x30, 0x45, 0x02,
334 0x20, 0x15, 0xFC, 0x4C, 0xA4, 0xBA, 0x18, 0xF9, 0x6A, 0x92, 0xC8, 0xA9, 0x62, 0x96, 0x60, 0x39,
335 0x6B, 0x74, 0x4A, 0x7C, 0x38, 0x1A, 0x83, 0x33, 0xB2, 0x40, 0x03, 0x59, 0x2C, 0xA4, 0x1A, 0xD1,
336 0x1E, 0x02, 0x21, 0x00, 0xA5, 0x62, 0xA5, 0x04, 0x60, 0xBC, 0x96, 0x54, 0x2C, 0x9E, 0x6F, 0xA8,
337 0x1B, 0xDB, 0xF9, 0xF0, 0x7E, 0xFF, 0xED, 0x92, 0x3A, 0x4B, 0xDE, 0x3D, 0x20, 0x02, 0x7B, 0xD7,
338 0x1C, 0xD0, 0xAA, 0xAB
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500339 }};
340 const Block goodInterest{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700341 0x05, 0xFD, 0x01, 0x85, 0x07, 0x37, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E,
342 0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x08, 0x03, 0x52, 0x73, 0x61, 0x02, 0x20, 0x08, 0x39, 0xEE,
343 0x12, 0xF1, 0x10, 0xB7, 0x8B, 0x49, 0xF2, 0xE2, 0x54, 0x23, 0xFF, 0x66, 0xB3, 0x0F, 0xC6, 0x91,
344 0x89, 0x59, 0x99, 0x20, 0xAA, 0x06, 0xEA, 0x8F, 0xB3, 0x3A, 0x8F, 0xB3, 0xB1, 0x0A, 0x04, 0xF7,
345 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3E, 0x1B, 0x01, 0x01, 0x1C, 0x39, 0x07, 0x37, 0x08, 0x08,
346 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
347 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
348 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE,
349 0xDB, 0xE7, 0x2E, 0xC6, 0xC7, 0x2E, 0xFD, 0x01, 0x00, 0x54, 0xD8, 0xED, 0xAB, 0x63, 0xE0, 0x89,
350 0x9D, 0x31, 0x0B, 0xD7, 0x2F, 0xF6, 0x4C, 0x4B, 0xCE, 0x2A, 0xB9, 0x65, 0x55, 0x65, 0x15, 0x4F,
351 0x1B, 0x59, 0xFF, 0xF7, 0x10, 0xB8, 0xA6, 0x33, 0x88, 0xA6, 0xCF, 0x9B, 0x23, 0x7E, 0x48, 0x83,
352 0x60, 0x59, 0xF9, 0xB5, 0x7F, 0x68, 0x2B, 0x1E, 0x2F, 0x35, 0x3B, 0x48, 0x64, 0x15, 0xD8, 0xE1,
353 0x27, 0x1F, 0xDE, 0x0A, 0x27, 0xBE, 0x7A, 0xA6, 0xFE, 0x8B, 0x01, 0x7C, 0x94, 0xDC, 0x2D, 0x4B,
354 0x2E, 0x78, 0xA0, 0xF4, 0xA2, 0x9B, 0x63, 0x47, 0x5B, 0x8C, 0x57, 0x04, 0xF3, 0x92, 0x3F, 0x4C,
355 0x84, 0x70, 0x06, 0x16, 0xD2, 0xF0, 0x49, 0x9E, 0x4E, 0x2E, 0x9A, 0xC5, 0xB0, 0xC8, 0x0F, 0x4C,
356 0xB9, 0xD0, 0x37, 0x9F, 0xEB, 0x53, 0x68, 0x1B, 0xC9, 0xBF, 0x77, 0x12, 0xBD, 0x25, 0x23, 0x38,
357 0x56, 0x63, 0x22, 0xA4, 0x52, 0xA1, 0x00, 0x47, 0x08, 0xEB, 0xC7, 0x36, 0x33, 0x46, 0xC1, 0x92,
358 0x89, 0xE4, 0xC8, 0x52, 0x05, 0xB7, 0x01, 0x2B, 0x24, 0x04, 0x56, 0xC3, 0x8C, 0x1F, 0x18, 0x78,
359 0x73, 0x99, 0xFF, 0x7B, 0x0E, 0x92, 0x3D, 0x92, 0x61, 0xF1, 0xDC, 0x55, 0xDB, 0x55, 0x8B, 0xBA,
360 0xDB, 0xD9, 0x14, 0x7C, 0x7B, 0x9B, 0xDC, 0x90, 0x15, 0xC6, 0x59, 0x80, 0xE7, 0xFC, 0x03, 0x71,
361 0x7E, 0x35, 0x05, 0x30, 0xBE, 0xED, 0xC4, 0xB2, 0x2E, 0x39, 0xDB, 0xAA, 0x2A, 0x7E, 0x50, 0x37,
362 0x4D, 0xC8, 0x3F, 0x00, 0xD8, 0xE9, 0xF1, 0x9D, 0x57, 0x43, 0x2B, 0x1C, 0x5F, 0x09, 0x18, 0xA3,
363 0xE3, 0x11, 0x85, 0xCC, 0x0E, 0xAF, 0x56, 0x6B, 0xE1, 0xAC, 0xB3, 0x20, 0xF2, 0x47, 0xFE, 0x95,
364 0xC8, 0x71, 0x99, 0xCC, 0x52, 0x8A, 0x6F, 0xF1, 0x01, 0xD6, 0xE9, 0x2E, 0x6C, 0x27, 0xC3, 0xED,
365 0xE3, 0xF2, 0xDD, 0x78, 0xB4, 0x7F, 0xFA, 0xD0, 0xC2
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500366 }};
367 const Block badSigInterest{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700368 0x05, 0xCC, 0x07, 0x37, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
369 0x72, 0x65, 0x73, 0x74, 0x08, 0x03, 0x52, 0x73, 0x61, 0x02, 0x20, 0x64, 0xE3, 0x6F, 0xD5, 0x73,
370 0x21, 0xBC, 0xAB, 0xDE, 0xDE, 0x0F, 0x99, 0xCB, 0x49, 0x7F, 0x46, 0xE7, 0xF0, 0x7A, 0xF1, 0x2C,
371 0xF9, 0x36, 0xE0, 0xBD, 0x3A, 0x8A, 0x1C, 0x08, 0x6A, 0xD1, 0x21, 0x0A, 0x04, 0xF7, 0x2C, 0x8A,
372 0x4B, 0x24, 0x00, 0x2C, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65,
373 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69,
374 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08,
375 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A,
376 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x2E, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xC3, 0x9A, 0xDC, 0x5A,
377 0x59, 0x10, 0x4D, 0x29, 0x9A, 0x64, 0x8D, 0x18, 0xBD, 0x27, 0x73, 0xBB, 0x98, 0xAB, 0xE9, 0xF2,
378 0x4A, 0xBF, 0xC0, 0x5B, 0xA8, 0x05, 0xA2, 0xC8, 0x61, 0xC4, 0x2E, 0x64, 0x02, 0x20, 0x1F, 0x5E,
379 0xF5, 0x8E, 0xC9, 0xDC, 0x9E, 0x15, 0x1C, 0xFA, 0x58, 0x5F, 0xDF, 0xAE, 0xA0, 0xFD, 0xDA, 0x34,
380 0x21, 0xE0, 0xA8, 0x2D, 0x32, 0x47, 0x9E, 0x44, 0x83, 0x79, 0x23, 0x5F, 0xBE, 0x16
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500381 }};
382 const Block goodInterestOldFormat{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700383 0x05, 0xFD, 0x01, 0x85, 0x07, 0x37, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E,
384 0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x08, 0x03, 0x52, 0x73, 0x61, 0x02, 0x20, 0x08, 0x39, 0xEE,
385 0x12, 0xF1, 0x10, 0xB7, 0x8B, 0x49, 0xF2, 0xE2, 0x54, 0x23, 0xFF, 0x66, 0xB3, 0x0F, 0xC6, 0x91,
386 0x89, 0x59, 0x99, 0x20, 0xAA, 0x06, 0xEA, 0x8F, 0xB3, 0x3A, 0x8F, 0xB3, 0xB1, 0x0A, 0x04, 0xF7,
387 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3E, 0x1B, 0x01, 0x01, 0x1C, 0x39, 0x07, 0x37, 0x08, 0x08,
388 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
389 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
390 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE,
391 0xDB, 0xE7, 0x2E, 0xC6, 0xC7, 0x2E, 0xFD, 0x01, 0x00, 0x54, 0xD8, 0xED, 0xAB, 0x63, 0xE0, 0x89,
392 0x9D, 0x31, 0x0B, 0xD7, 0x2F, 0xF6, 0x4C, 0x4B, 0xCE, 0x2A, 0xB9, 0x65, 0x55, 0x65, 0x15, 0x4F,
393 0x1B, 0x59, 0xFF, 0xF7, 0x10, 0xB8, 0xA6, 0x33, 0x88, 0xA6, 0xCF, 0x9B, 0x23, 0x7E, 0x48, 0x83,
394 0x60, 0x59, 0xF9, 0xB5, 0x7F, 0x68, 0x2B, 0x1E, 0x2F, 0x35, 0x3B, 0x48, 0x64, 0x15, 0xD8, 0xE1,
395 0x27, 0x1F, 0xDE, 0x0A, 0x27, 0xBE, 0x7A, 0xA6, 0xFE, 0x8B, 0x01, 0x7C, 0x94, 0xDC, 0x2D, 0x4B,
396 0x2E, 0x78, 0xA0, 0xF4, 0xA2, 0x9B, 0x63, 0x47, 0x5B, 0x8C, 0x57, 0x04, 0xF3, 0x92, 0x3F, 0x4C,
397 0x84, 0x70, 0x06, 0x16, 0xD2, 0xF0, 0x49, 0x9E, 0x4E, 0x2E, 0x9A, 0xC5, 0xB0, 0xC8, 0x0F, 0x4C,
398 0xB9, 0xD0, 0x37, 0x9F, 0xEB, 0x53, 0x68, 0x1B, 0xC9, 0xBF, 0x77, 0x12, 0xBD, 0x25, 0x23, 0x38,
399 0x56, 0x63, 0x22, 0xA4, 0x52, 0xA1, 0x00, 0x47, 0x08, 0xEB, 0xC7, 0x36, 0x33, 0x46, 0xC1, 0x92,
400 0x89, 0xE4, 0xC8, 0x52, 0x05, 0xB7, 0x01, 0x2B, 0x24, 0x04, 0x56, 0xC3, 0x8C, 0x1F, 0x18, 0x78,
401 0x73, 0x99, 0xFF, 0x7B, 0x0E, 0x92, 0x3D, 0x92, 0x61, 0xF1, 0xDC, 0x55, 0xDB, 0x55, 0x8B, 0xBA,
402 0xDB, 0xD9, 0x14, 0x7C, 0x7B, 0x9B, 0xDC, 0x90, 0x15, 0xC6, 0x59, 0x80, 0xE7, 0xFC, 0x03, 0x71,
403 0x7E, 0x35, 0x05, 0x30, 0xBE, 0xED, 0xC4, 0xB2, 0x2E, 0x39, 0xDB, 0xAA, 0x2A, 0x7E, 0x50, 0x37,
404 0x4D, 0xC8, 0x3F, 0x00, 0xD8, 0xE9, 0xF1, 0x9D, 0x57, 0x43, 0x2B, 0x1C, 0x5F, 0x09, 0x18, 0xA3,
405 0xE3, 0x11, 0x85, 0xCC, 0x0E, 0xAF, 0x56, 0x6B, 0xE1, 0xAC, 0xB3, 0x20, 0xF2, 0x47, 0xFE, 0x95,
406 0xC8, 0x71, 0x99, 0xCC, 0x52, 0x8A, 0x6F, 0xF1, 0x01, 0xD6, 0xE9, 0x2E, 0x6C, 0x27, 0xC3, 0xED,
407 0xE3, 0xF2, 0xDD, 0x78, 0xB4, 0x7F, 0xFA, 0xD0, 0xC2
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500408 }};
409 const Block badSigInterestOldFormat{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700410 0x05, 0xFD, 0x02, 0x15, 0x07, 0xC7, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E,
411 0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x08, 0x03, 0x52, 0x73, 0x61, 0x02, 0x20, 0x08, 0x39, 0xEE,
412 0x12, 0xF1, 0x10, 0xB7, 0x8B, 0x49, 0xF2, 0xE2, 0x54, 0x23, 0xFF, 0x66, 0xB3, 0x0F, 0xC6, 0x91,
413 0x89, 0x59, 0x99, 0x20, 0xAA, 0x06, 0xEA, 0x8F, 0xB3, 0x3A, 0x8F, 0xB3, 0xB1, 0x08, 0x42, 0x16,
414 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800415 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700416 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F,
417 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E,
418 0x43, 0x08, 0x4A, 0x17, 0x48, 0x30, 0x46, 0x02, 0x21, 0x00, 0x9D, 0x24, 0x46, 0x3D, 0x37, 0xAE,
419 0x81, 0xB7, 0x7C, 0x2C, 0x86, 0x8A, 0x34, 0xEF, 0xC8, 0xC8, 0xB0, 0x18, 0x78, 0x3E, 0xA3, 0xE5,
420 0xED, 0x31, 0x93, 0x26, 0x73, 0x0E, 0x58, 0xE8, 0xF8, 0x47, 0x02, 0x21, 0x00, 0xFD, 0x82, 0xD2,
421 0x69, 0xEF, 0xB0, 0x72, 0xE8, 0xCA, 0x33, 0x43, 0xEB, 0x27, 0xB1, 0xDD, 0xB6, 0xD1, 0x97, 0x14,
422 0x43, 0xC5, 0xA9, 0xFC, 0x87, 0x59, 0xAF, 0x87, 0xF3, 0x02, 0x2C, 0x59, 0x2E, 0x0A, 0x04, 0xF7,
423 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3E, 0x1B, 0x01, 0x01, 0x1C, 0x39, 0x07, 0x37, 0x08, 0x08,
424 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
425 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
426 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE,
427 0xDB, 0xE7, 0x2E, 0xC6, 0xC7, 0x2E, 0xFD, 0x01, 0x00, 0x54, 0xD8, 0xED, 0xAB, 0x63, 0xE0, 0x89,
428 0x9D, 0x31, 0x0B, 0xD7, 0x2F, 0xF6, 0x4C, 0x4B, 0xCE, 0x2A, 0xB9, 0x65, 0x55, 0x65, 0x15, 0x4F,
429 0x1B, 0x59, 0xFF, 0xF7, 0x10, 0xB8, 0xA6, 0x33, 0x88, 0xA6, 0xCF, 0x9B, 0x23, 0x7E, 0x48, 0x83,
430 0x60, 0x59, 0xF9, 0xB5, 0x7F, 0x68, 0x2B, 0x1E, 0x2F, 0x35, 0x3B, 0x48, 0x64, 0x15, 0xD8, 0xE1,
431 0x27, 0x1F, 0xDE, 0x0A, 0x27, 0xBE, 0x7A, 0xA6, 0xFE, 0x8B, 0x01, 0x7C, 0x94, 0xDC, 0x2D, 0x4B,
432 0x2E, 0x78, 0xA0, 0xF4, 0xA2, 0x9B, 0x63, 0x47, 0x5B, 0x8C, 0x57, 0x04, 0xF3, 0x92, 0x3F, 0x4C,
433 0x84, 0x70, 0x06, 0x16, 0xD2, 0xF0, 0x49, 0x9E, 0x4E, 0x2E, 0x9A, 0xC5, 0xB0, 0xC8, 0x0F, 0x4C,
434 0xB9, 0xD0, 0x37, 0x9F, 0xEB, 0x53, 0x68, 0x1B, 0xC9, 0xBF, 0x77, 0x12, 0xBD, 0x25, 0x23, 0x38,
435 0x56, 0x63, 0x22, 0xA4, 0x52, 0xA1, 0x00, 0x47, 0x08, 0xEB, 0xC7, 0x36, 0x33, 0x46, 0xC1, 0x92,
436 0x89, 0xE4, 0xC8, 0x52, 0x05, 0xB7, 0x01, 0x2B, 0x24, 0x04, 0x56, 0xC3, 0x8C, 0x1F, 0x18, 0x78,
437 0x73, 0x99, 0xFF, 0x7B, 0x0E, 0x92, 0x3D, 0x92, 0x61, 0xF1, 0xDC, 0x55, 0xDB, 0x55, 0x8B, 0xBA,
438 0xDB, 0xD9, 0x14, 0x7C, 0x7B, 0x9B, 0xDC, 0x90, 0x15, 0xC6, 0x59, 0x80, 0xE7, 0xFC, 0x03, 0x71,
439 0x7E, 0x35, 0x05, 0x30, 0xBE, 0xED, 0xC4, 0xB2, 0x2E, 0x39, 0xDB, 0xAA, 0x2A, 0x7E, 0x50, 0x37,
440 0x4D, 0xC8, 0x3F, 0x00, 0xD8, 0xE9, 0xF1, 0x9D, 0x57, 0x43, 0x2B, 0x1C, 0x5F, 0x09, 0x18, 0xA3,
441 0xE3, 0x11, 0x85, 0xCC, 0x0E, 0xAF, 0x56, 0x6B, 0xE1, 0xAC, 0xB3, 0x20, 0xF2, 0x47, 0xFE, 0x95,
442 0xC8, 0x71, 0x99, 0xCC, 0x52, 0x8A, 0x6F, 0xF1, 0x01, 0xD6, 0xE9, 0x2E, 0x6C, 0x27, 0xC3, 0xED,
443 0xE3, 0xF2, 0xDD, 0x78, 0xB4, 0x7F, 0xFA, 0xD0, 0xC2
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500444 }};
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800445};
446
447struct Sha256Dataset
448{
449 const std::string name = "Sha256";
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500450 const Block cert{{
451 }};
452 const Block goodData{{
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800453 0x06, 0x41, 0x07, 0x14, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
454 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x14, 0x00, 0x15, 0x00, 0x16, 0x03, 0x1B, 0x01,
455 0x00, 0x17, 0x20, 0xE2, 0xE2, 0x2F, 0x02, 0x70, 0xA7, 0xF7, 0x48, 0x70, 0x45, 0x29, 0x46, 0xBD,
456 0xD2, 0x62, 0x24, 0xA6, 0x1E, 0x1D, 0x75, 0x2A, 0x26, 0x98, 0x04, 0xAD, 0x9C, 0x47, 0x63, 0xF8,
457 0x98, 0x5A, 0x49
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500458 }};
459 const Block badSigData{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700460 0x06, 0xA6, 0x07, 0x14, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800461 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x14, 0x00, 0x15, 0x00, 0x16, 0x40, 0x1B, 0x01,
462 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08,
463 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F,
464 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700465 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x17, 0x48,
466 0x30, 0x46, 0x02, 0x21, 0x00, 0xF0, 0x72, 0x9A, 0x68, 0x36, 0xC5, 0xAA, 0x9D, 0x75, 0x03, 0x36,
467 0xDA, 0xAA, 0x80, 0x0C, 0x29, 0xEE, 0xC9, 0x48, 0x95, 0xA2, 0xEC, 0xAB, 0x78, 0x28, 0x3B, 0x9D,
468 0x28, 0x19, 0x6C, 0x5C, 0xD6, 0x02, 0x21, 0x00, 0xF0, 0xD2, 0x23, 0xEA, 0xD9, 0x43, 0x6D, 0x8A,
469 0xD2, 0x02, 0x3F, 0xF1, 0x41, 0x12, 0xA6, 0xED, 0x87, 0xB3, 0xD5, 0x5A, 0x27, 0x5D, 0x4E, 0xEB,
470 0x13, 0x29, 0x01, 0xBC, 0x3C, 0xCC, 0x50, 0x61
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500471 }};
472 const Block goodInterest{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700473 0x05, 0x6B, 0x07, 0x3A, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
474 0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x8F, 0x03,
475 0x0B, 0x85, 0xA7, 0x05, 0xD8, 0x05, 0x31, 0x8E, 0x80, 0x81, 0xD3, 0xE2, 0xA8, 0x5E, 0x74, 0xD7,
476 0x4F, 0x3A, 0xDC, 0xFF, 0x9C, 0x44, 0xF6, 0xA1, 0xC6, 0x6B, 0x97, 0x99, 0x8E, 0xDA, 0x0A, 0x04,
477 0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x03, 0x1B, 0x01, 0x00, 0x2E, 0x20, 0xEF, 0x45, 0x55,
478 0x75, 0xC8, 0x18, 0x5E, 0xE9, 0x2A, 0xAE, 0x52, 0x61, 0x0A, 0x94, 0x41, 0x03, 0x36, 0x4C, 0x13,
479 0x59, 0xD4, 0xC7, 0xA4, 0x3A, 0xA0, 0x40, 0x61, 0x44, 0x33, 0x93, 0x5E, 0x99
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500480 }};
481 const Block badSigInterest{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700482 0x05, 0xCE, 0x07, 0x3A, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
483 0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x32, 0x3F,
484 0x2F, 0xA3, 0xDC, 0x15, 0x7E, 0x8C, 0xA9, 0x75, 0xF7, 0x66, 0xFF, 0xFD, 0x13, 0x42, 0x1B, 0xE1,
485 0x3A, 0x27, 0xDD, 0xE4, 0x98, 0x42, 0x77, 0xFA, 0xAD, 0x8F, 0x3E, 0x91, 0x75, 0xF9, 0x0A, 0x04,
486 0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08,
487 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56,
488 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65,
489 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08,
490 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x2E, 0x46, 0x30, 0x44, 0x02, 0x20, 0x0C, 0xA0,
491 0x6F, 0x90, 0xEF, 0x5E, 0x04, 0x15, 0xAF, 0x94, 0x8E, 0x33, 0x12, 0x1F, 0xF9, 0x50, 0xDD, 0x49,
492 0x73, 0xB3, 0xA6, 0xD2, 0x99, 0x32, 0x26, 0xE2, 0x46, 0x3A, 0xE0, 0x69, 0xDF, 0xB2, 0x02, 0x20,
493 0x6A, 0x03, 0xCE, 0xB6, 0x85, 0x1E, 0x01, 0x5E, 0xF8, 0x48, 0xDE, 0x65, 0xB9, 0xE1, 0xEB, 0x9A,
494 0xF8, 0x47, 0x43, 0x5B, 0xBA, 0x63, 0xCB, 0xBA, 0xFB, 0x62, 0x1C, 0x38, 0xE8, 0x53, 0xF7, 0x29
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500495 }};
496 const Block goodInterestOldFormat{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700497 0x05, 0x6B, 0x07, 0x3A, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
498 0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x8F, 0x03,
499 0x0B, 0x85, 0xA7, 0x05, 0xD8, 0x05, 0x31, 0x8E, 0x80, 0x81, 0xD3, 0xE2, 0xA8, 0x5E, 0x74, 0xD7,
500 0x4F, 0x3A, 0xDC, 0xFF, 0x9C, 0x44, 0xF6, 0xA1, 0xC6, 0x6B, 0x97, 0x99, 0x8E, 0xDA, 0x0A, 0x04,
501 0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x03, 0x1B, 0x01, 0x00, 0x2E, 0x20, 0xEF, 0x45, 0x55,
502 0x75, 0xC8, 0x18, 0x5E, 0xE9, 0x2A, 0xAE, 0x52, 0x61, 0x0A, 0x94, 0x41, 0x03, 0x36, 0x4C, 0x13,
503 0x59, 0xD4, 0xC7, 0xA4, 0x3A, 0xA0, 0x40, 0x61, 0x44, 0x33, 0x93, 0x5E, 0x99
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500504 }};
505 const Block badSigInterestOldFormat{{
Eric Newberryb74bbda2020-06-18 19:33:58 -0700506 0x05, 0xFA, 0x07, 0xC9, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
507 0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x8F, 0x03,
508 0x0B, 0x85, 0xA7, 0x05, 0xD8, 0x05, 0x31, 0x8E, 0x80, 0x81, 0xD3, 0xE2, 0xA8, 0x5E, 0x74, 0xD7,
509 0x4F, 0x3A, 0xDC, 0xFF, 0x9C, 0x44, 0xF6, 0xA1, 0xC6, 0x6B, 0x97, 0x99, 0x8E, 0xDA, 0x08, 0x42,
510 0x16, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72,
511 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63,
512 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, 0x72,
513 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D,
514 0x6E, 0x43, 0x08, 0x49, 0x17, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xB3, 0x30, 0x0A, 0x93, 0x16,
515 0x16, 0xBB, 0xD0, 0x3C, 0x73, 0x01, 0xED, 0x0D, 0x40, 0xEE, 0x28, 0x69, 0xA6, 0xAA, 0xF0, 0x34,
516 0x44, 0xBD, 0x7E, 0x1F, 0xBF, 0x6D, 0x7C, 0x52, 0xA1, 0x85, 0x1D, 0x02, 0x20, 0x3F, 0x18, 0x66,
517 0x48, 0xC9, 0x0F, 0x5B, 0x18, 0xB0, 0xD0, 0x45, 0xDE, 0x93, 0xA6, 0x21, 0xA0, 0xDC, 0x7E, 0x47,
518 0x3A, 0x61, 0x56, 0xD2, 0xAE, 0x70, 0x8D, 0xE8, 0xD5, 0xB7, 0xD0, 0x12, 0x35, 0x0A, 0x04, 0xF7,
519 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x03, 0x1B, 0x01, 0x00, 0x2E, 0x20, 0xEF, 0x45, 0x55, 0x75,
520 0xC8, 0x18, 0x5E, 0xE9, 0x2A, 0xAE, 0x52, 0x61, 0x0A, 0x94, 0x41, 0x03, 0x36, 0x4C, 0x13, 0x59,
521 0xD4, 0xC7, 0xA4, 0x3A, 0xA0, 0x40, 0x61, 0x44, 0x33, 0x93, 0x5E, 0x99
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500522 }};
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800523};
524
525// Note about the datasets:
526// - .cert a valid certificate
Eric Newberryb74bbda2020-06-18 19:33:58 -0700527// - .goodData is a Data packet that can be verified against .cert
528// - .badSigData a valid and signed Data packet that cannot be verified against cert (signed using
529// a different private key)
530// - .goodInterest is an Interest packet that can be verified against .cert
531// - .badSigInterest is a valid and signed Interest packet that cannot be verified against .cert
532// (signed using a different private key)
533// - .goodInterestOldFormat is an Interest packet that can be verified against .cert (in the old
534// signed Interest format)
535// - .badSigInterestOldFormat is a valid and signed Interest packet that cannot be verified against
536// .cert (signed using a different private key and in the old signed Interest format)
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800537
Davide Pesavento49e1e872023-11-11 00:45:23 -0500538using SignatureDatasets = boost::mp11::mp_list<EcdsaDataset, RsaDataset>;
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800539
540BOOST_AUTO_TEST_CASE_TEMPLATE(VerifySignature, Dataset, SignatureDatasets)
541{
Davide Pesavento809f7542021-03-24 18:53:05 -0400542 const Dataset dataset;
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500543 Certificate cert(dataset.cert);
544 auto keyRaw = cert.getPublicKey();
Davide Pesavento77d9e812019-06-03 22:05:54 -0400545 transform::PublicKey key;
Davide Pesavento765abc92021-12-27 00:44:04 -0500546 key.loadPkcs8(keyRaw);
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500547
548 Data data(dataset.goodData);
549 Data badSigData(dataset.badSigData);
550 Interest interest(dataset.goodInterest);
551 Interest badSigInterest(dataset.badSigInterest);
552 Interest interestOldFormat(dataset.goodInterestOldFormat);
553 Interest badSigInterestOldFormat(dataset.badSigInterestOldFormat);
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800554
555 BOOST_CHECK(verifySignature(data, key));
Davide Pesavento35c63792022-01-17 02:06:03 -0500556 BOOST_CHECK(verifySignature(data, keyRaw));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800557 BOOST_CHECK(verifySignature(data, cert));
558 BOOST_CHECK(verifySignature(interest, key));
Davide Pesavento35c63792022-01-17 02:06:03 -0500559 BOOST_CHECK(verifySignature(interest, keyRaw));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800560 BOOST_CHECK(verifySignature(interest, cert));
Eric Newberryb74bbda2020-06-18 19:33:58 -0700561 BOOST_CHECK(verifySignature(interestOldFormat, key));
Davide Pesavento35c63792022-01-17 02:06:03 -0500562 BOOST_CHECK(verifySignature(interestOldFormat, keyRaw));
Eric Newberryb74bbda2020-06-18 19:33:58 -0700563 BOOST_CHECK(verifySignature(interestOldFormat, cert));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800564
565 BOOST_CHECK(!verifySignature(badSigData, key));
Davide Pesavento35c63792022-01-17 02:06:03 -0500566 BOOST_CHECK(!verifySignature(badSigData, keyRaw));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800567 BOOST_CHECK(!verifySignature(badSigData, cert));
568 BOOST_CHECK(!verifySignature(badSigInterest, key));
Davide Pesavento35c63792022-01-17 02:06:03 -0500569 BOOST_CHECK(!verifySignature(badSigInterest, keyRaw));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800570 BOOST_CHECK(!verifySignature(badSigInterest, cert));
Eric Newberryb74bbda2020-06-18 19:33:58 -0700571 BOOST_CHECK(!verifySignature(badSigInterestOldFormat, key));
Davide Pesavento35c63792022-01-17 02:06:03 -0500572 BOOST_CHECK(!verifySignature(badSigInterestOldFormat, keyRaw));
Eric Newberryb74bbda2020-06-18 19:33:58 -0700573 BOOST_CHECK(!verifySignature(badSigInterestOldFormat, cert));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800574
575 Data unsignedData("/some/data");
576 Interest unsignedInterest1("/some/interest/with/several/name/components");
577 Interest unsignedInterest2("/interest-with-one-name-component");
578
579 BOOST_CHECK(!verifySignature(unsignedData, cert));
580 BOOST_CHECK(!verifySignature(unsignedData, key));
581 BOOST_CHECK(!verifySignature(unsignedInterest1, cert));
582 BOOST_CHECK(!verifySignature(unsignedInterest1, key));
583 BOOST_CHECK(!verifySignature(unsignedInterest2, cert));
584 BOOST_CHECK(!verifySignature(unsignedInterest2, key));
585
Davide Pesavento35c63792022-01-17 02:06:03 -0500586 const uint8_t invalidKey[] = {0x00, 0x00};
587 BOOST_CHECK(!verifySignature(unsignedData, invalidKey));
588 BOOST_CHECK(!verifySignature(unsignedInterest1, invalidKey));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800589
590 // - base version of verifySignature is tested transitively
Alexander Afanasyev09236c22020-06-03 13:42:38 -0400591 // - pib::Key version is tested as part of key-chain.t.cpp (Security/TestKeyChain)
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800592}
593
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500594BOOST_FIXTURE_TEST_CASE(VerifyHmac, KeyChainFixture)
laqinfanbc997e52019-06-25 22:11:09 -0500595{
596 const Tpm& tpm = m_keyChain.getTpm();
597 Data data("/data");
598 Interest interest("/interest");
Eric Newberryb74bbda2020-06-18 19:33:58 -0700599 Interest interestOldFormat("/interest");
laqinfanbc997e52019-06-25 22:11:09 -0500600 SigningInfo signingInfo;
601 signingInfo.setSigningHmacKey("QjM3NEEyNkE3MTQ5MDQzN0FBMDI0RTRGQURENUI0OTdGREZGMUE4RUE2RkYxMkY2"
602 "RkI2NUFGMjcyMEI1OUNDRg==");
603 signingInfo.setDigestAlgorithm(DigestAlgorithm::SHA256);
604
605 BOOST_CHECK(!verifySignature(data, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256));
606 BOOST_CHECK(!verifySignature(interest, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256));
607
608 m_keyChain.sign(data, signingInfo);
Eric Newberryb74bbda2020-06-18 19:33:58 -0700609 signingInfo.setSignedInterestFormat(SignedInterestFormat::V03);
laqinfanbc997e52019-06-25 22:11:09 -0500610 m_keyChain.sign(interest, signingInfo);
Eric Newberryb74bbda2020-06-18 19:33:58 -0700611 signingInfo.setSignedInterestFormat(SignedInterestFormat::V02);
612 m_keyChain.sign(interestOldFormat, signingInfo);
laqinfanbc997e52019-06-25 22:11:09 -0500613 BOOST_CHECK(verifySignature(data, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256));
614 BOOST_CHECK(verifySignature(interest, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256));
Eric Newberryb74bbda2020-06-18 19:33:58 -0700615 BOOST_CHECK(verifySignature(interestOldFormat, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256));
laqinfanbc997e52019-06-25 22:11:09 -0500616}
617
Davide Pesavento49e1e872023-11-11 00:45:23 -0500618using DigestDatasets = boost::mp11::mp_list<Sha256Dataset>;
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800619
620BOOST_AUTO_TEST_CASE_TEMPLATE(VerifyDigest, Dataset, DigestDatasets)
621{
Davide Pesavento809f7542021-03-24 18:53:05 -0400622 const Dataset dataset;
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500623 Data data(dataset.goodData);
624 Data badSigData(dataset.badSigData);
625 Interest interest(dataset.goodInterest);
626 Interest badSigInterest(dataset.badSigInterest);
627 Interest interestOldFormat(dataset.goodInterestOldFormat);
628 Interest badSigInterestOldFormat(dataset.badSigInterestOldFormat);
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800629
Davide Pesaventof6b45892023-03-13 15:00:51 -0400630 BOOST_CHECK(verifySignature(data, std::nullopt));
631 BOOST_CHECK(verifySignature(interest, std::nullopt));
632 BOOST_CHECK(verifySignature(interestOldFormat, std::nullopt));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800633
Davide Pesaventof6b45892023-03-13 15:00:51 -0400634 BOOST_CHECK(!verifySignature(badSigData, std::nullopt));
635 BOOST_CHECK(!verifySignature(badSigInterest, std::nullopt));
636 BOOST_CHECK(!verifySignature(badSigInterestOldFormat, std::nullopt));
Justin Labryaef53b62021-03-10 06:07:27 +0000637
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800638 Data unsignedData("/some/data");
639 Interest unsignedInterest1("/some/interest/with/several/name/components");
640 Interest unsignedInterest2("/interest-with-one-name-component");
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800641
Davide Pesaventof6b45892023-03-13 15:00:51 -0400642 BOOST_CHECK(!verifySignature(unsignedData, std::nullopt));
643 BOOST_CHECK(!verifySignature(unsignedInterest1, std::nullopt));
644 BOOST_CHECK(!verifySignature(unsignedInterest2, std::nullopt));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800645}
646
Eric Newberrye36aae12020-08-31 22:23:13 -0700647const uint8_t sha256DataUnrecognizedElements[] = {
648 0x06, 0x47, 0x07, 0x14, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
649 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x14, 0x00, 0x15, 0x00, 0x16, 0x03, 0x1B, 0x01,
650 0x00, 0x17, 0x20, 0xE2, 0xE2, 0x2F, 0x02, 0x70, 0xA7, 0xF7, 0x48, 0x70, 0x45, 0x29, 0x46, 0xBD,
651 0xD2, 0x62, 0x24, 0xA6, 0x1E, 0x1D, 0x75, 0x2A, 0x26, 0x98, 0x04, 0xAD, 0x9C, 0x47, 0x63, 0xF8,
652 0x98, 0x5A, 0x49, 0xAA, 0x04, 0x01, 0x02, 0x03, 0x04
653};
654
655const uint8_t sha256InterestUnrecognizedElements[] = {
656 0x05, 0x71, 0x07, 0x3A, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
657 0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x9A, 0x55,
658 0xC0, 0xB5, 0x36, 0xC6, 0x6C, 0x0E, 0x11, 0x41, 0xAF, 0xA5, 0x7F, 0x0B, 0x45, 0x53, 0x3D, 0xEE,
659 0x40, 0x1B, 0x9B, 0xAF, 0xEA, 0xBF, 0x3D, 0x56, 0x89, 0x12, 0xE0, 0x18, 0x98, 0x26, 0x0A, 0x04,
660 0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x03, 0x1B, 0x01, 0x00, 0x2E, 0x20, 0xEF, 0x45, 0x55,
661 0x75, 0xC8, 0x18, 0x5E, 0xE9, 0x2A, 0xAE, 0x52, 0x61, 0x0A, 0x94, 0x41, 0x03, 0x36, 0x4C, 0x13,
662 0x59, 0xD4, 0xC7, 0xA4, 0x3A, 0xA0, 0x40, 0x61, 0x44, 0x33, 0x93, 0x5E, 0x99, 0xAA, 0x04, 0x01,
663 0x02, 0x03, 0x04
664};
665
666BOOST_AUTO_TEST_CASE(VerifyWithUnrecognizedElements) // Bug #4583
667{
Davide Pesaventofbea4fc2022-02-08 07:26:04 -0500668 Data data(Block{sha256DataUnrecognizedElements});
669 Interest interest(Block{sha256InterestUnrecognizedElements});
Eric Newberrye36aae12020-08-31 22:23:13 -0700670
Davide Pesaventof6b45892023-03-13 15:00:51 -0400671 BOOST_CHECK(verifySignature(data, std::nullopt));
672 BOOST_CHECK(verifySignature(interest, std::nullopt));
Eric Newberrye36aae12020-08-31 22:23:13 -0700673}
674
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800675BOOST_AUTO_TEST_SUITE_END() // TestVerificationHelpers
676BOOST_AUTO_TEST_SUITE_END() // Security
677
Davide Pesavento47ce2ee2023-05-09 01:33:33 -0400678} // namespace ndn::tests