blob: 74ffbe08ef5c64dc50a401b68bca811e6cc1c191 [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/*
Justin Labryaef53b62021-03-10 06:07:27 +00003 * Copyright (c) 2013-2021 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 Pesavento77d9e812019-06-03 22:05:54 -040029#include <boost/mpl/vector.hpp>
Alexander Afanasyev574aa862017-01-10 19:53:28 -080030
31namespace ndn {
32namespace security {
33namespace tests {
34
35using namespace ndn::tests;
36
37BOOST_AUTO_TEST_SUITE(Security)
38BOOST_AUTO_TEST_SUITE(TestVerificationHelpers)
39
Eric Newberryb74bbda2020-06-18 19:33:58 -070040// // Use this test case to regenerate the dataset if the signature format changes
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050041// BOOST_FIXTURE_TEST_CASE(Generator, KeyChainFixture)
Alexander Afanasyev574aa862017-01-10 19:53:28 -080042// {
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050043// Identity wrongIdentity = m_keyChain.createIdentity("/Security/TestVerificationHelpers/Wrong");
Alexander Afanasyev574aa862017-01-10 19:53:28 -080044// std::map<std::string, SigningInfo> identities = {
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -050045// {"Ecdsa", signingByIdentity(m_keyChain.createIdentity("/Security/TestVerificationHelpers/EC", EcKeyParams()))},
46// {"Rsa", signingByIdentity(m_keyChain.createIdentity("/Security/TestVerificationHelpers/RSA", RsaKeyParams()))},
Alexander Afanasyev574aa862017-01-10 19:53:28 -080047// {"Sha256", signingWithSha256()}
48// };
49
50// auto print = [] (const std::string& name, const uint8_t* buf, size_t size) {
51// std::cout << " std::vector<uint8_t> " + name + " = {\n ";
52
53// std::string hex = toHex(buf, size);
54
55// for (size_t i = 0; i < hex.size(); i++) {
56// if (i > 0 && i % 32 == 0)
57// std::cout << "\n ";
58
59// std::cout << "0x" << hex[i];
60// std::cout << hex[++i];
61
62// if ((i + 1) != hex.size())
63// std::cout << ", ";
64// }
65// std::cout << "\n };";
66// };
67
68// for (const auto& i : identities) {
69// const std::string& type = i.first;
70// const SigningInfo& signingInfo = i.second;
71
72// std::cout << "struct " + type + "Dataset\n{\n";
73// std::cout << " const std::string name = \"" << type << "\";\n";
74
Junxiao Shife1239a2017-01-27 20:36:12 +000075// if (signingInfo.getSignerType() == SigningInfo::SIGNER_TYPE_ID) {
Alexander Afanasyev574aa862017-01-10 19:53:28 -080076// print("cert", signingInfo.getPibIdentity().getDefaultKey().getDefaultCertificate().wireEncode().wire(),
77// signingInfo.getPibIdentity().getDefaultKey().getDefaultCertificate().wireEncode().size());
78// }
79// else {
80// print("cert", nullptr, 0);
81// }
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);
87// print("goodData", data.wireEncode().wire(), data.wireEncode().size());
88// std::cout << "\n";
89
90// // Create data that cannot be verified by cert
91// m_keyChain.sign(data, signingByIdentity(wrongIdentity));
92// print("badSigData", data.wireEncode().wire(), data.wireEncode().size());
93// 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);
99// interest1.setCanBePrefix(false);
100// interest1.setNonce(0xF72C8A4B);
101// m_keyChain.sign(interest1, signingInfoV03);
102// print("goodInterest", interest1.wireEncode().wire(), interest1.wireEncode().size());
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800103// std::cout << "\n";
104
105// // Create interest that cannot be verified by cert
Eric Newberryb74bbda2020-06-18 19:33:58 -0700106// m_keyChain.sign(interest1, signingByIdentity(wrongIdentity)
107// .setSignedInterestFormat(SignedInterestFormat::V03));
108// print("badSigInterest", interest1.wireEncode().wire(), interest1.wireEncode().size());
109// std::cout << "\n";
110
111// // Create interest that can be verified by cert (old signed Interest format)
112// Interest interest2(Name("/test/interest").append(type));
113// SigningInfo signingInfoV02(signingInfo);
114// signingInfoV02.setSignedInterestFormat(SignedInterestFormat::V03);
115// interest2.setCanBePrefix(false);
116// interest2.setNonce(0xF72C8A4B);
117// m_keyChain.sign(interest2, signingInfoV02);
118// print("goodInterestOldFormat", interest2.wireEncode().wire(), interest2.wireEncode().size());
119// std::cout << "\n";
120
121// // Create interest that cannot be verified by cert (old signed Interest format)
122// m_keyChain.sign(interest2, signingByIdentity(wrongIdentity)
123// .setSignedInterestFormat(SignedInterestFormat::V02));
124// print("badSigInterestOldFormat", interest2.wireEncode().wire(), interest2.wireEncode().size());
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800125// std::cout << "\n};\n\n";
126// }
127// }
128
129struct EcdsaDataset
130{
131 const std::string name = "Ecdsa";
132 std::vector<uint8_t> cert = {
Eric Newberryb74bbda2020-06-18 19:33:58 -0700133 0x06, 0xFD, 0x01, 0x62, 0x07, 0x47, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800134 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
135 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700136 0x45, 0x59, 0x08, 0x08, 0xA5, 0x8F, 0x5F, 0x7F, 0x18, 0x1A, 0x98, 0x14, 0x08, 0x04, 0x73, 0x65,
137 0x6C, 0x66, 0x08, 0x09, 0xFD, 0x00, 0x00, 0x01, 0x72, 0xCE, 0xA8, 0xE7, 0x53, 0x14, 0x09, 0x18,
138 0x01, 0x02, 0x19, 0x04, 0x00, 0x36, 0xEE, 0x80, 0x15, 0x5B, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07,
139 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01,
140 0x07, 0x03, 0x42, 0x00, 0x04, 0x15, 0x94, 0xDF, 0xBF, 0x2D, 0x83, 0x2C, 0x1F, 0xB7, 0x9D, 0x55,
141 0x9A, 0x6A, 0xC2, 0xDB, 0x03, 0xE9, 0xB2, 0x6B, 0x77, 0x6D, 0xF6, 0x42, 0x81, 0x2F, 0xC8, 0xDE,
142 0x3F, 0x8B, 0xF4, 0x27, 0x1C, 0x4F, 0xE9, 0x47, 0x0C, 0x44, 0x83, 0x52, 0xA0, 0xA2, 0x4E, 0x52,
143 0x49, 0xC5, 0xAD, 0x2D, 0x9B, 0x9C, 0xAE, 0xF5, 0x4C, 0x2A, 0xB5, 0xC4, 0xF5, 0xFB, 0xF3, 0x93,
144 0xD4, 0x86, 0x61, 0xE6, 0x70, 0x16, 0x67, 0x1B, 0x01, 0x03, 0x1C, 0x38, 0x07, 0x36, 0x08, 0x08,
145 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
146 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
147 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xA5, 0x8F, 0x5F, 0x7F,
148 0x18, 0x1A, 0x98, 0x14, 0xFD, 0x00, 0xFD, 0x26, 0xFD, 0x00, 0xFE, 0x0F, 0x31, 0x39, 0x37, 0x30,
149 0x30, 0x31, 0x30, 0x31, 0x54, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xFD, 0x00, 0xFF, 0x0F, 0x32,
150 0x30, 0x34, 0x30, 0x30, 0x36, 0x31, 0x34, 0x54, 0x32, 0x32, 0x31, 0x37, 0x35, 0x35, 0x17, 0x46,
151 0x30, 0x44, 0x02, 0x20, 0x4B, 0xF7, 0x85, 0xB8, 0x01, 0x7D, 0x65, 0x02, 0x6C, 0xFB, 0x69, 0x00,
152 0x8B, 0x4D, 0xCC, 0x0F, 0xB5, 0x87, 0xF8, 0x4C, 0x69, 0xE0, 0x7C, 0x16, 0xCC, 0x52, 0xB2, 0x29,
153 0x6B, 0x24, 0xF5, 0x7F, 0x02, 0x20, 0x1C, 0x88, 0xDE, 0x32, 0x3F, 0x1A, 0xE6, 0x60, 0xA2, 0x29,
154 0x94, 0xD9, 0x05, 0x8F, 0x57, 0x14, 0xD6, 0x17, 0x3C, 0x78, 0xBF, 0x85, 0xF5, 0x1D, 0xCC, 0x03,
155 0x35, 0x9E, 0xC9, 0xA9, 0x6B, 0x09
156 };
157 std::vector<uint8_t> goodData = {
158 0x06, 0xA2, 0x07, 0x13, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
159 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x14, 0x00, 0x15, 0x00, 0x16, 0x3D, 0x1B, 0x01, 0x03,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800160 0x1C, 0x38, 0x07, 0x36, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17,
161 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E,
162 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, 0x45, 0x59,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700163 0x08, 0x08, 0xA5, 0x8F, 0x5F, 0x7F, 0x18, 0x1A, 0x98, 0x14, 0x17, 0x48, 0x30, 0x46, 0x02, 0x21,
164 0x00, 0xD2, 0x35, 0xAD, 0xA9, 0xE6, 0x1E, 0x0F, 0xF3, 0xDE, 0x1D, 0xEA, 0x18, 0xCA, 0xEE, 0x5D,
165 0x05, 0xD1, 0xE0, 0x6A, 0x1E, 0xA5, 0x1A, 0xD6, 0xE6, 0x88, 0xB3, 0x24, 0xA9, 0xD5, 0x97, 0x4D,
166 0xC3, 0x02, 0x21, 0x00, 0xB5, 0xA3, 0x87, 0xD8, 0x9B, 0xB6, 0x92, 0xAD, 0x19, 0x84, 0xAE, 0x4D,
167 0xF5, 0x64, 0xEC, 0x1C, 0xF2, 0xA0, 0xB7, 0x4D, 0x6B, 0x74, 0xFF, 0x39, 0x38, 0xFD, 0x5D, 0x9D,
168 0x46, 0xE0, 0xD2, 0xB4
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800169 };
170 std::vector<uint8_t> badSigData = {
Eric Newberryb74bbda2020-06-18 19:33:58 -0700171 0x06, 0xA5, 0x07, 0x13, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
172 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x14, 0x00, 0x15, 0x00, 0x16, 0x40, 0x1B, 0x01, 0x03,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800173 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17,
174 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E,
175 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700176 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x17, 0x48, 0x30,
177 0x46, 0x02, 0x21, 0x00, 0xBB, 0x15, 0xAC, 0x92, 0xFB, 0x7D, 0x6F, 0x6C, 0x90, 0xC9, 0x45, 0x71,
178 0x97, 0x39, 0xCD, 0x8C, 0x30, 0xA0, 0x8C, 0x69, 0xCA, 0x39, 0xDB, 0xE5, 0xC2, 0x95, 0x55, 0xB4,
179 0x13, 0xB4, 0xB8, 0x95, 0x02, 0x21, 0x00, 0xDA, 0x54, 0x99, 0xF8, 0xE5, 0xC1, 0x74, 0xAC, 0xE0,
180 0xF2, 0xDF, 0x0D, 0xC5, 0xE1, 0xCF, 0x99, 0x28, 0x6C, 0xB0, 0x2D, 0x55, 0xC8, 0x74, 0x63, 0x56,
181 0x2A, 0x1A, 0xB0, 0x00, 0xBD, 0xFF, 0xC5
182 };
183 std::vector<uint8_t> goodInterest = {
184 0x05, 0xCA, 0x07, 0x39, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
185 0x72, 0x65, 0x73, 0x74, 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x02, 0x20, 0x8F, 0x41, 0x49,
186 0x40, 0xDA, 0x38, 0xC1, 0x0E, 0x75, 0x5A, 0x6D, 0x4A, 0xD4, 0xFC, 0xE2, 0xDF, 0xBA, 0x52, 0xAF,
187 0x0C, 0x9E, 0xEB, 0xD6, 0xC5, 0xD1, 0x1B, 0x51, 0x43, 0xBD, 0x19, 0xA7, 0x62, 0x0A, 0x04, 0xF7,
188 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3D, 0x1B, 0x01, 0x03, 0x1C, 0x38, 0x07, 0x36, 0x08, 0x08,
189 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
190 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
191 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xA5, 0x8F, 0x5F, 0x7F,
192 0x18, 0x1A, 0x98, 0x14, 0x2E, 0x46, 0x30, 0x44, 0x02, 0x20, 0x14, 0x1A, 0xF5, 0x9C, 0xD2, 0x3F,
193 0xA9, 0x71, 0x3B, 0x37, 0xD7, 0x97, 0xE6, 0x29, 0x12, 0x40, 0x44, 0x7B, 0xF1, 0x98, 0x03, 0xC1,
194 0xDB, 0xEA, 0x3A, 0x71, 0x83, 0x0D, 0xC4, 0x26, 0xB7, 0x24, 0x02, 0x20, 0x0F, 0x14, 0x10, 0xDB,
195 0xDB, 0x24, 0xCB, 0xB3, 0xD2, 0x4B, 0x45, 0x6D, 0xA0, 0xBB, 0x4B, 0x87, 0xC1, 0x59, 0x9F, 0xC8,
196 0xBE, 0x75, 0xF5, 0xCC, 0xCB, 0xD2, 0x4F, 0xD8, 0x87, 0x26, 0x51, 0xBF
197 };
198 std::vector<uint8_t> badSigInterest = {
199 0x05, 0xCF, 0x07, 0x39, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
200 0x72, 0x65, 0x73, 0x74, 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x02, 0x20, 0x53, 0x14, 0x5E,
201 0xA3, 0x31, 0x41, 0xD8, 0xA1, 0x10, 0x06, 0x3C, 0x8E, 0xF3, 0x51, 0xA0, 0xC2, 0x8A, 0xBC, 0xFC,
202 0x01, 0x5F, 0x12, 0x12, 0x11, 0x27, 0xD2, 0x18, 0xE5, 0xE7, 0xE4, 0xBD, 0x57, 0x0A, 0x04, 0xF7,
203 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08,
204 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
205 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
206 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3,
207 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x2E, 0x48, 0x30, 0x46, 0x02, 0x21, 0x00, 0xC9, 0x69,
208 0xD8, 0xB8, 0x59, 0x38, 0x31, 0x0B, 0x44, 0x66, 0xAE, 0x1C, 0x1C, 0x88, 0x2A, 0x95, 0xD0, 0xE5,
209 0x31, 0x61, 0xA6, 0x94, 0x1F, 0x9B, 0xAD, 0x47, 0x1C, 0x9D, 0x56, 0x37, 0x50, 0xBE, 0x02, 0x21,
210 0x00, 0xC7, 0x23, 0x25, 0xF7, 0xFA, 0x6A, 0x2D, 0x3D, 0xF4, 0xD8, 0xDB, 0xE9, 0x76, 0x6A, 0x63,
211 0xD4, 0x11, 0x17, 0x4A, 0xDB, 0x7F, 0x85, 0x52, 0x97, 0xFC, 0x5B, 0x0B, 0x1B, 0xBA, 0xE5, 0xED,
212 0x9A
213 };
214 std::vector<uint8_t> goodInterestOldFormat = {
215 0x05, 0xCB, 0x07, 0x39, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
216 0x72, 0x65, 0x73, 0x74, 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x02, 0x20, 0xDB, 0x6D, 0x5E,
217 0xA7, 0xBF, 0xAF, 0xEC, 0xA0, 0xC6, 0x20, 0x4E, 0xF2, 0x04, 0xF8, 0xFF, 0x39, 0x2A, 0x5F, 0xE6,
218 0x5F, 0x5B, 0xCE, 0x02, 0xA6, 0xBE, 0x82, 0x3F, 0xD2, 0x26, 0x47, 0x92, 0x62, 0x0A, 0x04, 0xF7,
219 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3D, 0x1B, 0x01, 0x03, 0x1C, 0x38, 0x07, 0x36, 0x08, 0x08,
220 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
221 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
222 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xA5, 0x8F, 0x5F, 0x7F,
223 0x18, 0x1A, 0x98, 0x14, 0x2E, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xCA, 0xFD, 0x19, 0x4C, 0x6C,
224 0x1B, 0x95, 0xD4, 0x2B, 0x15, 0x01, 0xE3, 0x87, 0x1F, 0xD7, 0xF2, 0x3D, 0x3E, 0x2E, 0x64, 0xAA,
225 0x60, 0x63, 0x51, 0xB3, 0x52, 0xBC, 0x6D, 0x24, 0x0C, 0x6D, 0x38, 0x02, 0x20, 0x0E, 0x21, 0xF1,
226 0x51, 0x39, 0x2D, 0x4A, 0x45, 0x05, 0x45, 0xFA, 0x85, 0xA7, 0xCC, 0x00, 0xFE, 0x89, 0x8A, 0xD6,
227 0xD7, 0x34, 0x0D, 0x31, 0x6A, 0x94, 0xAE, 0x1F, 0xD8, 0x07, 0xF1, 0xDF, 0x80
228 };
229 std::vector<uint8_t> badSigInterestOldFormat = {
230 0x05, 0xFD, 0x01, 0x5B, 0x07, 0xC9, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E,
231 0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x02, 0x20, 0xDB,
232 0x6D, 0x5E, 0xA7, 0xBF, 0xAF, 0xEC, 0xA0, 0xC6, 0x20, 0x4E, 0xF2, 0x04, 0xF8, 0xFF, 0x39, 0x2A,
233 0x5F, 0xE6, 0x5F, 0x5B, 0xCE, 0x02, 0xA6, 0xBE, 0x82, 0x3F, 0xD2, 0x26, 0x47, 0x92, 0x62, 0x08,
234 0x42, 0x16, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75,
235 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69,
236 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57,
237 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87,
238 0x5D, 0x6E, 0x43, 0x08, 0x4A, 0x17, 0x48, 0x30, 0x46, 0x02, 0x21, 0x00, 0xD0, 0x33, 0x6A, 0x5D,
239 0x8A, 0x1B, 0x04, 0xF9, 0xE5, 0xEE, 0x3A, 0x5A, 0x73, 0x63, 0xBF, 0xD4, 0x39, 0x07, 0x53, 0xA9,
240 0xF5, 0xBB, 0xB3, 0xD4, 0x7E, 0x65, 0x7B, 0xCB, 0x5A, 0xB1, 0x4B, 0xCE, 0x02, 0x21, 0x00, 0xD4,
241 0xA0, 0x7F, 0x40, 0x7A, 0xCF, 0xA5, 0xAD, 0x11, 0x44, 0x2F, 0xB1, 0xE0, 0x48, 0x25, 0x0B, 0x1C,
242 0x84, 0x76, 0x1F, 0x1B, 0x28, 0x4B, 0x36, 0x5F, 0x23, 0x3F, 0x91, 0xB3, 0xEF, 0x38, 0x2F, 0x0A,
243 0x04, 0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3D, 0x1B, 0x01, 0x03, 0x1C, 0x38, 0x07, 0x36,
244 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74,
245 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70,
246 0x65, 0x72, 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xA5, 0x8F,
247 0x5F, 0x7F, 0x18, 0x1A, 0x98, 0x14, 0x2E, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xCA, 0xFD, 0x19,
248 0x4C, 0x6C, 0x1B, 0x95, 0xD4, 0x2B, 0x15, 0x01, 0xE3, 0x87, 0x1F, 0xD7, 0xF2, 0x3D, 0x3E, 0x2E,
249 0x64, 0xAA, 0x60, 0x63, 0x51, 0xB3, 0x52, 0xBC, 0x6D, 0x24, 0x0C, 0x6D, 0x38, 0x02, 0x20, 0x0E,
250 0x21, 0xF1, 0x51, 0x39, 0x2D, 0x4A, 0x45, 0x05, 0x45, 0xFA, 0x85, 0xA7, 0xCC, 0x00, 0xFE, 0x89,
251 0x8A, 0xD6, 0xD7, 0x34, 0x0D, 0x31, 0x6A, 0x94, 0xAE, 0x1F, 0xD8, 0x07, 0xF1, 0xDF, 0x80
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800252 };
253};
254
255struct RsaDataset
256{
257 const std::string name = "Rsa";
258 std::vector<uint8_t> cert = {
259 0x06, 0xFD, 0x02, 0xED, 0x07, 0x48, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79,
260 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
261 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700262 0x4B, 0x45, 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE, 0xDB, 0xE7, 0x2E, 0xC6, 0xC7, 0x08, 0x04, 0x73,
263 0x65, 0x6C, 0x66, 0x08, 0x09, 0xFD, 0x00, 0x00, 0x01, 0x72, 0xCE, 0xA8, 0xE7, 0xA4, 0x14, 0x09,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800264 0x18, 0x01, 0x02, 0x19, 0x04, 0x00, 0x36, 0xEE, 0x80, 0x15, 0xFD, 0x01, 0x26, 0x30, 0x82, 0x01,
265 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700266 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xED, 0x32,
267 0x03, 0x4A, 0xC1, 0xC4, 0x73, 0xA7, 0xC3, 0x3C, 0xB3, 0x09, 0x62, 0xF7, 0xA7, 0x5F, 0x83, 0x98,
268 0xBD, 0x8A, 0x9F, 0xB3, 0x02, 0x02, 0x53, 0xF1, 0x62, 0x78, 0xE0, 0x08, 0x42, 0x48, 0xC7, 0x81,
269 0x2E, 0xA5, 0xD4, 0x9E, 0x7D, 0xD1, 0x38, 0x51, 0x8C, 0xAB, 0x18, 0x87, 0xC5, 0x0B, 0x57, 0x1C,
270 0x01, 0xD7, 0xA9, 0x4B, 0xA8, 0xD8, 0xEB, 0x96, 0x95, 0xAC, 0x09, 0xBC, 0xCE, 0xF4, 0x3E, 0xE5,
271 0x8D, 0x72, 0x81, 0x30, 0x30, 0xBA, 0xB7, 0xA2, 0x0D, 0xFE, 0x21, 0x2F, 0x97, 0x76, 0x59, 0x80,
272 0xC2, 0x92, 0x1B, 0x16, 0xF9, 0x15, 0xE3, 0xF5, 0xA0, 0x2C, 0x87, 0xAB, 0x88, 0x5B, 0x6E, 0x73,
273 0x36, 0xDB, 0xE4, 0xF0, 0x19, 0x78, 0x93, 0x26, 0xC3, 0x39, 0x33, 0x27, 0xBE, 0x06, 0x33, 0x84,
274 0x9C, 0xA8, 0x8A, 0xF7, 0x41, 0x82, 0xAD, 0xE4, 0x25, 0x86, 0xCC, 0x32, 0x1D, 0x5A, 0x8C, 0x52,
275 0x2F, 0x91, 0xD9, 0xD1, 0x31, 0x3F, 0x07, 0xF9, 0x43, 0xF9, 0xA8, 0xE7, 0x92, 0x70, 0xF4, 0xB0,
276 0x2F, 0xE1, 0x76, 0x91, 0x42, 0x9C, 0xB9, 0xF3, 0x69, 0x88, 0xD3, 0x36, 0x75, 0x5C, 0x13, 0x18,
277 0x85, 0xAA, 0x17, 0xCE, 0x5F, 0x0D, 0x49, 0xED, 0x79, 0xB2, 0x7F, 0x00, 0xF4, 0x5F, 0xD7, 0x29,
278 0xD2, 0xB3, 0x1E, 0xA6, 0xFC, 0x7E, 0x0C, 0xCD, 0x6A, 0x5F, 0xC6, 0x68, 0x46, 0x4C, 0x8A, 0x71,
279 0x57, 0x08, 0x86, 0xCD, 0xD4, 0xD2, 0x89, 0x37, 0x46, 0xAA, 0x79, 0xA9, 0x3A, 0x13, 0xB0, 0xA0,
280 0x63, 0x86, 0xA2, 0x18, 0xC6, 0xB3, 0x8C, 0x59, 0x5D, 0xF7, 0x6F, 0x77, 0xC3, 0x16, 0x42, 0xA7,
281 0x9A, 0x3F, 0xF9, 0x07, 0xB4, 0x5A, 0x7B, 0xE3, 0xA6, 0xF1, 0x76, 0xC5, 0x58, 0xB2, 0xC2, 0xAC,
282 0x7C, 0x02, 0x9A, 0xB2, 0xD1, 0x2B, 0xBC, 0x23, 0x11, 0x9F, 0xEB, 0x6F, 0xB4, 0x73, 0x02, 0x03,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800283 0x01, 0x00, 0x01, 0x16, 0x68, 0x1B, 0x01, 0x01, 0x1C, 0x39, 0x07, 0x37, 0x08, 0x08, 0x53, 0x65,
284 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69,
285 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700286 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE, 0xDB, 0xE7,
287 0x2E, 0xC6, 0xC7, 0xFD, 0x00, 0xFD, 0x26, 0xFD, 0x00, 0xFE, 0x0F, 0x31, 0x39, 0x37, 0x30, 0x30,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800288 0x31, 0x30, 0x31, 0x54, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xFD, 0x00, 0xFF, 0x0F, 0x32, 0x30,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700289 0x34, 0x30, 0x30, 0x36, 0x31, 0x34, 0x54, 0x32, 0x32, 0x31, 0x37, 0x35, 0x35, 0x17, 0xFD, 0x01,
290 0x00, 0x0F, 0x4D, 0x43, 0x2F, 0x6E, 0xCC, 0xB3, 0xAA, 0x8A, 0x50, 0xBB, 0x3D, 0x92, 0xE6, 0xB7,
291 0xFB, 0xD4, 0xEA, 0x20, 0xB4, 0xF8, 0xF0, 0xD8, 0x03, 0x45, 0xB3, 0xFB, 0x82, 0xCE, 0xDB, 0xCE,
292 0x1F, 0xC7, 0x61, 0x58, 0x9D, 0x33, 0xAD, 0xA8, 0xFC, 0xB9, 0x31, 0x7F, 0xCF, 0x8D, 0x9C, 0xDF,
293 0x4C, 0x29, 0x25, 0xD6, 0x78, 0x8F, 0xCC, 0xC4, 0xF9, 0xF8, 0x88, 0xA9, 0x66, 0x7E, 0xD9, 0x4A,
294 0xB2, 0x6F, 0x2A, 0x60, 0xB8, 0x43, 0xCC, 0x46, 0xC3, 0x88, 0x93, 0xC8, 0x0C, 0xD3, 0x87, 0x70,
295 0xDA, 0x59, 0x16, 0xF1, 0x37, 0xD0, 0xB5, 0xF0, 0x92, 0x9E, 0xBC, 0xAE, 0xA2, 0x3A, 0x96, 0xB1,
296 0x36, 0x26, 0x8E, 0x43, 0xA7, 0x33, 0xEB, 0x13, 0x8C, 0x57, 0x02, 0x20, 0xCB, 0x97, 0xB7, 0x78,
297 0x08, 0x58, 0x07, 0x77, 0x66, 0xE9, 0x5D, 0xCB, 0xCD, 0x1E, 0x0D, 0x36, 0x43, 0x23, 0x64, 0x8E,
298 0x48, 0x66, 0x60, 0xF6, 0xF4, 0x4C, 0xD6, 0x9E, 0xAF, 0x3C, 0xC6, 0x23, 0x03, 0x09, 0x8A, 0xB1,
299 0x26, 0xDA, 0x82, 0x6D, 0xA2, 0x3D, 0x0C, 0x36, 0x56, 0x76, 0x9A, 0x62, 0xBB, 0xDD, 0x0C, 0x91,
300 0xB3, 0x8D, 0x0D, 0x9B, 0x55, 0x17, 0xC3, 0xFA, 0x26, 0xC3, 0xE5, 0x77, 0xB3, 0x55, 0x5C, 0xB7,
301 0xC9, 0x74, 0x86, 0xD1, 0xEE, 0xDF, 0xEB, 0xAF, 0xC6, 0x4D, 0x42, 0x3F, 0x09, 0x6A, 0x44, 0x7F,
302 0xB9, 0xC1, 0xE9, 0xAB, 0xBF, 0xBA, 0xED, 0xDD, 0xE9, 0x09, 0x11, 0x8C, 0x03, 0x1E, 0x5A, 0xA6,
303 0x74, 0xF1, 0x39, 0x71, 0xF3, 0x71, 0x26, 0xD5, 0xF2, 0x87, 0xBC, 0x1A, 0x6D, 0xD2, 0x37, 0xC6,
304 0x3E, 0xFA, 0xE6, 0xB9, 0x8E, 0x08, 0x82, 0x50, 0xCA, 0xEE, 0x7F, 0x5D, 0x80, 0x65, 0xBA, 0x10,
305 0x1F, 0x24, 0xC1, 0x15, 0x78, 0xB7, 0x90, 0xE5, 0x3D, 0xDA, 0x0F, 0x0E, 0x03, 0x20, 0xC1, 0xEA,
306 0x85
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800307 };
308 std::vector<uint8_t> goodData = {
309 0x06, 0xFD, 0x01, 0x5B, 0x07, 0x11, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61,
310 0x74, 0x61, 0x08, 0x03, 0x52, 0x73, 0x61, 0x14, 0x00, 0x15, 0x00, 0x16, 0x3E, 0x1B, 0x01, 0x01,
311 0x1C, 0x39, 0x07, 0x37, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17,
312 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E,
313 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, 0x4B, 0x45,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700314 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE, 0xDB, 0xE7, 0x2E, 0xC6, 0xC7, 0x17, 0xFD, 0x01, 0x00, 0x15,
315 0x5E, 0x36, 0xEB, 0x43, 0x60, 0x9E, 0x06, 0xC1, 0x2A, 0xC8, 0x92, 0xAC, 0x0B, 0xC9, 0x8D, 0xEB,
316 0x54, 0x4A, 0x3A, 0xC4, 0x88, 0x3C, 0x51, 0x67, 0x19, 0x93, 0x68, 0xC7, 0xD5, 0x70, 0xE7, 0x2C,
317 0xB1, 0x78, 0xEA, 0x6A, 0x84, 0x5A, 0x7A, 0x5E, 0xAA, 0x43, 0xE7, 0x09, 0x3E, 0xF8, 0xF1, 0x7C,
318 0x9C, 0xE7, 0x72, 0x2D, 0x7B, 0x77, 0xD0, 0xD9, 0x86, 0x6B, 0x05, 0xE9, 0xA7, 0x83, 0x7C, 0xAB,
319 0x16, 0xDF, 0x0D, 0x36, 0x37, 0x74, 0x6E, 0xBC, 0x42, 0x2F, 0xFE, 0xDE, 0x40, 0x03, 0x2B, 0xC0,
320 0x7E, 0xF8, 0x67, 0xD7, 0x38, 0xD7, 0xE8, 0x7C, 0xCF, 0xCE, 0x9D, 0x14, 0x39, 0xDE, 0xF1, 0x02,
321 0x9E, 0xC4, 0x9B, 0xD6, 0x46, 0xBA, 0x57, 0xF9, 0x76, 0xB2, 0x25, 0xD4, 0x0A, 0xB5, 0x31, 0x09,
322 0x36, 0x77, 0xF4, 0xDB, 0xC7, 0xD2, 0xD9, 0x14, 0xB0, 0x98, 0xAC, 0x48, 0x7C, 0x30, 0x90, 0xE2,
323 0x1E, 0xF1, 0xF5, 0xC5, 0x69, 0xE4, 0xA5, 0xBE, 0xF7, 0x9C, 0x74, 0x97, 0x97, 0xE6, 0xA4, 0x41,
324 0x75, 0xDF, 0x8D, 0xFB, 0x2E, 0x9E, 0xA0, 0x57, 0xBB, 0x96, 0xE5, 0x81, 0x9F, 0xF7, 0x95, 0x7B,
325 0x6A, 0x2C, 0xE3, 0xF8, 0x48, 0x0C, 0xB2, 0x3F, 0xB6, 0xCF, 0xB8, 0x7F, 0x08, 0x24, 0x77, 0x44,
326 0x9A, 0x7F, 0x34, 0x35, 0xFF, 0x68, 0x7E, 0x61, 0x2C, 0x09, 0xF9, 0x0A, 0xAD, 0xBE, 0x57, 0xD3,
327 0x2A, 0x2A, 0x9E, 0xE0, 0x8E, 0x5B, 0x79, 0x1C, 0x4C, 0x32, 0x8D, 0xFA, 0xBF, 0xEE, 0xBB, 0xA0,
328 0x4F, 0xD9, 0xEB, 0xC1, 0x5D, 0x53, 0x15, 0xBF, 0x8C, 0x7C, 0x6B, 0x22, 0xB9, 0x24, 0x70, 0xAE,
329 0x63, 0x13, 0x96, 0x3B, 0x2A, 0xDA, 0x7F, 0x64, 0x0D, 0x9E, 0xA7, 0x90, 0x20, 0x2A, 0x2A, 0xAB,
330 0xA9, 0xA6, 0xC9, 0xB2, 0x37, 0x8E, 0xE3, 0x09, 0xFD, 0xA3, 0x68, 0x06, 0xCB, 0x96, 0x80
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800331 };
332 std::vector<uint8_t> badSigData = {
Eric Newberryb74bbda2020-06-18 19:33:58 -0700333 0x06, 0xA2, 0x07, 0x11, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800334 0x08, 0x03, 0x52, 0x73, 0x61, 0x14, 0x00, 0x15, 0x00, 0x16, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B,
335 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65,
336 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65,
337 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700338 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x17, 0x47, 0x30, 0x45, 0x02,
339 0x20, 0x15, 0xFC, 0x4C, 0xA4, 0xBA, 0x18, 0xF9, 0x6A, 0x92, 0xC8, 0xA9, 0x62, 0x96, 0x60, 0x39,
340 0x6B, 0x74, 0x4A, 0x7C, 0x38, 0x1A, 0x83, 0x33, 0xB2, 0x40, 0x03, 0x59, 0x2C, 0xA4, 0x1A, 0xD1,
341 0x1E, 0x02, 0x21, 0x00, 0xA5, 0x62, 0xA5, 0x04, 0x60, 0xBC, 0x96, 0x54, 0x2C, 0x9E, 0x6F, 0xA8,
342 0x1B, 0xDB, 0xF9, 0xF0, 0x7E, 0xFF, 0xED, 0x92, 0x3A, 0x4B, 0xDE, 0x3D, 0x20, 0x02, 0x7B, 0xD7,
343 0x1C, 0xD0, 0xAA, 0xAB
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800344 };
345 std::vector<uint8_t> goodInterest = {
Eric Newberryb74bbda2020-06-18 19:33:58 -0700346 0x05, 0xFD, 0x01, 0x85, 0x07, 0x37, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E,
347 0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x08, 0x03, 0x52, 0x73, 0x61, 0x02, 0x20, 0x08, 0x39, 0xEE,
348 0x12, 0xF1, 0x10, 0xB7, 0x8B, 0x49, 0xF2, 0xE2, 0x54, 0x23, 0xFF, 0x66, 0xB3, 0x0F, 0xC6, 0x91,
349 0x89, 0x59, 0x99, 0x20, 0xAA, 0x06, 0xEA, 0x8F, 0xB3, 0x3A, 0x8F, 0xB3, 0xB1, 0x0A, 0x04, 0xF7,
350 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3E, 0x1B, 0x01, 0x01, 0x1C, 0x39, 0x07, 0x37, 0x08, 0x08,
351 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
352 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
353 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE,
354 0xDB, 0xE7, 0x2E, 0xC6, 0xC7, 0x2E, 0xFD, 0x01, 0x00, 0x54, 0xD8, 0xED, 0xAB, 0x63, 0xE0, 0x89,
355 0x9D, 0x31, 0x0B, 0xD7, 0x2F, 0xF6, 0x4C, 0x4B, 0xCE, 0x2A, 0xB9, 0x65, 0x55, 0x65, 0x15, 0x4F,
356 0x1B, 0x59, 0xFF, 0xF7, 0x10, 0xB8, 0xA6, 0x33, 0x88, 0xA6, 0xCF, 0x9B, 0x23, 0x7E, 0x48, 0x83,
357 0x60, 0x59, 0xF9, 0xB5, 0x7F, 0x68, 0x2B, 0x1E, 0x2F, 0x35, 0x3B, 0x48, 0x64, 0x15, 0xD8, 0xE1,
358 0x27, 0x1F, 0xDE, 0x0A, 0x27, 0xBE, 0x7A, 0xA6, 0xFE, 0x8B, 0x01, 0x7C, 0x94, 0xDC, 0x2D, 0x4B,
359 0x2E, 0x78, 0xA0, 0xF4, 0xA2, 0x9B, 0x63, 0x47, 0x5B, 0x8C, 0x57, 0x04, 0xF3, 0x92, 0x3F, 0x4C,
360 0x84, 0x70, 0x06, 0x16, 0xD2, 0xF0, 0x49, 0x9E, 0x4E, 0x2E, 0x9A, 0xC5, 0xB0, 0xC8, 0x0F, 0x4C,
361 0xB9, 0xD0, 0x37, 0x9F, 0xEB, 0x53, 0x68, 0x1B, 0xC9, 0xBF, 0x77, 0x12, 0xBD, 0x25, 0x23, 0x38,
362 0x56, 0x63, 0x22, 0xA4, 0x52, 0xA1, 0x00, 0x47, 0x08, 0xEB, 0xC7, 0x36, 0x33, 0x46, 0xC1, 0x92,
363 0x89, 0xE4, 0xC8, 0x52, 0x05, 0xB7, 0x01, 0x2B, 0x24, 0x04, 0x56, 0xC3, 0x8C, 0x1F, 0x18, 0x78,
364 0x73, 0x99, 0xFF, 0x7B, 0x0E, 0x92, 0x3D, 0x92, 0x61, 0xF1, 0xDC, 0x55, 0xDB, 0x55, 0x8B, 0xBA,
365 0xDB, 0xD9, 0x14, 0x7C, 0x7B, 0x9B, 0xDC, 0x90, 0x15, 0xC6, 0x59, 0x80, 0xE7, 0xFC, 0x03, 0x71,
366 0x7E, 0x35, 0x05, 0x30, 0xBE, 0xED, 0xC4, 0xB2, 0x2E, 0x39, 0xDB, 0xAA, 0x2A, 0x7E, 0x50, 0x37,
367 0x4D, 0xC8, 0x3F, 0x00, 0xD8, 0xE9, 0xF1, 0x9D, 0x57, 0x43, 0x2B, 0x1C, 0x5F, 0x09, 0x18, 0xA3,
368 0xE3, 0x11, 0x85, 0xCC, 0x0E, 0xAF, 0x56, 0x6B, 0xE1, 0xAC, 0xB3, 0x20, 0xF2, 0x47, 0xFE, 0x95,
369 0xC8, 0x71, 0x99, 0xCC, 0x52, 0x8A, 0x6F, 0xF1, 0x01, 0xD6, 0xE9, 0x2E, 0x6C, 0x27, 0xC3, 0xED,
370 0xE3, 0xF2, 0xDD, 0x78, 0xB4, 0x7F, 0xFA, 0xD0, 0xC2
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800371 };
372 std::vector<uint8_t> badSigInterest = {
Eric Newberryb74bbda2020-06-18 19:33:58 -0700373 0x05, 0xCC, 0x07, 0x37, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
374 0x72, 0x65, 0x73, 0x74, 0x08, 0x03, 0x52, 0x73, 0x61, 0x02, 0x20, 0x64, 0xE3, 0x6F, 0xD5, 0x73,
375 0x21, 0xBC, 0xAB, 0xDE, 0xDE, 0x0F, 0x99, 0xCB, 0x49, 0x7F, 0x46, 0xE7, 0xF0, 0x7A, 0xF1, 0x2C,
376 0xF9, 0x36, 0xE0, 0xBD, 0x3A, 0x8A, 0x1C, 0x08, 0x6A, 0xD1, 0x21, 0x0A, 0x04, 0xF7, 0x2C, 0x8A,
377 0x4B, 0x24, 0x00, 0x2C, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65,
378 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69,
379 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08,
380 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A,
381 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x2E, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xC3, 0x9A, 0xDC, 0x5A,
382 0x59, 0x10, 0x4D, 0x29, 0x9A, 0x64, 0x8D, 0x18, 0xBD, 0x27, 0x73, 0xBB, 0x98, 0xAB, 0xE9, 0xF2,
383 0x4A, 0xBF, 0xC0, 0x5B, 0xA8, 0x05, 0xA2, 0xC8, 0x61, 0xC4, 0x2E, 0x64, 0x02, 0x20, 0x1F, 0x5E,
384 0xF5, 0x8E, 0xC9, 0xDC, 0x9E, 0x15, 0x1C, 0xFA, 0x58, 0x5F, 0xDF, 0xAE, 0xA0, 0xFD, 0xDA, 0x34,
385 0x21, 0xE0, 0xA8, 0x2D, 0x32, 0x47, 0x9E, 0x44, 0x83, 0x79, 0x23, 0x5F, 0xBE, 0x16
386 };
387 std::vector<uint8_t> goodInterestOldFormat = {
388 0x05, 0xFD, 0x01, 0x85, 0x07, 0x37, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E,
389 0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x08, 0x03, 0x52, 0x73, 0x61, 0x02, 0x20, 0x08, 0x39, 0xEE,
390 0x12, 0xF1, 0x10, 0xB7, 0x8B, 0x49, 0xF2, 0xE2, 0x54, 0x23, 0xFF, 0x66, 0xB3, 0x0F, 0xC6, 0x91,
391 0x89, 0x59, 0x99, 0x20, 0xAA, 0x06, 0xEA, 0x8F, 0xB3, 0x3A, 0x8F, 0xB3, 0xB1, 0x0A, 0x04, 0xF7,
392 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3E, 0x1B, 0x01, 0x01, 0x1C, 0x39, 0x07, 0x37, 0x08, 0x08,
393 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
394 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
395 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE,
396 0xDB, 0xE7, 0x2E, 0xC6, 0xC7, 0x2E, 0xFD, 0x01, 0x00, 0x54, 0xD8, 0xED, 0xAB, 0x63, 0xE0, 0x89,
397 0x9D, 0x31, 0x0B, 0xD7, 0x2F, 0xF6, 0x4C, 0x4B, 0xCE, 0x2A, 0xB9, 0x65, 0x55, 0x65, 0x15, 0x4F,
398 0x1B, 0x59, 0xFF, 0xF7, 0x10, 0xB8, 0xA6, 0x33, 0x88, 0xA6, 0xCF, 0x9B, 0x23, 0x7E, 0x48, 0x83,
399 0x60, 0x59, 0xF9, 0xB5, 0x7F, 0x68, 0x2B, 0x1E, 0x2F, 0x35, 0x3B, 0x48, 0x64, 0x15, 0xD8, 0xE1,
400 0x27, 0x1F, 0xDE, 0x0A, 0x27, 0xBE, 0x7A, 0xA6, 0xFE, 0x8B, 0x01, 0x7C, 0x94, 0xDC, 0x2D, 0x4B,
401 0x2E, 0x78, 0xA0, 0xF4, 0xA2, 0x9B, 0x63, 0x47, 0x5B, 0x8C, 0x57, 0x04, 0xF3, 0x92, 0x3F, 0x4C,
402 0x84, 0x70, 0x06, 0x16, 0xD2, 0xF0, 0x49, 0x9E, 0x4E, 0x2E, 0x9A, 0xC5, 0xB0, 0xC8, 0x0F, 0x4C,
403 0xB9, 0xD0, 0x37, 0x9F, 0xEB, 0x53, 0x68, 0x1B, 0xC9, 0xBF, 0x77, 0x12, 0xBD, 0x25, 0x23, 0x38,
404 0x56, 0x63, 0x22, 0xA4, 0x52, 0xA1, 0x00, 0x47, 0x08, 0xEB, 0xC7, 0x36, 0x33, 0x46, 0xC1, 0x92,
405 0x89, 0xE4, 0xC8, 0x52, 0x05, 0xB7, 0x01, 0x2B, 0x24, 0x04, 0x56, 0xC3, 0x8C, 0x1F, 0x18, 0x78,
406 0x73, 0x99, 0xFF, 0x7B, 0x0E, 0x92, 0x3D, 0x92, 0x61, 0xF1, 0xDC, 0x55, 0xDB, 0x55, 0x8B, 0xBA,
407 0xDB, 0xD9, 0x14, 0x7C, 0x7B, 0x9B, 0xDC, 0x90, 0x15, 0xC6, 0x59, 0x80, 0xE7, 0xFC, 0x03, 0x71,
408 0x7E, 0x35, 0x05, 0x30, 0xBE, 0xED, 0xC4, 0xB2, 0x2E, 0x39, 0xDB, 0xAA, 0x2A, 0x7E, 0x50, 0x37,
409 0x4D, 0xC8, 0x3F, 0x00, 0xD8, 0xE9, 0xF1, 0x9D, 0x57, 0x43, 0x2B, 0x1C, 0x5F, 0x09, 0x18, 0xA3,
410 0xE3, 0x11, 0x85, 0xCC, 0x0E, 0xAF, 0x56, 0x6B, 0xE1, 0xAC, 0xB3, 0x20, 0xF2, 0x47, 0xFE, 0x95,
411 0xC8, 0x71, 0x99, 0xCC, 0x52, 0x8A, 0x6F, 0xF1, 0x01, 0xD6, 0xE9, 0x2E, 0x6C, 0x27, 0xC3, 0xED,
412 0xE3, 0xF2, 0xDD, 0x78, 0xB4, 0x7F, 0xFA, 0xD0, 0xC2
413 };
414 std::vector<uint8_t> badSigInterestOldFormat = {
415 0x05, 0xFD, 0x02, 0x15, 0x07, 0xC7, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E,
416 0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x08, 0x03, 0x52, 0x73, 0x61, 0x02, 0x20, 0x08, 0x39, 0xEE,
417 0x12, 0xF1, 0x10, 0xB7, 0x8B, 0x49, 0xF2, 0xE2, 0x54, 0x23, 0xFF, 0x66, 0xB3, 0x0F, 0xC6, 0x91,
418 0x89, 0x59, 0x99, 0x20, 0xAA, 0x06, 0xEA, 0x8F, 0xB3, 0x3A, 0x8F, 0xB3, 0xB1, 0x08, 0x42, 0x16,
419 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800420 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700421 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F,
422 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E,
423 0x43, 0x08, 0x4A, 0x17, 0x48, 0x30, 0x46, 0x02, 0x21, 0x00, 0x9D, 0x24, 0x46, 0x3D, 0x37, 0xAE,
424 0x81, 0xB7, 0x7C, 0x2C, 0x86, 0x8A, 0x34, 0xEF, 0xC8, 0xC8, 0xB0, 0x18, 0x78, 0x3E, 0xA3, 0xE5,
425 0xED, 0x31, 0x93, 0x26, 0x73, 0x0E, 0x58, 0xE8, 0xF8, 0x47, 0x02, 0x21, 0x00, 0xFD, 0x82, 0xD2,
426 0x69, 0xEF, 0xB0, 0x72, 0xE8, 0xCA, 0x33, 0x43, 0xEB, 0x27, 0xB1, 0xDD, 0xB6, 0xD1, 0x97, 0x14,
427 0x43, 0xC5, 0xA9, 0xFC, 0x87, 0x59, 0xAF, 0x87, 0xF3, 0x02, 0x2C, 0x59, 0x2E, 0x0A, 0x04, 0xF7,
428 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3E, 0x1B, 0x01, 0x01, 0x1C, 0x39, 0x07, 0x37, 0x08, 0x08,
429 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65,
430 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72,
431 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE,
432 0xDB, 0xE7, 0x2E, 0xC6, 0xC7, 0x2E, 0xFD, 0x01, 0x00, 0x54, 0xD8, 0xED, 0xAB, 0x63, 0xE0, 0x89,
433 0x9D, 0x31, 0x0B, 0xD7, 0x2F, 0xF6, 0x4C, 0x4B, 0xCE, 0x2A, 0xB9, 0x65, 0x55, 0x65, 0x15, 0x4F,
434 0x1B, 0x59, 0xFF, 0xF7, 0x10, 0xB8, 0xA6, 0x33, 0x88, 0xA6, 0xCF, 0x9B, 0x23, 0x7E, 0x48, 0x83,
435 0x60, 0x59, 0xF9, 0xB5, 0x7F, 0x68, 0x2B, 0x1E, 0x2F, 0x35, 0x3B, 0x48, 0x64, 0x15, 0xD8, 0xE1,
436 0x27, 0x1F, 0xDE, 0x0A, 0x27, 0xBE, 0x7A, 0xA6, 0xFE, 0x8B, 0x01, 0x7C, 0x94, 0xDC, 0x2D, 0x4B,
437 0x2E, 0x78, 0xA0, 0xF4, 0xA2, 0x9B, 0x63, 0x47, 0x5B, 0x8C, 0x57, 0x04, 0xF3, 0x92, 0x3F, 0x4C,
438 0x84, 0x70, 0x06, 0x16, 0xD2, 0xF0, 0x49, 0x9E, 0x4E, 0x2E, 0x9A, 0xC5, 0xB0, 0xC8, 0x0F, 0x4C,
439 0xB9, 0xD0, 0x37, 0x9F, 0xEB, 0x53, 0x68, 0x1B, 0xC9, 0xBF, 0x77, 0x12, 0xBD, 0x25, 0x23, 0x38,
440 0x56, 0x63, 0x22, 0xA4, 0x52, 0xA1, 0x00, 0x47, 0x08, 0xEB, 0xC7, 0x36, 0x33, 0x46, 0xC1, 0x92,
441 0x89, 0xE4, 0xC8, 0x52, 0x05, 0xB7, 0x01, 0x2B, 0x24, 0x04, 0x56, 0xC3, 0x8C, 0x1F, 0x18, 0x78,
442 0x73, 0x99, 0xFF, 0x7B, 0x0E, 0x92, 0x3D, 0x92, 0x61, 0xF1, 0xDC, 0x55, 0xDB, 0x55, 0x8B, 0xBA,
443 0xDB, 0xD9, 0x14, 0x7C, 0x7B, 0x9B, 0xDC, 0x90, 0x15, 0xC6, 0x59, 0x80, 0xE7, 0xFC, 0x03, 0x71,
444 0x7E, 0x35, 0x05, 0x30, 0xBE, 0xED, 0xC4, 0xB2, 0x2E, 0x39, 0xDB, 0xAA, 0x2A, 0x7E, 0x50, 0x37,
445 0x4D, 0xC8, 0x3F, 0x00, 0xD8, 0xE9, 0xF1, 0x9D, 0x57, 0x43, 0x2B, 0x1C, 0x5F, 0x09, 0x18, 0xA3,
446 0xE3, 0x11, 0x85, 0xCC, 0x0E, 0xAF, 0x56, 0x6B, 0xE1, 0xAC, 0xB3, 0x20, 0xF2, 0x47, 0xFE, 0x95,
447 0xC8, 0x71, 0x99, 0xCC, 0x52, 0x8A, 0x6F, 0xF1, 0x01, 0xD6, 0xE9, 0x2E, 0x6C, 0x27, 0xC3, 0xED,
448 0xE3, 0xF2, 0xDD, 0x78, 0xB4, 0x7F, 0xFA, 0xD0, 0xC2
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800449 };
450};
451
452struct Sha256Dataset
453{
454 const std::string name = "Sha256";
455 std::vector<uint8_t> cert = {
456
457 };
458 std::vector<uint8_t> goodData = {
459 0x06, 0x41, 0x07, 0x14, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
460 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x14, 0x00, 0x15, 0x00, 0x16, 0x03, 0x1B, 0x01,
461 0x00, 0x17, 0x20, 0xE2, 0xE2, 0x2F, 0x02, 0x70, 0xA7, 0xF7, 0x48, 0x70, 0x45, 0x29, 0x46, 0xBD,
462 0xD2, 0x62, 0x24, 0xA6, 0x1E, 0x1D, 0x75, 0x2A, 0x26, 0x98, 0x04, 0xAD, 0x9C, 0x47, 0x63, 0xF8,
463 0x98, 0x5A, 0x49
464 };
465 std::vector<uint8_t> badSigData = {
Eric Newberryb74bbda2020-06-18 19:33:58 -0700466 0x06, 0xA6, 0x07, 0x14, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800467 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x14, 0x00, 0x15, 0x00, 0x16, 0x40, 0x1B, 0x01,
468 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08,
469 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F,
470 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08,
Eric Newberryb74bbda2020-06-18 19:33:58 -0700471 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x17, 0x48,
472 0x30, 0x46, 0x02, 0x21, 0x00, 0xF0, 0x72, 0x9A, 0x68, 0x36, 0xC5, 0xAA, 0x9D, 0x75, 0x03, 0x36,
473 0xDA, 0xAA, 0x80, 0x0C, 0x29, 0xEE, 0xC9, 0x48, 0x95, 0xA2, 0xEC, 0xAB, 0x78, 0x28, 0x3B, 0x9D,
474 0x28, 0x19, 0x6C, 0x5C, 0xD6, 0x02, 0x21, 0x00, 0xF0, 0xD2, 0x23, 0xEA, 0xD9, 0x43, 0x6D, 0x8A,
475 0xD2, 0x02, 0x3F, 0xF1, 0x41, 0x12, 0xA6, 0xED, 0x87, 0xB3, 0xD5, 0x5A, 0x27, 0x5D, 0x4E, 0xEB,
476 0x13, 0x29, 0x01, 0xBC, 0x3C, 0xCC, 0x50, 0x61
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800477 };
478 std::vector<uint8_t> goodInterest = {
Eric Newberryb74bbda2020-06-18 19:33:58 -0700479 0x05, 0x6B, 0x07, 0x3A, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
480 0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x8F, 0x03,
481 0x0B, 0x85, 0xA7, 0x05, 0xD8, 0x05, 0x31, 0x8E, 0x80, 0x81, 0xD3, 0xE2, 0xA8, 0x5E, 0x74, 0xD7,
482 0x4F, 0x3A, 0xDC, 0xFF, 0x9C, 0x44, 0xF6, 0xA1, 0xC6, 0x6B, 0x97, 0x99, 0x8E, 0xDA, 0x0A, 0x04,
483 0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x03, 0x1B, 0x01, 0x00, 0x2E, 0x20, 0xEF, 0x45, 0x55,
484 0x75, 0xC8, 0x18, 0x5E, 0xE9, 0x2A, 0xAE, 0x52, 0x61, 0x0A, 0x94, 0x41, 0x03, 0x36, 0x4C, 0x13,
485 0x59, 0xD4, 0xC7, 0xA4, 0x3A, 0xA0, 0x40, 0x61, 0x44, 0x33, 0x93, 0x5E, 0x99
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800486 };
487 std::vector<uint8_t> badSigInterest = {
Eric Newberryb74bbda2020-06-18 19:33:58 -0700488 0x05, 0xCE, 0x07, 0x3A, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
489 0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x32, 0x3F,
490 0x2F, 0xA3, 0xDC, 0x15, 0x7E, 0x8C, 0xA9, 0x75, 0xF7, 0x66, 0xFF, 0xFD, 0x13, 0x42, 0x1B, 0xE1,
491 0x3A, 0x27, 0xDD, 0xE4, 0x98, 0x42, 0x77, 0xFA, 0xAD, 0x8F, 0x3E, 0x91, 0x75, 0xF9, 0x0A, 0x04,
492 0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08,
493 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56,
494 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65,
495 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08,
496 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x2E, 0x46, 0x30, 0x44, 0x02, 0x20, 0x0C, 0xA0,
497 0x6F, 0x90, 0xEF, 0x5E, 0x04, 0x15, 0xAF, 0x94, 0x8E, 0x33, 0x12, 0x1F, 0xF9, 0x50, 0xDD, 0x49,
498 0x73, 0xB3, 0xA6, 0xD2, 0x99, 0x32, 0x26, 0xE2, 0x46, 0x3A, 0xE0, 0x69, 0xDF, 0xB2, 0x02, 0x20,
499 0x6A, 0x03, 0xCE, 0xB6, 0x85, 0x1E, 0x01, 0x5E, 0xF8, 0x48, 0xDE, 0x65, 0xB9, 0xE1, 0xEB, 0x9A,
500 0xF8, 0x47, 0x43, 0x5B, 0xBA, 0x63, 0xCB, 0xBA, 0xFB, 0x62, 0x1C, 0x38, 0xE8, 0x53, 0xF7, 0x29
501 };
502 std::vector<uint8_t> goodInterestOldFormat = {
503 0x05, 0x6B, 0x07, 0x3A, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
504 0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x8F, 0x03,
505 0x0B, 0x85, 0xA7, 0x05, 0xD8, 0x05, 0x31, 0x8E, 0x80, 0x81, 0xD3, 0xE2, 0xA8, 0x5E, 0x74, 0xD7,
506 0x4F, 0x3A, 0xDC, 0xFF, 0x9C, 0x44, 0xF6, 0xA1, 0xC6, 0x6B, 0x97, 0x99, 0x8E, 0xDA, 0x0A, 0x04,
507 0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x03, 0x1B, 0x01, 0x00, 0x2E, 0x20, 0xEF, 0x45, 0x55,
508 0x75, 0xC8, 0x18, 0x5E, 0xE9, 0x2A, 0xAE, 0x52, 0x61, 0x0A, 0x94, 0x41, 0x03, 0x36, 0x4C, 0x13,
509 0x59, 0xD4, 0xC7, 0xA4, 0x3A, 0xA0, 0x40, 0x61, 0x44, 0x33, 0x93, 0x5E, 0x99
510 };
511 std::vector<uint8_t> badSigInterestOldFormat = {
512 0x05, 0xFA, 0x07, 0xC9, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
513 0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x8F, 0x03,
514 0x0B, 0x85, 0xA7, 0x05, 0xD8, 0x05, 0x31, 0x8E, 0x80, 0x81, 0xD3, 0xE2, 0xA8, 0x5E, 0x74, 0xD7,
515 0x4F, 0x3A, 0xDC, 0xFF, 0x9C, 0x44, 0xF6, 0xA1, 0xC6, 0x6B, 0x97, 0x99, 0x8E, 0xDA, 0x08, 0x42,
516 0x16, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72,
517 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63,
518 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, 0x72,
519 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D,
520 0x6E, 0x43, 0x08, 0x49, 0x17, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xB3, 0x30, 0x0A, 0x93, 0x16,
521 0x16, 0xBB, 0xD0, 0x3C, 0x73, 0x01, 0xED, 0x0D, 0x40, 0xEE, 0x28, 0x69, 0xA6, 0xAA, 0xF0, 0x34,
522 0x44, 0xBD, 0x7E, 0x1F, 0xBF, 0x6D, 0x7C, 0x52, 0xA1, 0x85, 0x1D, 0x02, 0x20, 0x3F, 0x18, 0x66,
523 0x48, 0xC9, 0x0F, 0x5B, 0x18, 0xB0, 0xD0, 0x45, 0xDE, 0x93, 0xA6, 0x21, 0xA0, 0xDC, 0x7E, 0x47,
524 0x3A, 0x61, 0x56, 0xD2, 0xAE, 0x70, 0x8D, 0xE8, 0xD5, 0xB7, 0xD0, 0x12, 0x35, 0x0A, 0x04, 0xF7,
525 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x03, 0x1B, 0x01, 0x00, 0x2E, 0x20, 0xEF, 0x45, 0x55, 0x75,
526 0xC8, 0x18, 0x5E, 0xE9, 0x2A, 0xAE, 0x52, 0x61, 0x0A, 0x94, 0x41, 0x03, 0x36, 0x4C, 0x13, 0x59,
527 0xD4, 0xC7, 0xA4, 0x3A, 0xA0, 0x40, 0x61, 0x44, 0x33, 0x93, 0x5E, 0x99
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800528 };
529};
530
531// Note about the datasets:
532// - .cert a valid certificate
Eric Newberryb74bbda2020-06-18 19:33:58 -0700533// - .goodData is a Data packet that can be verified against .cert
534// - .badSigData a valid and signed Data packet that cannot be verified against cert (signed using
535// a different private key)
536// - .goodInterest is an Interest packet that can be verified against .cert
537// - .badSigInterest is a valid and signed Interest packet that cannot be verified against .cert
538// (signed using a different private key)
539// - .goodInterestOldFormat is an Interest packet that can be verified against .cert (in the old
540// signed Interest format)
541// - .badSigInterestOldFormat is a valid and signed Interest packet that cannot be verified against
542// .cert (signed using a different private key and in the old signed Interest format)
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800543
Davide Pesavento77d9e812019-06-03 22:05:54 -0400544using SignatureDatasets = boost::mpl::vector<EcdsaDataset, RsaDataset>;
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800545
546BOOST_AUTO_TEST_CASE_TEMPLATE(VerifySignature, Dataset, SignatureDatasets)
547{
548 Dataset dataset;
Davide Pesaventof2cae612021-03-24 18:47:05 -0400549 Certificate cert(Block(dataset.cert.data(), dataset.cert.size()));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800550 Buffer keyRaw = cert.getPublicKey();
Davide Pesavento77d9e812019-06-03 22:05:54 -0400551 transform::PublicKey key;
Davide Pesavento5d0b0102017-10-07 13:43:16 -0400552 key.loadPkcs8(keyRaw.data(), keyRaw.size());
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800553 Data data(Block(dataset.goodData.data(), dataset.goodData.size()));
554 Data badSigData(Block(dataset.badSigData.data(), dataset.badSigData.size()));
555 Interest interest(Block(dataset.goodInterest.data(), dataset.goodInterest.size()));
556 Interest badSigInterest(Block(dataset.badSigInterest.data(), dataset.badSigInterest.size()));
Eric Newberryb74bbda2020-06-18 19:33:58 -0700557 Interest interestOldFormat(Block(dataset.goodInterestOldFormat.data(),
558 dataset.goodInterestOldFormat.size()));
559 Interest badSigInterestOldFormat(Block(dataset.badSigInterestOldFormat.data(),
560 dataset.badSigInterestOldFormat.size()));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800561
562 BOOST_CHECK(verifySignature(data, key));
Davide Pesavento5d0b0102017-10-07 13:43:16 -0400563 BOOST_CHECK(verifySignature(data, keyRaw.data(), keyRaw.size()));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800564 BOOST_CHECK(verifySignature(data, cert));
565 BOOST_CHECK(verifySignature(interest, key));
Davide Pesavento5d0b0102017-10-07 13:43:16 -0400566 BOOST_CHECK(verifySignature(interest, keyRaw.data(), keyRaw.size()));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800567 BOOST_CHECK(verifySignature(interest, cert));
Eric Newberryb74bbda2020-06-18 19:33:58 -0700568 BOOST_CHECK(verifySignature(interestOldFormat, key));
569 BOOST_CHECK(verifySignature(interestOldFormat, keyRaw.data(), keyRaw.size()));
570 BOOST_CHECK(verifySignature(interestOldFormat, cert));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800571
572 BOOST_CHECK(!verifySignature(badSigData, key));
Davide Pesavento5d0b0102017-10-07 13:43:16 -0400573 BOOST_CHECK(!verifySignature(badSigData, keyRaw.data(), keyRaw.size()));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800574 BOOST_CHECK(!verifySignature(badSigData, cert));
575 BOOST_CHECK(!verifySignature(badSigInterest, key));
Davide Pesavento5d0b0102017-10-07 13:43:16 -0400576 BOOST_CHECK(!verifySignature(badSigInterest, keyRaw.data(), keyRaw.size()));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800577 BOOST_CHECK(!verifySignature(badSigInterest, cert));
Eric Newberryb74bbda2020-06-18 19:33:58 -0700578 BOOST_CHECK(!verifySignature(badSigInterestOldFormat, key));
579 BOOST_CHECK(!verifySignature(badSigInterestOldFormat, keyRaw.data(), keyRaw.size()));
580 BOOST_CHECK(!verifySignature(badSigInterestOldFormat, cert));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800581
582 Data unsignedData("/some/data");
583 Interest unsignedInterest1("/some/interest/with/several/name/components");
Eric Newberryb74bbda2020-06-18 19:33:58 -0700584 unsignedInterest1.setCanBePrefix(false);
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800585 Interest unsignedInterest2("/interest-with-one-name-component");
Eric Newberryb74bbda2020-06-18 19:33:58 -0700586 unsignedInterest2.setCanBePrefix(false);
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800587
588 BOOST_CHECK(!verifySignature(unsignedData, cert));
589 BOOST_CHECK(!verifySignature(unsignedData, key));
590 BOOST_CHECK(!verifySignature(unsignedInterest1, cert));
591 BOOST_CHECK(!verifySignature(unsignedInterest1, key));
592 BOOST_CHECK(!verifySignature(unsignedInterest2, cert));
593 BOOST_CHECK(!verifySignature(unsignedInterest2, key));
594
595 uint8_t invalidKey[] = {0x00, 0x00};
596 BOOST_CHECK(!verifySignature(unsignedData, invalidKey, sizeof(invalidKey)));
597 BOOST_CHECK(!verifySignature(unsignedInterest1, invalidKey, sizeof(invalidKey)));
598
599 // - base version of verifySignature is tested transitively
Alexander Afanasyev09236c22020-06-03 13:42:38 -0400600 // - pib::Key version is tested as part of key-chain.t.cpp (Security/TestKeyChain)
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800601}
602
Davide Pesavento4c1ad4c2020-11-16 21:12:02 -0500603BOOST_FIXTURE_TEST_CASE(VerifyHmac, KeyChainFixture)
laqinfanbc997e52019-06-25 22:11:09 -0500604{
605 const Tpm& tpm = m_keyChain.getTpm();
606 Data data("/data");
607 Interest interest("/interest");
Eric Newberryb74bbda2020-06-18 19:33:58 -0700608 interest.setCanBePrefix(false);
609 Interest interestOldFormat("/interest");
610 interestOldFormat.setCanBePrefix(false);
laqinfanbc997e52019-06-25 22:11:09 -0500611 SigningInfo signingInfo;
612 signingInfo.setSigningHmacKey("QjM3NEEyNkE3MTQ5MDQzN0FBMDI0RTRGQURENUI0OTdGREZGMUE4RUE2RkYxMkY2"
613 "RkI2NUFGMjcyMEI1OUNDRg==");
614 signingInfo.setDigestAlgorithm(DigestAlgorithm::SHA256);
615
616 BOOST_CHECK(!verifySignature(data, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256));
617 BOOST_CHECK(!verifySignature(interest, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256));
618
619 m_keyChain.sign(data, signingInfo);
Eric Newberryb74bbda2020-06-18 19:33:58 -0700620 signingInfo.setSignedInterestFormat(SignedInterestFormat::V03);
laqinfanbc997e52019-06-25 22:11:09 -0500621 m_keyChain.sign(interest, signingInfo);
Eric Newberryb74bbda2020-06-18 19:33:58 -0700622 signingInfo.setSignedInterestFormat(SignedInterestFormat::V02);
623 m_keyChain.sign(interestOldFormat, signingInfo);
laqinfanbc997e52019-06-25 22:11:09 -0500624 BOOST_CHECK(verifySignature(data, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256));
625 BOOST_CHECK(verifySignature(interest, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256));
Eric Newberryb74bbda2020-06-18 19:33:58 -0700626 BOOST_CHECK(verifySignature(interestOldFormat, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256));
laqinfanbc997e52019-06-25 22:11:09 -0500627}
628
Davide Pesavento77d9e812019-06-03 22:05:54 -0400629using DigestDatasets = boost::mpl::vector<Sha256Dataset>;
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800630
631BOOST_AUTO_TEST_CASE_TEMPLATE(VerifyDigest, Dataset, DigestDatasets)
632{
633 Dataset dataset;
634 Data data(Block(dataset.goodData.data(), dataset.goodData.size()));
635 Data badSigData(Block(dataset.badSigData.data(), dataset.badSigData.size()));
636 Interest interest(Block(dataset.goodInterest.data(), dataset.goodInterest.size()));
637 Interest badSigInterest(Block(dataset.badSigInterest.data(), dataset.badSigInterest.size()));
Eric Newberryb74bbda2020-06-18 19:33:58 -0700638 Interest interestOldFormat(Block(dataset.goodInterestOldFormat.data(),
639 dataset.goodInterestOldFormat.size()));
640 Interest badSigInterestOldFormat(Block(dataset.badSigInterestOldFormat.data(),
641 dataset.badSigInterestOldFormat.size()));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800642
Justin Labryaef53b62021-03-10 06:07:27 +0000643 BOOST_CHECK(verifySignature(data, nullopt));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800644 BOOST_CHECK(verifyDigest(data, DigestAlgorithm::SHA256));
Justin Labryaef53b62021-03-10 06:07:27 +0000645 BOOST_CHECK(verifySignature(interest, nullopt));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800646 BOOST_CHECK(verifyDigest(interest, DigestAlgorithm::SHA256));
Justin Labryaef53b62021-03-10 06:07:27 +0000647 BOOST_CHECK(verifySignature(interestOldFormat, nullopt));
Eric Newberryb74bbda2020-06-18 19:33:58 -0700648 BOOST_CHECK(verifyDigest(interestOldFormat, DigestAlgorithm::SHA256));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800649
650 BOOST_CHECK(!verifyDigest(badSigData, DigestAlgorithm::SHA256));
651 BOOST_CHECK(!verifyDigest(badSigInterest, DigestAlgorithm::SHA256));
Eric Newberryb74bbda2020-06-18 19:33:58 -0700652 BOOST_CHECK(!verifyDigest(badSigInterestOldFormat, DigestAlgorithm::SHA256));
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800653
Justin Labryaef53b62021-03-10 06:07:27 +0000654 BOOST_CHECK(!verifySignature(badSigData, nullopt));
655 BOOST_CHECK(!verifySignature(badSigInterest, nullopt));
656 BOOST_CHECK(!verifySignature(badSigInterestOldFormat, nullopt));
657
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800658 Data unsignedData("/some/data");
659 Interest unsignedInterest1("/some/interest/with/several/name/components");
Eric Newberryb74bbda2020-06-18 19:33:58 -0700660 unsignedInterest1.setCanBePrefix(false);
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800661 Interest unsignedInterest2("/interest-with-one-name-component");
Eric Newberryb74bbda2020-06-18 19:33:58 -0700662 unsignedInterest2.setCanBePrefix(false);
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800663
664 BOOST_CHECK(!verifyDigest(unsignedData, DigestAlgorithm::SHA256));
665 BOOST_CHECK(!verifyDigest(unsignedInterest1, DigestAlgorithm::SHA256));
666 BOOST_CHECK(!verifyDigest(unsignedInterest2, DigestAlgorithm::SHA256));
667
Justin Labryaef53b62021-03-10 06:07:27 +0000668 BOOST_CHECK(!verifySignature(unsignedData, nullopt));
669 BOOST_CHECK(!verifySignature(unsignedInterest1, nullopt));
670 BOOST_CHECK(!verifySignature(unsignedInterest2, nullopt));
671
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800672 // - base version of verifyDigest is tested transitively
673}
674
Eric Newberrye36aae12020-08-31 22:23:13 -0700675const uint8_t sha256DataUnrecognizedElements[] = {
676 0x06, 0x47, 0x07, 0x14, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
677 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x14, 0x00, 0x15, 0x00, 0x16, 0x03, 0x1B, 0x01,
678 0x00, 0x17, 0x20, 0xE2, 0xE2, 0x2F, 0x02, 0x70, 0xA7, 0xF7, 0x48, 0x70, 0x45, 0x29, 0x46, 0xBD,
679 0xD2, 0x62, 0x24, 0xA6, 0x1E, 0x1D, 0x75, 0x2A, 0x26, 0x98, 0x04, 0xAD, 0x9C, 0x47, 0x63, 0xF8,
680 0x98, 0x5A, 0x49, 0xAA, 0x04, 0x01, 0x02, 0x03, 0x04
681};
682
683const uint8_t sha256InterestUnrecognizedElements[] = {
684 0x05, 0x71, 0x07, 0x3A, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
685 0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x9A, 0x55,
686 0xC0, 0xB5, 0x36, 0xC6, 0x6C, 0x0E, 0x11, 0x41, 0xAF, 0xA5, 0x7F, 0x0B, 0x45, 0x53, 0x3D, 0xEE,
687 0x40, 0x1B, 0x9B, 0xAF, 0xEA, 0xBF, 0x3D, 0x56, 0x89, 0x12, 0xE0, 0x18, 0x98, 0x26, 0x0A, 0x04,
688 0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x03, 0x1B, 0x01, 0x00, 0x2E, 0x20, 0xEF, 0x45, 0x55,
689 0x75, 0xC8, 0x18, 0x5E, 0xE9, 0x2A, 0xAE, 0x52, 0x61, 0x0A, 0x94, 0x41, 0x03, 0x36, 0x4C, 0x13,
690 0x59, 0xD4, 0xC7, 0xA4, 0x3A, 0xA0, 0x40, 0x61, 0x44, 0x33, 0x93, 0x5E, 0x99, 0xAA, 0x04, 0x01,
691 0x02, 0x03, 0x04
692};
693
694BOOST_AUTO_TEST_CASE(VerifyWithUnrecognizedElements) // Bug #4583
695{
696 Data data(Block(sha256DataUnrecognizedElements, sizeof(sha256DataUnrecognizedElements)));
697 Interest interest(Block(sha256InterestUnrecognizedElements, sizeof(sha256InterestUnrecognizedElements)));
698
699 BOOST_CHECK(verifyDigest(data, DigestAlgorithm::SHA256));
700 BOOST_CHECK(verifyDigest(interest, DigestAlgorithm::SHA256));
701}
702
Alexander Afanasyev574aa862017-01-10 19:53:28 -0800703BOOST_AUTO_TEST_SUITE_END() // TestVerificationHelpers
704BOOST_AUTO_TEST_SUITE_END() // Security
705
706} // namespace tests
707} // namespace security
708} // namespace ndn