Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Junxiao Shi | 2bea5c4 | 2017-08-14 20:10:32 +0000 | [diff] [blame] | 2 | /* |
Davide Pesavento | 35c6379 | 2022-01-17 02:06:03 -0500 | [diff] [blame] | 3 | * Copyright (c) 2013-2022 Regents of the University of California. |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 4 | * |
| 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 Pesavento | 7e78064 | 2018-11-24 15:51:34 -0500 | [diff] [blame] | 22 | #include "ndn-cxx/security/verification-helpers.hpp" |
Davide Pesavento | 94dfcf1 | 2021-09-26 14:18:45 -0400 | [diff] [blame] | 23 | #include "ndn-cxx/security/impl/openssl.hpp" |
Davide Pesavento | 7e78064 | 2018-11-24 15:51:34 -0500 | [diff] [blame] | 24 | #include "ndn-cxx/security/transform/public-key.hpp" |
| 25 | // #include "ndn-cxx/util/string-helper.hpp" |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 26 | |
Davide Pesavento | 4c1ad4c | 2020-11-16 21:12:02 -0500 | [diff] [blame] | 27 | #include "tests/key-chain-fixture.hpp" |
| 28 | #include "tests/test-common.hpp" |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 29 | |
Davide Pesavento | 77d9e81 | 2019-06-03 22:05:54 -0400 | [diff] [blame] | 30 | #include <boost/mpl/vector.hpp> |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 31 | |
| 32 | namespace ndn { |
| 33 | namespace security { |
| 34 | namespace tests { |
| 35 | |
| 36 | using namespace ndn::tests; |
| 37 | |
| 38 | BOOST_AUTO_TEST_SUITE(Security) |
| 39 | BOOST_AUTO_TEST_SUITE(TestVerificationHelpers) |
| 40 | |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 41 | // // Use this test case to regenerate the dataset if the signature format changes |
Davide Pesavento | 4c1ad4c | 2020-11-16 21:12:02 -0500 | [diff] [blame] | 42 | // BOOST_FIXTURE_TEST_CASE(Generator, KeyChainFixture) |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 43 | // { |
Davide Pesavento | 4c1ad4c | 2020-11-16 21:12:02 -0500 | [diff] [blame] | 44 | // Identity wrongIdentity = m_keyChain.createIdentity("/Security/TestVerificationHelpers/Wrong"); |
Davide Pesavento | 809f754 | 2021-03-24 18:53:05 -0400 | [diff] [blame] | 45 | // const std::map<std::string, SigningInfo> identities = { |
Davide Pesavento | 4c1ad4c | 2020-11-16 21:12:02 -0500 | [diff] [blame] | 46 | // {"Ecdsa", signingByIdentity(m_keyChain.createIdentity("/Security/TestVerificationHelpers/EC", EcKeyParams()))}, |
| 47 | // {"Rsa", signingByIdentity(m_keyChain.createIdentity("/Security/TestVerificationHelpers/RSA", RsaKeyParams()))}, |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 48 | // {"Sha256", signingWithSha256()} |
| 49 | // }; |
| 50 | |
| 51 | // auto print = [] (const std::string& name, const uint8_t* buf, size_t size) { |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 52 | // std::cout << " const Block " + name + "{{\n "; |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 53 | |
| 54 | // std::string hex = toHex(buf, size); |
| 55 | |
| 56 | // for (size_t i = 0; i < hex.size(); i++) { |
| 57 | // if (i > 0 && i % 32 == 0) |
| 58 | // std::cout << "\n "; |
| 59 | |
| 60 | // std::cout << "0x" << hex[i]; |
| 61 | // std::cout << hex[++i]; |
| 62 | |
| 63 | // if ((i + 1) != hex.size()) |
| 64 | // std::cout << ", "; |
| 65 | // } |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 66 | // std::cout << "\n }};"; |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 67 | // }; |
| 68 | |
| 69 | // for (const auto& i : identities) { |
| 70 | // const std::string& type = i.first; |
| 71 | // const SigningInfo& signingInfo = i.second; |
| 72 | |
| 73 | // std::cout << "struct " + type + "Dataset\n{\n"; |
| 74 | // std::cout << " const std::string name = \"" << type << "\";\n"; |
| 75 | |
Junxiao Shi | fe1239a | 2017-01-27 20:36:12 +0000 | [diff] [blame] | 76 | // if (signingInfo.getSignerType() == SigningInfo::SIGNER_TYPE_ID) { |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 77 | // print("cert", signingInfo.getPibIdentity().getDefaultKey().getDefaultCertificate().wireEncode().wire(), |
| 78 | // signingInfo.getPibIdentity().getDefaultKey().getDefaultCertificate().wireEncode().size()); |
| 79 | // } |
| 80 | // else { |
| 81 | // print("cert", nullptr, 0); |
| 82 | // } |
| 83 | // std::cout << "\n"; |
| 84 | |
| 85 | // // Create data that can be verified by cert |
| 86 | // Data data(Name("/test/data").append(type)); |
| 87 | // m_keyChain.sign(data, signingInfo); |
| 88 | // print("goodData", data.wireEncode().wire(), data.wireEncode().size()); |
| 89 | // std::cout << "\n"; |
| 90 | |
| 91 | // // Create data that cannot be verified by cert |
| 92 | // m_keyChain.sign(data, signingByIdentity(wrongIdentity)); |
| 93 | // print("badSigData", data.wireEncode().wire(), data.wireEncode().size()); |
| 94 | // std::cout << "\n"; |
| 95 | |
| 96 | // // Create interest that can be verified by cert |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 97 | // Interest interest1(Name("/test/interest").append(type)); |
| 98 | // SigningInfo signingInfoV03(signingInfo); |
| 99 | // signingInfoV03.setSignedInterestFormat(SignedInterestFormat::V03); |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 100 | // interest1.setNonce(0xF72C8A4B); |
| 101 | // m_keyChain.sign(interest1, signingInfoV03); |
| 102 | // print("goodInterest", interest1.wireEncode().wire(), interest1.wireEncode().size()); |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 103 | // std::cout << "\n"; |
| 104 | |
| 105 | // // Create interest that cannot be verified by cert |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 106 | // 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); |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 115 | // interest2.setNonce(0xF72C8A4B); |
| 116 | // m_keyChain.sign(interest2, signingInfoV02); |
| 117 | // print("goodInterestOldFormat", interest2.wireEncode().wire(), interest2.wireEncode().size()); |
| 118 | // std::cout << "\n"; |
| 119 | |
| 120 | // // Create interest that cannot be verified by cert (old signed Interest format) |
| 121 | // m_keyChain.sign(interest2, signingByIdentity(wrongIdentity) |
| 122 | // .setSignedInterestFormat(SignedInterestFormat::V02)); |
| 123 | // print("badSigInterestOldFormat", interest2.wireEncode().wire(), interest2.wireEncode().size()); |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 124 | // std::cout << "\n};\n\n"; |
| 125 | // } |
| 126 | // } |
| 127 | |
| 128 | struct EcdsaDataset |
| 129 | { |
| 130 | const std::string name = "Ecdsa"; |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 131 | const Block cert{{ |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 132 | 0x06, 0xFD, 0x01, 0x62, 0x07, 0x47, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 133 | 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, |
| 134 | 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 135 | 0x45, 0x59, 0x08, 0x08, 0xA5, 0x8F, 0x5F, 0x7F, 0x18, 0x1A, 0x98, 0x14, 0x08, 0x04, 0x73, 0x65, |
| 136 | 0x6C, 0x66, 0x08, 0x09, 0xFD, 0x00, 0x00, 0x01, 0x72, 0xCE, 0xA8, 0xE7, 0x53, 0x14, 0x09, 0x18, |
| 137 | 0x01, 0x02, 0x19, 0x04, 0x00, 0x36, 0xEE, 0x80, 0x15, 0x5B, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, |
| 138 | 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, |
| 139 | 0x07, 0x03, 0x42, 0x00, 0x04, 0x15, 0x94, 0xDF, 0xBF, 0x2D, 0x83, 0x2C, 0x1F, 0xB7, 0x9D, 0x55, |
| 140 | 0x9A, 0x6A, 0xC2, 0xDB, 0x03, 0xE9, 0xB2, 0x6B, 0x77, 0x6D, 0xF6, 0x42, 0x81, 0x2F, 0xC8, 0xDE, |
| 141 | 0x3F, 0x8B, 0xF4, 0x27, 0x1C, 0x4F, 0xE9, 0x47, 0x0C, 0x44, 0x83, 0x52, 0xA0, 0xA2, 0x4E, 0x52, |
| 142 | 0x49, 0xC5, 0xAD, 0x2D, 0x9B, 0x9C, 0xAE, 0xF5, 0x4C, 0x2A, 0xB5, 0xC4, 0xF5, 0xFB, 0xF3, 0x93, |
| 143 | 0xD4, 0x86, 0x61, 0xE6, 0x70, 0x16, 0x67, 0x1B, 0x01, 0x03, 0x1C, 0x38, 0x07, 0x36, 0x08, 0x08, |
| 144 | 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, |
| 145 | 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, |
| 146 | 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xA5, 0x8F, 0x5F, 0x7F, |
| 147 | 0x18, 0x1A, 0x98, 0x14, 0xFD, 0x00, 0xFD, 0x26, 0xFD, 0x00, 0xFE, 0x0F, 0x31, 0x39, 0x37, 0x30, |
| 148 | 0x30, 0x31, 0x30, 0x31, 0x54, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xFD, 0x00, 0xFF, 0x0F, 0x32, |
| 149 | 0x30, 0x34, 0x30, 0x30, 0x36, 0x31, 0x34, 0x54, 0x32, 0x32, 0x31, 0x37, 0x35, 0x35, 0x17, 0x46, |
| 150 | 0x30, 0x44, 0x02, 0x20, 0x4B, 0xF7, 0x85, 0xB8, 0x01, 0x7D, 0x65, 0x02, 0x6C, 0xFB, 0x69, 0x00, |
| 151 | 0x8B, 0x4D, 0xCC, 0x0F, 0xB5, 0x87, 0xF8, 0x4C, 0x69, 0xE0, 0x7C, 0x16, 0xCC, 0x52, 0xB2, 0x29, |
| 152 | 0x6B, 0x24, 0xF5, 0x7F, 0x02, 0x20, 0x1C, 0x88, 0xDE, 0x32, 0x3F, 0x1A, 0xE6, 0x60, 0xA2, 0x29, |
| 153 | 0x94, 0xD9, 0x05, 0x8F, 0x57, 0x14, 0xD6, 0x17, 0x3C, 0x78, 0xBF, 0x85, 0xF5, 0x1D, 0xCC, 0x03, |
| 154 | 0x35, 0x9E, 0xC9, 0xA9, 0x6B, 0x09 |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 155 | }}; |
| 156 | const Block goodData{{ |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 157 | 0x06, 0xA2, 0x07, 0x13, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61, |
| 158 | 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x14, 0x00, 0x15, 0x00, 0x16, 0x3D, 0x1B, 0x01, 0x03, |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 159 | 0x1C, 0x38, 0x07, 0x36, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, |
| 160 | 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, |
| 161 | 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, 0x45, 0x59, |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 162 | 0x08, 0x08, 0xA5, 0x8F, 0x5F, 0x7F, 0x18, 0x1A, 0x98, 0x14, 0x17, 0x48, 0x30, 0x46, 0x02, 0x21, |
| 163 | 0x00, 0xD2, 0x35, 0xAD, 0xA9, 0xE6, 0x1E, 0x0F, 0xF3, 0xDE, 0x1D, 0xEA, 0x18, 0xCA, 0xEE, 0x5D, |
| 164 | 0x05, 0xD1, 0xE0, 0x6A, 0x1E, 0xA5, 0x1A, 0xD6, 0xE6, 0x88, 0xB3, 0x24, 0xA9, 0xD5, 0x97, 0x4D, |
| 165 | 0xC3, 0x02, 0x21, 0x00, 0xB5, 0xA3, 0x87, 0xD8, 0x9B, 0xB6, 0x92, 0xAD, 0x19, 0x84, 0xAE, 0x4D, |
| 166 | 0xF5, 0x64, 0xEC, 0x1C, 0xF2, 0xA0, 0xB7, 0x4D, 0x6B, 0x74, 0xFF, 0x39, 0x38, 0xFD, 0x5D, 0x9D, |
| 167 | 0x46, 0xE0, 0xD2, 0xB4 |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 168 | }}; |
| 169 | const Block badSigData{{ |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 170 | 0x06, 0xA5, 0x07, 0x13, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61, |
| 171 | 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x14, 0x00, 0x15, 0x00, 0x16, 0x40, 0x1B, 0x01, 0x03, |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 172 | 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, |
| 173 | 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, |
| 174 | 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 175 | 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x17, 0x48, 0x30, |
| 176 | 0x46, 0x02, 0x21, 0x00, 0xBB, 0x15, 0xAC, 0x92, 0xFB, 0x7D, 0x6F, 0x6C, 0x90, 0xC9, 0x45, 0x71, |
| 177 | 0x97, 0x39, 0xCD, 0x8C, 0x30, 0xA0, 0x8C, 0x69, 0xCA, 0x39, 0xDB, 0xE5, 0xC2, 0x95, 0x55, 0xB4, |
| 178 | 0x13, 0xB4, 0xB8, 0x95, 0x02, 0x21, 0x00, 0xDA, 0x54, 0x99, 0xF8, 0xE5, 0xC1, 0x74, 0xAC, 0xE0, |
| 179 | 0xF2, 0xDF, 0x0D, 0xC5, 0xE1, 0xCF, 0x99, 0x28, 0x6C, 0xB0, 0x2D, 0x55, 0xC8, 0x74, 0x63, 0x56, |
| 180 | 0x2A, 0x1A, 0xB0, 0x00, 0xBD, 0xFF, 0xC5 |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 181 | }}; |
| 182 | const Block goodInterest{{ |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 183 | 0x05, 0xCA, 0x07, 0x39, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65, |
| 184 | 0x72, 0x65, 0x73, 0x74, 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x02, 0x20, 0x8F, 0x41, 0x49, |
| 185 | 0x40, 0xDA, 0x38, 0xC1, 0x0E, 0x75, 0x5A, 0x6D, 0x4A, 0xD4, 0xFC, 0xE2, 0xDF, 0xBA, 0x52, 0xAF, |
| 186 | 0x0C, 0x9E, 0xEB, 0xD6, 0xC5, 0xD1, 0x1B, 0x51, 0x43, 0xBD, 0x19, 0xA7, 0x62, 0x0A, 0x04, 0xF7, |
| 187 | 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3D, 0x1B, 0x01, 0x03, 0x1C, 0x38, 0x07, 0x36, 0x08, 0x08, |
| 188 | 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, |
| 189 | 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, |
| 190 | 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xA5, 0x8F, 0x5F, 0x7F, |
| 191 | 0x18, 0x1A, 0x98, 0x14, 0x2E, 0x46, 0x30, 0x44, 0x02, 0x20, 0x14, 0x1A, 0xF5, 0x9C, 0xD2, 0x3F, |
| 192 | 0xA9, 0x71, 0x3B, 0x37, 0xD7, 0x97, 0xE6, 0x29, 0x12, 0x40, 0x44, 0x7B, 0xF1, 0x98, 0x03, 0xC1, |
| 193 | 0xDB, 0xEA, 0x3A, 0x71, 0x83, 0x0D, 0xC4, 0x26, 0xB7, 0x24, 0x02, 0x20, 0x0F, 0x14, 0x10, 0xDB, |
| 194 | 0xDB, 0x24, 0xCB, 0xB3, 0xD2, 0x4B, 0x45, 0x6D, 0xA0, 0xBB, 0x4B, 0x87, 0xC1, 0x59, 0x9F, 0xC8, |
| 195 | 0xBE, 0x75, 0xF5, 0xCC, 0xCB, 0xD2, 0x4F, 0xD8, 0x87, 0x26, 0x51, 0xBF |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 196 | }}; |
| 197 | const Block badSigInterest{{ |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 198 | 0x05, 0xCF, 0x07, 0x39, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65, |
| 199 | 0x72, 0x65, 0x73, 0x74, 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x02, 0x20, 0x53, 0x14, 0x5E, |
| 200 | 0xA3, 0x31, 0x41, 0xD8, 0xA1, 0x10, 0x06, 0x3C, 0x8E, 0xF3, 0x51, 0xA0, 0xC2, 0x8A, 0xBC, 0xFC, |
| 201 | 0x01, 0x5F, 0x12, 0x12, 0x11, 0x27, 0xD2, 0x18, 0xE5, 0xE7, 0xE4, 0xBD, 0x57, 0x0A, 0x04, 0xF7, |
| 202 | 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, |
| 203 | 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, |
| 204 | 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, |
| 205 | 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, |
| 206 | 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x2E, 0x48, 0x30, 0x46, 0x02, 0x21, 0x00, 0xC9, 0x69, |
| 207 | 0xD8, 0xB8, 0x59, 0x38, 0x31, 0x0B, 0x44, 0x66, 0xAE, 0x1C, 0x1C, 0x88, 0x2A, 0x95, 0xD0, 0xE5, |
| 208 | 0x31, 0x61, 0xA6, 0x94, 0x1F, 0x9B, 0xAD, 0x47, 0x1C, 0x9D, 0x56, 0x37, 0x50, 0xBE, 0x02, 0x21, |
| 209 | 0x00, 0xC7, 0x23, 0x25, 0xF7, 0xFA, 0x6A, 0x2D, 0x3D, 0xF4, 0xD8, 0xDB, 0xE9, 0x76, 0x6A, 0x63, |
| 210 | 0xD4, 0x11, 0x17, 0x4A, 0xDB, 0x7F, 0x85, 0x52, 0x97, 0xFC, 0x5B, 0x0B, 0x1B, 0xBA, 0xE5, 0xED, |
| 211 | 0x9A |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 212 | }}; |
| 213 | const Block goodInterestOldFormat{{ |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 214 | 0x05, 0xCB, 0x07, 0x39, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65, |
| 215 | 0x72, 0x65, 0x73, 0x74, 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x02, 0x20, 0xDB, 0x6D, 0x5E, |
| 216 | 0xA7, 0xBF, 0xAF, 0xEC, 0xA0, 0xC6, 0x20, 0x4E, 0xF2, 0x04, 0xF8, 0xFF, 0x39, 0x2A, 0x5F, 0xE6, |
| 217 | 0x5F, 0x5B, 0xCE, 0x02, 0xA6, 0xBE, 0x82, 0x3F, 0xD2, 0x26, 0x47, 0x92, 0x62, 0x0A, 0x04, 0xF7, |
| 218 | 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3D, 0x1B, 0x01, 0x03, 0x1C, 0x38, 0x07, 0x36, 0x08, 0x08, |
| 219 | 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, |
| 220 | 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, |
| 221 | 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xA5, 0x8F, 0x5F, 0x7F, |
| 222 | 0x18, 0x1A, 0x98, 0x14, 0x2E, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xCA, 0xFD, 0x19, 0x4C, 0x6C, |
| 223 | 0x1B, 0x95, 0xD4, 0x2B, 0x15, 0x01, 0xE3, 0x87, 0x1F, 0xD7, 0xF2, 0x3D, 0x3E, 0x2E, 0x64, 0xAA, |
| 224 | 0x60, 0x63, 0x51, 0xB3, 0x52, 0xBC, 0x6D, 0x24, 0x0C, 0x6D, 0x38, 0x02, 0x20, 0x0E, 0x21, 0xF1, |
| 225 | 0x51, 0x39, 0x2D, 0x4A, 0x45, 0x05, 0x45, 0xFA, 0x85, 0xA7, 0xCC, 0x00, 0xFE, 0x89, 0x8A, 0xD6, |
| 226 | 0xD7, 0x34, 0x0D, 0x31, 0x6A, 0x94, 0xAE, 0x1F, 0xD8, 0x07, 0xF1, 0xDF, 0x80 |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 227 | }}; |
| 228 | const Block badSigInterestOldFormat{{ |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 229 | 0x05, 0xFD, 0x01, 0x5B, 0x07, 0xC9, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, |
| 230 | 0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x02, 0x20, 0xDB, |
| 231 | 0x6D, 0x5E, 0xA7, 0xBF, 0xAF, 0xEC, 0xA0, 0xC6, 0x20, 0x4E, 0xF2, 0x04, 0xF8, 0xFF, 0x39, 0x2A, |
| 232 | 0x5F, 0xE6, 0x5F, 0x5B, 0xCE, 0x02, 0xA6, 0xBE, 0x82, 0x3F, 0xD2, 0x26, 0x47, 0x92, 0x62, 0x08, |
| 233 | 0x42, 0x16, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, |
| 234 | 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, |
| 235 | 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, |
| 236 | 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, |
| 237 | 0x5D, 0x6E, 0x43, 0x08, 0x4A, 0x17, 0x48, 0x30, 0x46, 0x02, 0x21, 0x00, 0xD0, 0x33, 0x6A, 0x5D, |
| 238 | 0x8A, 0x1B, 0x04, 0xF9, 0xE5, 0xEE, 0x3A, 0x5A, 0x73, 0x63, 0xBF, 0xD4, 0x39, 0x07, 0x53, 0xA9, |
| 239 | 0xF5, 0xBB, 0xB3, 0xD4, 0x7E, 0x65, 0x7B, 0xCB, 0x5A, 0xB1, 0x4B, 0xCE, 0x02, 0x21, 0x00, 0xD4, |
| 240 | 0xA0, 0x7F, 0x40, 0x7A, 0xCF, 0xA5, 0xAD, 0x11, 0x44, 0x2F, 0xB1, 0xE0, 0x48, 0x25, 0x0B, 0x1C, |
| 241 | 0x84, 0x76, 0x1F, 0x1B, 0x28, 0x4B, 0x36, 0x5F, 0x23, 0x3F, 0x91, 0xB3, 0xEF, 0x38, 0x2F, 0x0A, |
| 242 | 0x04, 0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3D, 0x1B, 0x01, 0x03, 0x1C, 0x38, 0x07, 0x36, |
| 243 | 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, |
| 244 | 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, |
| 245 | 0x65, 0x72, 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xA5, 0x8F, |
| 246 | 0x5F, 0x7F, 0x18, 0x1A, 0x98, 0x14, 0x2E, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xCA, 0xFD, 0x19, |
| 247 | 0x4C, 0x6C, 0x1B, 0x95, 0xD4, 0x2B, 0x15, 0x01, 0xE3, 0x87, 0x1F, 0xD7, 0xF2, 0x3D, 0x3E, 0x2E, |
| 248 | 0x64, 0xAA, 0x60, 0x63, 0x51, 0xB3, 0x52, 0xBC, 0x6D, 0x24, 0x0C, 0x6D, 0x38, 0x02, 0x20, 0x0E, |
| 249 | 0x21, 0xF1, 0x51, 0x39, 0x2D, 0x4A, 0x45, 0x05, 0x45, 0xFA, 0x85, 0xA7, 0xCC, 0x00, 0xFE, 0x89, |
| 250 | 0x8A, 0xD6, 0xD7, 0x34, 0x0D, 0x31, 0x6A, 0x94, 0xAE, 0x1F, 0xD8, 0x07, 0xF1, 0xDF, 0x80 |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 251 | }}; |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 252 | }; |
| 253 | |
| 254 | struct RsaDataset |
| 255 | { |
| 256 | const std::string name = "Rsa"; |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 257 | const Block cert{{ |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 258 | 0x06, 0xFD, 0x02, 0xED, 0x07, 0x48, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, |
| 259 | 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, |
| 260 | 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 261 | 0x4B, 0x45, 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE, 0xDB, 0xE7, 0x2E, 0xC6, 0xC7, 0x08, 0x04, 0x73, |
| 262 | 0x65, 0x6C, 0x66, 0x08, 0x09, 0xFD, 0x00, 0x00, 0x01, 0x72, 0xCE, 0xA8, 0xE7, 0xA4, 0x14, 0x09, |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 263 | 0x18, 0x01, 0x02, 0x19, 0x04, 0x00, 0x36, 0xEE, 0x80, 0x15, 0xFD, 0x01, 0x26, 0x30, 0x82, 0x01, |
| 264 | 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 265 | 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xED, 0x32, |
| 266 | 0x03, 0x4A, 0xC1, 0xC4, 0x73, 0xA7, 0xC3, 0x3C, 0xB3, 0x09, 0x62, 0xF7, 0xA7, 0x5F, 0x83, 0x98, |
| 267 | 0xBD, 0x8A, 0x9F, 0xB3, 0x02, 0x02, 0x53, 0xF1, 0x62, 0x78, 0xE0, 0x08, 0x42, 0x48, 0xC7, 0x81, |
| 268 | 0x2E, 0xA5, 0xD4, 0x9E, 0x7D, 0xD1, 0x38, 0x51, 0x8C, 0xAB, 0x18, 0x87, 0xC5, 0x0B, 0x57, 0x1C, |
| 269 | 0x01, 0xD7, 0xA9, 0x4B, 0xA8, 0xD8, 0xEB, 0x96, 0x95, 0xAC, 0x09, 0xBC, 0xCE, 0xF4, 0x3E, 0xE5, |
| 270 | 0x8D, 0x72, 0x81, 0x30, 0x30, 0xBA, 0xB7, 0xA2, 0x0D, 0xFE, 0x21, 0x2F, 0x97, 0x76, 0x59, 0x80, |
| 271 | 0xC2, 0x92, 0x1B, 0x16, 0xF9, 0x15, 0xE3, 0xF5, 0xA0, 0x2C, 0x87, 0xAB, 0x88, 0x5B, 0x6E, 0x73, |
| 272 | 0x36, 0xDB, 0xE4, 0xF0, 0x19, 0x78, 0x93, 0x26, 0xC3, 0x39, 0x33, 0x27, 0xBE, 0x06, 0x33, 0x84, |
| 273 | 0x9C, 0xA8, 0x8A, 0xF7, 0x41, 0x82, 0xAD, 0xE4, 0x25, 0x86, 0xCC, 0x32, 0x1D, 0x5A, 0x8C, 0x52, |
| 274 | 0x2F, 0x91, 0xD9, 0xD1, 0x31, 0x3F, 0x07, 0xF9, 0x43, 0xF9, 0xA8, 0xE7, 0x92, 0x70, 0xF4, 0xB0, |
| 275 | 0x2F, 0xE1, 0x76, 0x91, 0x42, 0x9C, 0xB9, 0xF3, 0x69, 0x88, 0xD3, 0x36, 0x75, 0x5C, 0x13, 0x18, |
| 276 | 0x85, 0xAA, 0x17, 0xCE, 0x5F, 0x0D, 0x49, 0xED, 0x79, 0xB2, 0x7F, 0x00, 0xF4, 0x5F, 0xD7, 0x29, |
| 277 | 0xD2, 0xB3, 0x1E, 0xA6, 0xFC, 0x7E, 0x0C, 0xCD, 0x6A, 0x5F, 0xC6, 0x68, 0x46, 0x4C, 0x8A, 0x71, |
| 278 | 0x57, 0x08, 0x86, 0xCD, 0xD4, 0xD2, 0x89, 0x37, 0x46, 0xAA, 0x79, 0xA9, 0x3A, 0x13, 0xB0, 0xA0, |
| 279 | 0x63, 0x86, 0xA2, 0x18, 0xC6, 0xB3, 0x8C, 0x59, 0x5D, 0xF7, 0x6F, 0x77, 0xC3, 0x16, 0x42, 0xA7, |
| 280 | 0x9A, 0x3F, 0xF9, 0x07, 0xB4, 0x5A, 0x7B, 0xE3, 0xA6, 0xF1, 0x76, 0xC5, 0x58, 0xB2, 0xC2, 0xAC, |
| 281 | 0x7C, 0x02, 0x9A, 0xB2, 0xD1, 0x2B, 0xBC, 0x23, 0x11, 0x9F, 0xEB, 0x6F, 0xB4, 0x73, 0x02, 0x03, |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 282 | 0x01, 0x00, 0x01, 0x16, 0x68, 0x1B, 0x01, 0x01, 0x1C, 0x39, 0x07, 0x37, 0x08, 0x08, 0x53, 0x65, |
| 283 | 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, |
| 284 | 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 285 | 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE, 0xDB, 0xE7, |
| 286 | 0x2E, 0xC6, 0xC7, 0xFD, 0x00, 0xFD, 0x26, 0xFD, 0x00, 0xFE, 0x0F, 0x31, 0x39, 0x37, 0x30, 0x30, |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 287 | 0x31, 0x30, 0x31, 0x54, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xFD, 0x00, 0xFF, 0x0F, 0x32, 0x30, |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 288 | 0x34, 0x30, 0x30, 0x36, 0x31, 0x34, 0x54, 0x32, 0x32, 0x31, 0x37, 0x35, 0x35, 0x17, 0xFD, 0x01, |
| 289 | 0x00, 0x0F, 0x4D, 0x43, 0x2F, 0x6E, 0xCC, 0xB3, 0xAA, 0x8A, 0x50, 0xBB, 0x3D, 0x92, 0xE6, 0xB7, |
| 290 | 0xFB, 0xD4, 0xEA, 0x20, 0xB4, 0xF8, 0xF0, 0xD8, 0x03, 0x45, 0xB3, 0xFB, 0x82, 0xCE, 0xDB, 0xCE, |
| 291 | 0x1F, 0xC7, 0x61, 0x58, 0x9D, 0x33, 0xAD, 0xA8, 0xFC, 0xB9, 0x31, 0x7F, 0xCF, 0x8D, 0x9C, 0xDF, |
| 292 | 0x4C, 0x29, 0x25, 0xD6, 0x78, 0x8F, 0xCC, 0xC4, 0xF9, 0xF8, 0x88, 0xA9, 0x66, 0x7E, 0xD9, 0x4A, |
| 293 | 0xB2, 0x6F, 0x2A, 0x60, 0xB8, 0x43, 0xCC, 0x46, 0xC3, 0x88, 0x93, 0xC8, 0x0C, 0xD3, 0x87, 0x70, |
| 294 | 0xDA, 0x59, 0x16, 0xF1, 0x37, 0xD0, 0xB5, 0xF0, 0x92, 0x9E, 0xBC, 0xAE, 0xA2, 0x3A, 0x96, 0xB1, |
| 295 | 0x36, 0x26, 0x8E, 0x43, 0xA7, 0x33, 0xEB, 0x13, 0x8C, 0x57, 0x02, 0x20, 0xCB, 0x97, 0xB7, 0x78, |
| 296 | 0x08, 0x58, 0x07, 0x77, 0x66, 0xE9, 0x5D, 0xCB, 0xCD, 0x1E, 0x0D, 0x36, 0x43, 0x23, 0x64, 0x8E, |
| 297 | 0x48, 0x66, 0x60, 0xF6, 0xF4, 0x4C, 0xD6, 0x9E, 0xAF, 0x3C, 0xC6, 0x23, 0x03, 0x09, 0x8A, 0xB1, |
| 298 | 0x26, 0xDA, 0x82, 0x6D, 0xA2, 0x3D, 0x0C, 0x36, 0x56, 0x76, 0x9A, 0x62, 0xBB, 0xDD, 0x0C, 0x91, |
| 299 | 0xB3, 0x8D, 0x0D, 0x9B, 0x55, 0x17, 0xC3, 0xFA, 0x26, 0xC3, 0xE5, 0x77, 0xB3, 0x55, 0x5C, 0xB7, |
| 300 | 0xC9, 0x74, 0x86, 0xD1, 0xEE, 0xDF, 0xEB, 0xAF, 0xC6, 0x4D, 0x42, 0x3F, 0x09, 0x6A, 0x44, 0x7F, |
| 301 | 0xB9, 0xC1, 0xE9, 0xAB, 0xBF, 0xBA, 0xED, 0xDD, 0xE9, 0x09, 0x11, 0x8C, 0x03, 0x1E, 0x5A, 0xA6, |
| 302 | 0x74, 0xF1, 0x39, 0x71, 0xF3, 0x71, 0x26, 0xD5, 0xF2, 0x87, 0xBC, 0x1A, 0x6D, 0xD2, 0x37, 0xC6, |
| 303 | 0x3E, 0xFA, 0xE6, 0xB9, 0x8E, 0x08, 0x82, 0x50, 0xCA, 0xEE, 0x7F, 0x5D, 0x80, 0x65, 0xBA, 0x10, |
| 304 | 0x1F, 0x24, 0xC1, 0x15, 0x78, 0xB7, 0x90, 0xE5, 0x3D, 0xDA, 0x0F, 0x0E, 0x03, 0x20, 0xC1, 0xEA, |
| 305 | 0x85 |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 306 | }}; |
| 307 | const Block goodData{{ |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 308 | 0x06, 0xFD, 0x01, 0x5B, 0x07, 0x11, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, |
| 309 | 0x74, 0x61, 0x08, 0x03, 0x52, 0x73, 0x61, 0x14, 0x00, 0x15, 0x00, 0x16, 0x3E, 0x1B, 0x01, 0x01, |
| 310 | 0x1C, 0x39, 0x07, 0x37, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, |
| 311 | 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, |
| 312 | 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, 0x4B, 0x45, |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 313 | 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE, 0xDB, 0xE7, 0x2E, 0xC6, 0xC7, 0x17, 0xFD, 0x01, 0x00, 0x15, |
| 314 | 0x5E, 0x36, 0xEB, 0x43, 0x60, 0x9E, 0x06, 0xC1, 0x2A, 0xC8, 0x92, 0xAC, 0x0B, 0xC9, 0x8D, 0xEB, |
| 315 | 0x54, 0x4A, 0x3A, 0xC4, 0x88, 0x3C, 0x51, 0x67, 0x19, 0x93, 0x68, 0xC7, 0xD5, 0x70, 0xE7, 0x2C, |
| 316 | 0xB1, 0x78, 0xEA, 0x6A, 0x84, 0x5A, 0x7A, 0x5E, 0xAA, 0x43, 0xE7, 0x09, 0x3E, 0xF8, 0xF1, 0x7C, |
| 317 | 0x9C, 0xE7, 0x72, 0x2D, 0x7B, 0x77, 0xD0, 0xD9, 0x86, 0x6B, 0x05, 0xE9, 0xA7, 0x83, 0x7C, 0xAB, |
| 318 | 0x16, 0xDF, 0x0D, 0x36, 0x37, 0x74, 0x6E, 0xBC, 0x42, 0x2F, 0xFE, 0xDE, 0x40, 0x03, 0x2B, 0xC0, |
| 319 | 0x7E, 0xF8, 0x67, 0xD7, 0x38, 0xD7, 0xE8, 0x7C, 0xCF, 0xCE, 0x9D, 0x14, 0x39, 0xDE, 0xF1, 0x02, |
| 320 | 0x9E, 0xC4, 0x9B, 0xD6, 0x46, 0xBA, 0x57, 0xF9, 0x76, 0xB2, 0x25, 0xD4, 0x0A, 0xB5, 0x31, 0x09, |
| 321 | 0x36, 0x77, 0xF4, 0xDB, 0xC7, 0xD2, 0xD9, 0x14, 0xB0, 0x98, 0xAC, 0x48, 0x7C, 0x30, 0x90, 0xE2, |
| 322 | 0x1E, 0xF1, 0xF5, 0xC5, 0x69, 0xE4, 0xA5, 0xBE, 0xF7, 0x9C, 0x74, 0x97, 0x97, 0xE6, 0xA4, 0x41, |
| 323 | 0x75, 0xDF, 0x8D, 0xFB, 0x2E, 0x9E, 0xA0, 0x57, 0xBB, 0x96, 0xE5, 0x81, 0x9F, 0xF7, 0x95, 0x7B, |
| 324 | 0x6A, 0x2C, 0xE3, 0xF8, 0x48, 0x0C, 0xB2, 0x3F, 0xB6, 0xCF, 0xB8, 0x7F, 0x08, 0x24, 0x77, 0x44, |
| 325 | 0x9A, 0x7F, 0x34, 0x35, 0xFF, 0x68, 0x7E, 0x61, 0x2C, 0x09, 0xF9, 0x0A, 0xAD, 0xBE, 0x57, 0xD3, |
| 326 | 0x2A, 0x2A, 0x9E, 0xE0, 0x8E, 0x5B, 0x79, 0x1C, 0x4C, 0x32, 0x8D, 0xFA, 0xBF, 0xEE, 0xBB, 0xA0, |
| 327 | 0x4F, 0xD9, 0xEB, 0xC1, 0x5D, 0x53, 0x15, 0xBF, 0x8C, 0x7C, 0x6B, 0x22, 0xB9, 0x24, 0x70, 0xAE, |
| 328 | 0x63, 0x13, 0x96, 0x3B, 0x2A, 0xDA, 0x7F, 0x64, 0x0D, 0x9E, 0xA7, 0x90, 0x20, 0x2A, 0x2A, 0xAB, |
| 329 | 0xA9, 0xA6, 0xC9, 0xB2, 0x37, 0x8E, 0xE3, 0x09, 0xFD, 0xA3, 0x68, 0x06, 0xCB, 0x96, 0x80 |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 330 | }}; |
| 331 | const Block badSigData{{ |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 332 | 0x06, 0xA2, 0x07, 0x11, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61, |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 333 | 0x08, 0x03, 0x52, 0x73, 0x61, 0x14, 0x00, 0x15, 0x00, 0x16, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, |
| 334 | 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, |
| 335 | 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, |
| 336 | 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 337 | 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x17, 0x47, 0x30, 0x45, 0x02, |
| 338 | 0x20, 0x15, 0xFC, 0x4C, 0xA4, 0xBA, 0x18, 0xF9, 0x6A, 0x92, 0xC8, 0xA9, 0x62, 0x96, 0x60, 0x39, |
| 339 | 0x6B, 0x74, 0x4A, 0x7C, 0x38, 0x1A, 0x83, 0x33, 0xB2, 0x40, 0x03, 0x59, 0x2C, 0xA4, 0x1A, 0xD1, |
| 340 | 0x1E, 0x02, 0x21, 0x00, 0xA5, 0x62, 0xA5, 0x04, 0x60, 0xBC, 0x96, 0x54, 0x2C, 0x9E, 0x6F, 0xA8, |
| 341 | 0x1B, 0xDB, 0xF9, 0xF0, 0x7E, 0xFF, 0xED, 0x92, 0x3A, 0x4B, 0xDE, 0x3D, 0x20, 0x02, 0x7B, 0xD7, |
| 342 | 0x1C, 0xD0, 0xAA, 0xAB |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 343 | }}; |
| 344 | const Block goodInterest{{ |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 345 | 0x05, 0xFD, 0x01, 0x85, 0x07, 0x37, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, |
| 346 | 0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x08, 0x03, 0x52, 0x73, 0x61, 0x02, 0x20, 0x08, 0x39, 0xEE, |
| 347 | 0x12, 0xF1, 0x10, 0xB7, 0x8B, 0x49, 0xF2, 0xE2, 0x54, 0x23, 0xFF, 0x66, 0xB3, 0x0F, 0xC6, 0x91, |
| 348 | 0x89, 0x59, 0x99, 0x20, 0xAA, 0x06, 0xEA, 0x8F, 0xB3, 0x3A, 0x8F, 0xB3, 0xB1, 0x0A, 0x04, 0xF7, |
| 349 | 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3E, 0x1B, 0x01, 0x01, 0x1C, 0x39, 0x07, 0x37, 0x08, 0x08, |
| 350 | 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, |
| 351 | 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, |
| 352 | 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE, |
| 353 | 0xDB, 0xE7, 0x2E, 0xC6, 0xC7, 0x2E, 0xFD, 0x01, 0x00, 0x54, 0xD8, 0xED, 0xAB, 0x63, 0xE0, 0x89, |
| 354 | 0x9D, 0x31, 0x0B, 0xD7, 0x2F, 0xF6, 0x4C, 0x4B, 0xCE, 0x2A, 0xB9, 0x65, 0x55, 0x65, 0x15, 0x4F, |
| 355 | 0x1B, 0x59, 0xFF, 0xF7, 0x10, 0xB8, 0xA6, 0x33, 0x88, 0xA6, 0xCF, 0x9B, 0x23, 0x7E, 0x48, 0x83, |
| 356 | 0x60, 0x59, 0xF9, 0xB5, 0x7F, 0x68, 0x2B, 0x1E, 0x2F, 0x35, 0x3B, 0x48, 0x64, 0x15, 0xD8, 0xE1, |
| 357 | 0x27, 0x1F, 0xDE, 0x0A, 0x27, 0xBE, 0x7A, 0xA6, 0xFE, 0x8B, 0x01, 0x7C, 0x94, 0xDC, 0x2D, 0x4B, |
| 358 | 0x2E, 0x78, 0xA0, 0xF4, 0xA2, 0x9B, 0x63, 0x47, 0x5B, 0x8C, 0x57, 0x04, 0xF3, 0x92, 0x3F, 0x4C, |
| 359 | 0x84, 0x70, 0x06, 0x16, 0xD2, 0xF0, 0x49, 0x9E, 0x4E, 0x2E, 0x9A, 0xC5, 0xB0, 0xC8, 0x0F, 0x4C, |
| 360 | 0xB9, 0xD0, 0x37, 0x9F, 0xEB, 0x53, 0x68, 0x1B, 0xC9, 0xBF, 0x77, 0x12, 0xBD, 0x25, 0x23, 0x38, |
| 361 | 0x56, 0x63, 0x22, 0xA4, 0x52, 0xA1, 0x00, 0x47, 0x08, 0xEB, 0xC7, 0x36, 0x33, 0x46, 0xC1, 0x92, |
| 362 | 0x89, 0xE4, 0xC8, 0x52, 0x05, 0xB7, 0x01, 0x2B, 0x24, 0x04, 0x56, 0xC3, 0x8C, 0x1F, 0x18, 0x78, |
| 363 | 0x73, 0x99, 0xFF, 0x7B, 0x0E, 0x92, 0x3D, 0x92, 0x61, 0xF1, 0xDC, 0x55, 0xDB, 0x55, 0x8B, 0xBA, |
| 364 | 0xDB, 0xD9, 0x14, 0x7C, 0x7B, 0x9B, 0xDC, 0x90, 0x15, 0xC6, 0x59, 0x80, 0xE7, 0xFC, 0x03, 0x71, |
| 365 | 0x7E, 0x35, 0x05, 0x30, 0xBE, 0xED, 0xC4, 0xB2, 0x2E, 0x39, 0xDB, 0xAA, 0x2A, 0x7E, 0x50, 0x37, |
| 366 | 0x4D, 0xC8, 0x3F, 0x00, 0xD8, 0xE9, 0xF1, 0x9D, 0x57, 0x43, 0x2B, 0x1C, 0x5F, 0x09, 0x18, 0xA3, |
| 367 | 0xE3, 0x11, 0x85, 0xCC, 0x0E, 0xAF, 0x56, 0x6B, 0xE1, 0xAC, 0xB3, 0x20, 0xF2, 0x47, 0xFE, 0x95, |
| 368 | 0xC8, 0x71, 0x99, 0xCC, 0x52, 0x8A, 0x6F, 0xF1, 0x01, 0xD6, 0xE9, 0x2E, 0x6C, 0x27, 0xC3, 0xED, |
| 369 | 0xE3, 0xF2, 0xDD, 0x78, 0xB4, 0x7F, 0xFA, 0xD0, 0xC2 |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 370 | }}; |
| 371 | const Block badSigInterest{{ |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 372 | 0x05, 0xCC, 0x07, 0x37, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65, |
| 373 | 0x72, 0x65, 0x73, 0x74, 0x08, 0x03, 0x52, 0x73, 0x61, 0x02, 0x20, 0x64, 0xE3, 0x6F, 0xD5, 0x73, |
| 374 | 0x21, 0xBC, 0xAB, 0xDE, 0xDE, 0x0F, 0x99, 0xCB, 0x49, 0x7F, 0x46, 0xE7, 0xF0, 0x7A, 0xF1, 0x2C, |
| 375 | 0xF9, 0x36, 0xE0, 0xBD, 0x3A, 0x8A, 0x1C, 0x08, 0x6A, 0xD1, 0x21, 0x0A, 0x04, 0xF7, 0x2C, 0x8A, |
| 376 | 0x4B, 0x24, 0x00, 0x2C, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, |
| 377 | 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, |
| 378 | 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, |
| 379 | 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, |
| 380 | 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x2E, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xC3, 0x9A, 0xDC, 0x5A, |
| 381 | 0x59, 0x10, 0x4D, 0x29, 0x9A, 0x64, 0x8D, 0x18, 0xBD, 0x27, 0x73, 0xBB, 0x98, 0xAB, 0xE9, 0xF2, |
| 382 | 0x4A, 0xBF, 0xC0, 0x5B, 0xA8, 0x05, 0xA2, 0xC8, 0x61, 0xC4, 0x2E, 0x64, 0x02, 0x20, 0x1F, 0x5E, |
| 383 | 0xF5, 0x8E, 0xC9, 0xDC, 0x9E, 0x15, 0x1C, 0xFA, 0x58, 0x5F, 0xDF, 0xAE, 0xA0, 0xFD, 0xDA, 0x34, |
| 384 | 0x21, 0xE0, 0xA8, 0x2D, 0x32, 0x47, 0x9E, 0x44, 0x83, 0x79, 0x23, 0x5F, 0xBE, 0x16 |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 385 | }}; |
| 386 | const Block goodInterestOldFormat{{ |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 387 | 0x05, 0xFD, 0x01, 0x85, 0x07, 0x37, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, |
| 388 | 0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x08, 0x03, 0x52, 0x73, 0x61, 0x02, 0x20, 0x08, 0x39, 0xEE, |
| 389 | 0x12, 0xF1, 0x10, 0xB7, 0x8B, 0x49, 0xF2, 0xE2, 0x54, 0x23, 0xFF, 0x66, 0xB3, 0x0F, 0xC6, 0x91, |
| 390 | 0x89, 0x59, 0x99, 0x20, 0xAA, 0x06, 0xEA, 0x8F, 0xB3, 0x3A, 0x8F, 0xB3, 0xB1, 0x0A, 0x04, 0xF7, |
| 391 | 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3E, 0x1B, 0x01, 0x01, 0x1C, 0x39, 0x07, 0x37, 0x08, 0x08, |
| 392 | 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, |
| 393 | 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, |
| 394 | 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE, |
| 395 | 0xDB, 0xE7, 0x2E, 0xC6, 0xC7, 0x2E, 0xFD, 0x01, 0x00, 0x54, 0xD8, 0xED, 0xAB, 0x63, 0xE0, 0x89, |
| 396 | 0x9D, 0x31, 0x0B, 0xD7, 0x2F, 0xF6, 0x4C, 0x4B, 0xCE, 0x2A, 0xB9, 0x65, 0x55, 0x65, 0x15, 0x4F, |
| 397 | 0x1B, 0x59, 0xFF, 0xF7, 0x10, 0xB8, 0xA6, 0x33, 0x88, 0xA6, 0xCF, 0x9B, 0x23, 0x7E, 0x48, 0x83, |
| 398 | 0x60, 0x59, 0xF9, 0xB5, 0x7F, 0x68, 0x2B, 0x1E, 0x2F, 0x35, 0x3B, 0x48, 0x64, 0x15, 0xD8, 0xE1, |
| 399 | 0x27, 0x1F, 0xDE, 0x0A, 0x27, 0xBE, 0x7A, 0xA6, 0xFE, 0x8B, 0x01, 0x7C, 0x94, 0xDC, 0x2D, 0x4B, |
| 400 | 0x2E, 0x78, 0xA0, 0xF4, 0xA2, 0x9B, 0x63, 0x47, 0x5B, 0x8C, 0x57, 0x04, 0xF3, 0x92, 0x3F, 0x4C, |
| 401 | 0x84, 0x70, 0x06, 0x16, 0xD2, 0xF0, 0x49, 0x9E, 0x4E, 0x2E, 0x9A, 0xC5, 0xB0, 0xC8, 0x0F, 0x4C, |
| 402 | 0xB9, 0xD0, 0x37, 0x9F, 0xEB, 0x53, 0x68, 0x1B, 0xC9, 0xBF, 0x77, 0x12, 0xBD, 0x25, 0x23, 0x38, |
| 403 | 0x56, 0x63, 0x22, 0xA4, 0x52, 0xA1, 0x00, 0x47, 0x08, 0xEB, 0xC7, 0x36, 0x33, 0x46, 0xC1, 0x92, |
| 404 | 0x89, 0xE4, 0xC8, 0x52, 0x05, 0xB7, 0x01, 0x2B, 0x24, 0x04, 0x56, 0xC3, 0x8C, 0x1F, 0x18, 0x78, |
| 405 | 0x73, 0x99, 0xFF, 0x7B, 0x0E, 0x92, 0x3D, 0x92, 0x61, 0xF1, 0xDC, 0x55, 0xDB, 0x55, 0x8B, 0xBA, |
| 406 | 0xDB, 0xD9, 0x14, 0x7C, 0x7B, 0x9B, 0xDC, 0x90, 0x15, 0xC6, 0x59, 0x80, 0xE7, 0xFC, 0x03, 0x71, |
| 407 | 0x7E, 0x35, 0x05, 0x30, 0xBE, 0xED, 0xC4, 0xB2, 0x2E, 0x39, 0xDB, 0xAA, 0x2A, 0x7E, 0x50, 0x37, |
| 408 | 0x4D, 0xC8, 0x3F, 0x00, 0xD8, 0xE9, 0xF1, 0x9D, 0x57, 0x43, 0x2B, 0x1C, 0x5F, 0x09, 0x18, 0xA3, |
| 409 | 0xE3, 0x11, 0x85, 0xCC, 0x0E, 0xAF, 0x56, 0x6B, 0xE1, 0xAC, 0xB3, 0x20, 0xF2, 0x47, 0xFE, 0x95, |
| 410 | 0xC8, 0x71, 0x99, 0xCC, 0x52, 0x8A, 0x6F, 0xF1, 0x01, 0xD6, 0xE9, 0x2E, 0x6C, 0x27, 0xC3, 0xED, |
| 411 | 0xE3, 0xF2, 0xDD, 0x78, 0xB4, 0x7F, 0xFA, 0xD0, 0xC2 |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 412 | }}; |
| 413 | const Block badSigInterestOldFormat{{ |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 414 | 0x05, 0xFD, 0x02, 0x15, 0x07, 0xC7, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, |
| 415 | 0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x08, 0x03, 0x52, 0x73, 0x61, 0x02, 0x20, 0x08, 0x39, 0xEE, |
| 416 | 0x12, 0xF1, 0x10, 0xB7, 0x8B, 0x49, 0xF2, 0xE2, 0x54, 0x23, 0xFF, 0x66, 0xB3, 0x0F, 0xC6, 0x91, |
| 417 | 0x89, 0x59, 0x99, 0x20, 0xAA, 0x06, 0xEA, 0x8F, 0xB3, 0x3A, 0x8F, 0xB3, 0xB1, 0x08, 0x42, 0x16, |
| 418 | 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 419 | 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 420 | 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, |
| 421 | 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, |
| 422 | 0x43, 0x08, 0x4A, 0x17, 0x48, 0x30, 0x46, 0x02, 0x21, 0x00, 0x9D, 0x24, 0x46, 0x3D, 0x37, 0xAE, |
| 423 | 0x81, 0xB7, 0x7C, 0x2C, 0x86, 0x8A, 0x34, 0xEF, 0xC8, 0xC8, 0xB0, 0x18, 0x78, 0x3E, 0xA3, 0xE5, |
| 424 | 0xED, 0x31, 0x93, 0x26, 0x73, 0x0E, 0x58, 0xE8, 0xF8, 0x47, 0x02, 0x21, 0x00, 0xFD, 0x82, 0xD2, |
| 425 | 0x69, 0xEF, 0xB0, 0x72, 0xE8, 0xCA, 0x33, 0x43, 0xEB, 0x27, 0xB1, 0xDD, 0xB6, 0xD1, 0x97, 0x14, |
| 426 | 0x43, 0xC5, 0xA9, 0xFC, 0x87, 0x59, 0xAF, 0x87, 0xF3, 0x02, 0x2C, 0x59, 0x2E, 0x0A, 0x04, 0xF7, |
| 427 | 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x3E, 0x1B, 0x01, 0x01, 0x1C, 0x39, 0x07, 0x37, 0x08, 0x08, |
| 428 | 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, |
| 429 | 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, |
| 430 | 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0x0C, 0x1E, 0xDE, |
| 431 | 0xDB, 0xE7, 0x2E, 0xC6, 0xC7, 0x2E, 0xFD, 0x01, 0x00, 0x54, 0xD8, 0xED, 0xAB, 0x63, 0xE0, 0x89, |
| 432 | 0x9D, 0x31, 0x0B, 0xD7, 0x2F, 0xF6, 0x4C, 0x4B, 0xCE, 0x2A, 0xB9, 0x65, 0x55, 0x65, 0x15, 0x4F, |
| 433 | 0x1B, 0x59, 0xFF, 0xF7, 0x10, 0xB8, 0xA6, 0x33, 0x88, 0xA6, 0xCF, 0x9B, 0x23, 0x7E, 0x48, 0x83, |
| 434 | 0x60, 0x59, 0xF9, 0xB5, 0x7F, 0x68, 0x2B, 0x1E, 0x2F, 0x35, 0x3B, 0x48, 0x64, 0x15, 0xD8, 0xE1, |
| 435 | 0x27, 0x1F, 0xDE, 0x0A, 0x27, 0xBE, 0x7A, 0xA6, 0xFE, 0x8B, 0x01, 0x7C, 0x94, 0xDC, 0x2D, 0x4B, |
| 436 | 0x2E, 0x78, 0xA0, 0xF4, 0xA2, 0x9B, 0x63, 0x47, 0x5B, 0x8C, 0x57, 0x04, 0xF3, 0x92, 0x3F, 0x4C, |
| 437 | 0x84, 0x70, 0x06, 0x16, 0xD2, 0xF0, 0x49, 0x9E, 0x4E, 0x2E, 0x9A, 0xC5, 0xB0, 0xC8, 0x0F, 0x4C, |
| 438 | 0xB9, 0xD0, 0x37, 0x9F, 0xEB, 0x53, 0x68, 0x1B, 0xC9, 0xBF, 0x77, 0x12, 0xBD, 0x25, 0x23, 0x38, |
| 439 | 0x56, 0x63, 0x22, 0xA4, 0x52, 0xA1, 0x00, 0x47, 0x08, 0xEB, 0xC7, 0x36, 0x33, 0x46, 0xC1, 0x92, |
| 440 | 0x89, 0xE4, 0xC8, 0x52, 0x05, 0xB7, 0x01, 0x2B, 0x24, 0x04, 0x56, 0xC3, 0x8C, 0x1F, 0x18, 0x78, |
| 441 | 0x73, 0x99, 0xFF, 0x7B, 0x0E, 0x92, 0x3D, 0x92, 0x61, 0xF1, 0xDC, 0x55, 0xDB, 0x55, 0x8B, 0xBA, |
| 442 | 0xDB, 0xD9, 0x14, 0x7C, 0x7B, 0x9B, 0xDC, 0x90, 0x15, 0xC6, 0x59, 0x80, 0xE7, 0xFC, 0x03, 0x71, |
| 443 | 0x7E, 0x35, 0x05, 0x30, 0xBE, 0xED, 0xC4, 0xB2, 0x2E, 0x39, 0xDB, 0xAA, 0x2A, 0x7E, 0x50, 0x37, |
| 444 | 0x4D, 0xC8, 0x3F, 0x00, 0xD8, 0xE9, 0xF1, 0x9D, 0x57, 0x43, 0x2B, 0x1C, 0x5F, 0x09, 0x18, 0xA3, |
| 445 | 0xE3, 0x11, 0x85, 0xCC, 0x0E, 0xAF, 0x56, 0x6B, 0xE1, 0xAC, 0xB3, 0x20, 0xF2, 0x47, 0xFE, 0x95, |
| 446 | 0xC8, 0x71, 0x99, 0xCC, 0x52, 0x8A, 0x6F, 0xF1, 0x01, 0xD6, 0xE9, 0x2E, 0x6C, 0x27, 0xC3, 0xED, |
| 447 | 0xE3, 0xF2, 0xDD, 0x78, 0xB4, 0x7F, 0xFA, 0xD0, 0xC2 |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 448 | }}; |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 449 | }; |
| 450 | |
| 451 | struct Sha256Dataset |
| 452 | { |
| 453 | const std::string name = "Sha256"; |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 454 | const Block cert{{ |
| 455 | }}; |
| 456 | const Block goodData{{ |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 457 | 0x06, 0x41, 0x07, 0x14, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61, |
| 458 | 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x14, 0x00, 0x15, 0x00, 0x16, 0x03, 0x1B, 0x01, |
| 459 | 0x00, 0x17, 0x20, 0xE2, 0xE2, 0x2F, 0x02, 0x70, 0xA7, 0xF7, 0x48, 0x70, 0x45, 0x29, 0x46, 0xBD, |
| 460 | 0xD2, 0x62, 0x24, 0xA6, 0x1E, 0x1D, 0x75, 0x2A, 0x26, 0x98, 0x04, 0xAD, 0x9C, 0x47, 0x63, 0xF8, |
| 461 | 0x98, 0x5A, 0x49 |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 462 | }}; |
| 463 | const Block badSigData{{ |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 464 | 0x06, 0xA6, 0x07, 0x14, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61, |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 465 | 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x14, 0x00, 0x15, 0x00, 0x16, 0x40, 0x1B, 0x01, |
| 466 | 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, |
| 467 | 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, |
| 468 | 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 469 | 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x17, 0x48, |
| 470 | 0x30, 0x46, 0x02, 0x21, 0x00, 0xF0, 0x72, 0x9A, 0x68, 0x36, 0xC5, 0xAA, 0x9D, 0x75, 0x03, 0x36, |
| 471 | 0xDA, 0xAA, 0x80, 0x0C, 0x29, 0xEE, 0xC9, 0x48, 0x95, 0xA2, 0xEC, 0xAB, 0x78, 0x28, 0x3B, 0x9D, |
| 472 | 0x28, 0x19, 0x6C, 0x5C, 0xD6, 0x02, 0x21, 0x00, 0xF0, 0xD2, 0x23, 0xEA, 0xD9, 0x43, 0x6D, 0x8A, |
| 473 | 0xD2, 0x02, 0x3F, 0xF1, 0x41, 0x12, 0xA6, 0xED, 0x87, 0xB3, 0xD5, 0x5A, 0x27, 0x5D, 0x4E, 0xEB, |
| 474 | 0x13, 0x29, 0x01, 0xBC, 0x3C, 0xCC, 0x50, 0x61 |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 475 | }}; |
| 476 | const Block goodInterest{{ |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 477 | 0x05, 0x6B, 0x07, 0x3A, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65, |
| 478 | 0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x8F, 0x03, |
| 479 | 0x0B, 0x85, 0xA7, 0x05, 0xD8, 0x05, 0x31, 0x8E, 0x80, 0x81, 0xD3, 0xE2, 0xA8, 0x5E, 0x74, 0xD7, |
| 480 | 0x4F, 0x3A, 0xDC, 0xFF, 0x9C, 0x44, 0xF6, 0xA1, 0xC6, 0x6B, 0x97, 0x99, 0x8E, 0xDA, 0x0A, 0x04, |
| 481 | 0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x03, 0x1B, 0x01, 0x00, 0x2E, 0x20, 0xEF, 0x45, 0x55, |
| 482 | 0x75, 0xC8, 0x18, 0x5E, 0xE9, 0x2A, 0xAE, 0x52, 0x61, 0x0A, 0x94, 0x41, 0x03, 0x36, 0x4C, 0x13, |
| 483 | 0x59, 0xD4, 0xC7, 0xA4, 0x3A, 0xA0, 0x40, 0x61, 0x44, 0x33, 0x93, 0x5E, 0x99 |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 484 | }}; |
| 485 | const Block badSigInterest{{ |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 486 | 0x05, 0xCE, 0x07, 0x3A, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65, |
| 487 | 0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x32, 0x3F, |
| 488 | 0x2F, 0xA3, 0xDC, 0x15, 0x7E, 0x8C, 0xA9, 0x75, 0xF7, 0x66, 0xFF, 0xFD, 0x13, 0x42, 0x1B, 0xE1, |
| 489 | 0x3A, 0x27, 0xDD, 0xE4, 0x98, 0x42, 0x77, 0xFA, 0xAD, 0x8F, 0x3E, 0x91, 0x75, 0xF9, 0x0A, 0x04, |
| 490 | 0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, |
| 491 | 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, |
| 492 | 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, |
| 493 | 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, |
| 494 | 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, 0x6E, 0x43, 0x2E, 0x46, 0x30, 0x44, 0x02, 0x20, 0x0C, 0xA0, |
| 495 | 0x6F, 0x90, 0xEF, 0x5E, 0x04, 0x15, 0xAF, 0x94, 0x8E, 0x33, 0x12, 0x1F, 0xF9, 0x50, 0xDD, 0x49, |
| 496 | 0x73, 0xB3, 0xA6, 0xD2, 0x99, 0x32, 0x26, 0xE2, 0x46, 0x3A, 0xE0, 0x69, 0xDF, 0xB2, 0x02, 0x20, |
| 497 | 0x6A, 0x03, 0xCE, 0xB6, 0x85, 0x1E, 0x01, 0x5E, 0xF8, 0x48, 0xDE, 0x65, 0xB9, 0xE1, 0xEB, 0x9A, |
| 498 | 0xF8, 0x47, 0x43, 0x5B, 0xBA, 0x63, 0xCB, 0xBA, 0xFB, 0x62, 0x1C, 0x38, 0xE8, 0x53, 0xF7, 0x29 |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 499 | }}; |
| 500 | const Block goodInterestOldFormat{{ |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 501 | 0x05, 0x6B, 0x07, 0x3A, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65, |
| 502 | 0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x8F, 0x03, |
| 503 | 0x0B, 0x85, 0xA7, 0x05, 0xD8, 0x05, 0x31, 0x8E, 0x80, 0x81, 0xD3, 0xE2, 0xA8, 0x5E, 0x74, 0xD7, |
| 504 | 0x4F, 0x3A, 0xDC, 0xFF, 0x9C, 0x44, 0xF6, 0xA1, 0xC6, 0x6B, 0x97, 0x99, 0x8E, 0xDA, 0x0A, 0x04, |
| 505 | 0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x03, 0x1B, 0x01, 0x00, 0x2E, 0x20, 0xEF, 0x45, 0x55, |
| 506 | 0x75, 0xC8, 0x18, 0x5E, 0xE9, 0x2A, 0xAE, 0x52, 0x61, 0x0A, 0x94, 0x41, 0x03, 0x36, 0x4C, 0x13, |
| 507 | 0x59, 0xD4, 0xC7, 0xA4, 0x3A, 0xA0, 0x40, 0x61, 0x44, 0x33, 0x93, 0x5E, 0x99 |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 508 | }}; |
| 509 | const Block badSigInterestOldFormat{{ |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 510 | 0x05, 0xFA, 0x07, 0xC9, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65, |
| 511 | 0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x8F, 0x03, |
| 512 | 0x0B, 0x85, 0xA7, 0x05, 0xD8, 0x05, 0x31, 0x8E, 0x80, 0x81, 0xD3, 0xE2, 0xA8, 0x5E, 0x74, 0xD7, |
| 513 | 0x4F, 0x3A, 0xDC, 0xFF, 0x9C, 0x44, 0xF6, 0xA1, 0xC6, 0x6B, 0x97, 0x99, 0x8E, 0xDA, 0x08, 0x42, |
| 514 | 0x16, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, |
| 515 | 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, |
| 516 | 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x05, 0x57, 0x72, |
| 517 | 0x6F, 0x6E, 0x67, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x08, 0xF3, 0xD0, 0x1A, 0x45, 0x87, 0x5D, |
| 518 | 0x6E, 0x43, 0x08, 0x49, 0x17, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xB3, 0x30, 0x0A, 0x93, 0x16, |
| 519 | 0x16, 0xBB, 0xD0, 0x3C, 0x73, 0x01, 0xED, 0x0D, 0x40, 0xEE, 0x28, 0x69, 0xA6, 0xAA, 0xF0, 0x34, |
| 520 | 0x44, 0xBD, 0x7E, 0x1F, 0xBF, 0x6D, 0x7C, 0x52, 0xA1, 0x85, 0x1D, 0x02, 0x20, 0x3F, 0x18, 0x66, |
| 521 | 0x48, 0xC9, 0x0F, 0x5B, 0x18, 0xB0, 0xD0, 0x45, 0xDE, 0x93, 0xA6, 0x21, 0xA0, 0xDC, 0x7E, 0x47, |
| 522 | 0x3A, 0x61, 0x56, 0xD2, 0xAE, 0x70, 0x8D, 0xE8, 0xD5, 0xB7, 0xD0, 0x12, 0x35, 0x0A, 0x04, 0xF7, |
| 523 | 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x03, 0x1B, 0x01, 0x00, 0x2E, 0x20, 0xEF, 0x45, 0x55, 0x75, |
| 524 | 0xC8, 0x18, 0x5E, 0xE9, 0x2A, 0xAE, 0x52, 0x61, 0x0A, 0x94, 0x41, 0x03, 0x36, 0x4C, 0x13, 0x59, |
| 525 | 0xD4, 0xC7, 0xA4, 0x3A, 0xA0, 0x40, 0x61, 0x44, 0x33, 0x93, 0x5E, 0x99 |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 526 | }}; |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 527 | }; |
| 528 | |
| 529 | // Note about the datasets: |
| 530 | // - .cert a valid certificate |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 531 | // - .goodData is a Data packet that can be verified against .cert |
| 532 | // - .badSigData a valid and signed Data packet that cannot be verified against cert (signed using |
| 533 | // a different private key) |
| 534 | // - .goodInterest is an Interest packet that can be verified against .cert |
| 535 | // - .badSigInterest is a valid and signed Interest packet that cannot be verified against .cert |
| 536 | // (signed using a different private key) |
| 537 | // - .goodInterestOldFormat is an Interest packet that can be verified against .cert (in the old |
| 538 | // signed Interest format) |
| 539 | // - .badSigInterestOldFormat is a valid and signed Interest packet that cannot be verified against |
| 540 | // .cert (signed using a different private key and in the old signed Interest format) |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 541 | |
Davide Pesavento | 77d9e81 | 2019-06-03 22:05:54 -0400 | [diff] [blame] | 542 | using SignatureDatasets = boost::mpl::vector<EcdsaDataset, RsaDataset>; |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 543 | |
| 544 | BOOST_AUTO_TEST_CASE_TEMPLATE(VerifySignature, Dataset, SignatureDatasets) |
| 545 | { |
Davide Pesavento | 809f754 | 2021-03-24 18:53:05 -0400 | [diff] [blame] | 546 | const Dataset dataset; |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 547 | Certificate cert(dataset.cert); |
| 548 | auto keyRaw = cert.getPublicKey(); |
Davide Pesavento | 77d9e81 | 2019-06-03 22:05:54 -0400 | [diff] [blame] | 549 | transform::PublicKey key; |
Davide Pesavento | 765abc9 | 2021-12-27 00:44:04 -0500 | [diff] [blame] | 550 | key.loadPkcs8(keyRaw); |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 551 | |
| 552 | Data data(dataset.goodData); |
| 553 | Data badSigData(dataset.badSigData); |
| 554 | Interest interest(dataset.goodInterest); |
| 555 | Interest badSigInterest(dataset.badSigInterest); |
| 556 | Interest interestOldFormat(dataset.goodInterestOldFormat); |
| 557 | Interest badSigInterestOldFormat(dataset.badSigInterestOldFormat); |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 558 | |
| 559 | BOOST_CHECK(verifySignature(data, key)); |
Davide Pesavento | 35c6379 | 2022-01-17 02:06:03 -0500 | [diff] [blame] | 560 | BOOST_CHECK(verifySignature(data, keyRaw)); |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 561 | BOOST_CHECK(verifySignature(data, cert)); |
| 562 | BOOST_CHECK(verifySignature(interest, key)); |
Davide Pesavento | 35c6379 | 2022-01-17 02:06:03 -0500 | [diff] [blame] | 563 | BOOST_CHECK(verifySignature(interest, keyRaw)); |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 564 | BOOST_CHECK(verifySignature(interest, cert)); |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 565 | BOOST_CHECK(verifySignature(interestOldFormat, key)); |
Davide Pesavento | 35c6379 | 2022-01-17 02:06:03 -0500 | [diff] [blame] | 566 | BOOST_CHECK(verifySignature(interestOldFormat, keyRaw)); |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 567 | BOOST_CHECK(verifySignature(interestOldFormat, cert)); |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 568 | |
| 569 | BOOST_CHECK(!verifySignature(badSigData, key)); |
Davide Pesavento | 35c6379 | 2022-01-17 02:06:03 -0500 | [diff] [blame] | 570 | BOOST_CHECK(!verifySignature(badSigData, keyRaw)); |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 571 | BOOST_CHECK(!verifySignature(badSigData, cert)); |
| 572 | BOOST_CHECK(!verifySignature(badSigInterest, key)); |
Davide Pesavento | 35c6379 | 2022-01-17 02:06:03 -0500 | [diff] [blame] | 573 | BOOST_CHECK(!verifySignature(badSigInterest, keyRaw)); |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 574 | BOOST_CHECK(!verifySignature(badSigInterest, cert)); |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 575 | BOOST_CHECK(!verifySignature(badSigInterestOldFormat, key)); |
Davide Pesavento | 35c6379 | 2022-01-17 02:06:03 -0500 | [diff] [blame] | 576 | BOOST_CHECK(!verifySignature(badSigInterestOldFormat, keyRaw)); |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 577 | BOOST_CHECK(!verifySignature(badSigInterestOldFormat, cert)); |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 578 | |
| 579 | Data unsignedData("/some/data"); |
| 580 | Interest unsignedInterest1("/some/interest/with/several/name/components"); |
| 581 | Interest unsignedInterest2("/interest-with-one-name-component"); |
| 582 | |
| 583 | BOOST_CHECK(!verifySignature(unsignedData, cert)); |
| 584 | BOOST_CHECK(!verifySignature(unsignedData, key)); |
| 585 | BOOST_CHECK(!verifySignature(unsignedInterest1, cert)); |
| 586 | BOOST_CHECK(!verifySignature(unsignedInterest1, key)); |
| 587 | BOOST_CHECK(!verifySignature(unsignedInterest2, cert)); |
| 588 | BOOST_CHECK(!verifySignature(unsignedInterest2, key)); |
| 589 | |
Davide Pesavento | 35c6379 | 2022-01-17 02:06:03 -0500 | [diff] [blame] | 590 | const uint8_t invalidKey[] = {0x00, 0x00}; |
| 591 | BOOST_CHECK(!verifySignature(unsignedData, invalidKey)); |
| 592 | BOOST_CHECK(!verifySignature(unsignedInterest1, invalidKey)); |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 593 | |
| 594 | // - base version of verifySignature is tested transitively |
Alexander Afanasyev | 09236c2 | 2020-06-03 13:42:38 -0400 | [diff] [blame] | 595 | // - pib::Key version is tested as part of key-chain.t.cpp (Security/TestKeyChain) |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 596 | } |
| 597 | |
Davide Pesavento | 94dfcf1 | 2021-09-26 14:18:45 -0400 | [diff] [blame] | 598 | #if OPENSSL_VERSION_NUMBER < 0x30000000L // FIXME #5154 |
Davide Pesavento | 4c1ad4c | 2020-11-16 21:12:02 -0500 | [diff] [blame] | 599 | BOOST_FIXTURE_TEST_CASE(VerifyHmac, KeyChainFixture) |
laqinfan | bc997e5 | 2019-06-25 22:11:09 -0500 | [diff] [blame] | 600 | { |
| 601 | const Tpm& tpm = m_keyChain.getTpm(); |
| 602 | Data data("/data"); |
| 603 | Interest interest("/interest"); |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 604 | Interest interestOldFormat("/interest"); |
laqinfan | bc997e5 | 2019-06-25 22:11:09 -0500 | [diff] [blame] | 605 | SigningInfo signingInfo; |
| 606 | signingInfo.setSigningHmacKey("QjM3NEEyNkE3MTQ5MDQzN0FBMDI0RTRGQURENUI0OTdGREZGMUE4RUE2RkYxMkY2" |
| 607 | "RkI2NUFGMjcyMEI1OUNDRg=="); |
| 608 | signingInfo.setDigestAlgorithm(DigestAlgorithm::SHA256); |
| 609 | |
| 610 | BOOST_CHECK(!verifySignature(data, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256)); |
| 611 | BOOST_CHECK(!verifySignature(interest, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256)); |
| 612 | |
| 613 | m_keyChain.sign(data, signingInfo); |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 614 | signingInfo.setSignedInterestFormat(SignedInterestFormat::V03); |
laqinfan | bc997e5 | 2019-06-25 22:11:09 -0500 | [diff] [blame] | 615 | m_keyChain.sign(interest, signingInfo); |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 616 | signingInfo.setSignedInterestFormat(SignedInterestFormat::V02); |
| 617 | m_keyChain.sign(interestOldFormat, signingInfo); |
laqinfan | bc997e5 | 2019-06-25 22:11:09 -0500 | [diff] [blame] | 618 | BOOST_CHECK(verifySignature(data, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256)); |
| 619 | BOOST_CHECK(verifySignature(interest, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256)); |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 620 | BOOST_CHECK(verifySignature(interestOldFormat, tpm, signingInfo.getSignerName(), DigestAlgorithm::SHA256)); |
laqinfan | bc997e5 | 2019-06-25 22:11:09 -0500 | [diff] [blame] | 621 | } |
Davide Pesavento | 94dfcf1 | 2021-09-26 14:18:45 -0400 | [diff] [blame] | 622 | #endif |
laqinfan | bc997e5 | 2019-06-25 22:11:09 -0500 | [diff] [blame] | 623 | |
Davide Pesavento | 77d9e81 | 2019-06-03 22:05:54 -0400 | [diff] [blame] | 624 | using DigestDatasets = boost::mpl::vector<Sha256Dataset>; |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 625 | |
| 626 | BOOST_AUTO_TEST_CASE_TEMPLATE(VerifyDigest, Dataset, DigestDatasets) |
| 627 | { |
Davide Pesavento | 809f754 | 2021-03-24 18:53:05 -0400 | [diff] [blame] | 628 | const Dataset dataset; |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 629 | Data data(dataset.goodData); |
| 630 | Data badSigData(dataset.badSigData); |
| 631 | Interest interest(dataset.goodInterest); |
| 632 | Interest badSigInterest(dataset.badSigInterest); |
| 633 | Interest interestOldFormat(dataset.goodInterestOldFormat); |
| 634 | Interest badSigInterestOldFormat(dataset.badSigInterestOldFormat); |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 635 | |
Justin Labry | aef53b6 | 2021-03-10 06:07:27 +0000 | [diff] [blame] | 636 | BOOST_CHECK(verifySignature(data, nullopt)); |
Justin Labry | aef53b6 | 2021-03-10 06:07:27 +0000 | [diff] [blame] | 637 | BOOST_CHECK(verifySignature(interest, nullopt)); |
Justin Labry | aef53b6 | 2021-03-10 06:07:27 +0000 | [diff] [blame] | 638 | BOOST_CHECK(verifySignature(interestOldFormat, nullopt)); |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 639 | |
Justin Labry | aef53b6 | 2021-03-10 06:07:27 +0000 | [diff] [blame] | 640 | BOOST_CHECK(!verifySignature(badSigData, nullopt)); |
| 641 | BOOST_CHECK(!verifySignature(badSigInterest, nullopt)); |
| 642 | BOOST_CHECK(!verifySignature(badSigInterestOldFormat, nullopt)); |
| 643 | |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 644 | Data unsignedData("/some/data"); |
| 645 | Interest unsignedInterest1("/some/interest/with/several/name/components"); |
| 646 | Interest unsignedInterest2("/interest-with-one-name-component"); |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 647 | |
Justin Labry | aef53b6 | 2021-03-10 06:07:27 +0000 | [diff] [blame] | 648 | BOOST_CHECK(!verifySignature(unsignedData, nullopt)); |
| 649 | BOOST_CHECK(!verifySignature(unsignedInterest1, nullopt)); |
| 650 | BOOST_CHECK(!verifySignature(unsignedInterest2, nullopt)); |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 651 | } |
| 652 | |
Eric Newberry | e36aae1 | 2020-08-31 22:23:13 -0700 | [diff] [blame] | 653 | const uint8_t sha256DataUnrecognizedElements[] = { |
| 654 | 0x06, 0x47, 0x07, 0x14, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61, |
| 655 | 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x14, 0x00, 0x15, 0x00, 0x16, 0x03, 0x1B, 0x01, |
| 656 | 0x00, 0x17, 0x20, 0xE2, 0xE2, 0x2F, 0x02, 0x70, 0xA7, 0xF7, 0x48, 0x70, 0x45, 0x29, 0x46, 0xBD, |
| 657 | 0xD2, 0x62, 0x24, 0xA6, 0x1E, 0x1D, 0x75, 0x2A, 0x26, 0x98, 0x04, 0xAD, 0x9C, 0x47, 0x63, 0xF8, |
| 658 | 0x98, 0x5A, 0x49, 0xAA, 0x04, 0x01, 0x02, 0x03, 0x04 |
| 659 | }; |
| 660 | |
| 661 | const uint8_t sha256InterestUnrecognizedElements[] = { |
| 662 | 0x05, 0x71, 0x07, 0x3A, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65, |
| 663 | 0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x9A, 0x55, |
| 664 | 0xC0, 0xB5, 0x36, 0xC6, 0x6C, 0x0E, 0x11, 0x41, 0xAF, 0xA5, 0x7F, 0x0B, 0x45, 0x53, 0x3D, 0xEE, |
| 665 | 0x40, 0x1B, 0x9B, 0xAF, 0xEA, 0xBF, 0x3D, 0x56, 0x89, 0x12, 0xE0, 0x18, 0x98, 0x26, 0x0A, 0x04, |
| 666 | 0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x03, 0x1B, 0x01, 0x00, 0x2E, 0x20, 0xEF, 0x45, 0x55, |
| 667 | 0x75, 0xC8, 0x18, 0x5E, 0xE9, 0x2A, 0xAE, 0x52, 0x61, 0x0A, 0x94, 0x41, 0x03, 0x36, 0x4C, 0x13, |
| 668 | 0x59, 0xD4, 0xC7, 0xA4, 0x3A, 0xA0, 0x40, 0x61, 0x44, 0x33, 0x93, 0x5E, 0x99, 0xAA, 0x04, 0x01, |
| 669 | 0x02, 0x03, 0x04 |
| 670 | }; |
| 671 | |
| 672 | BOOST_AUTO_TEST_CASE(VerifyWithUnrecognizedElements) // Bug #4583 |
| 673 | { |
Davide Pesavento | fbea4fc | 2022-02-08 07:26:04 -0500 | [diff] [blame] | 674 | Data data(Block{sha256DataUnrecognizedElements}); |
| 675 | Interest interest(Block{sha256InterestUnrecognizedElements}); |
Eric Newberry | e36aae1 | 2020-08-31 22:23:13 -0700 | [diff] [blame] | 676 | |
Davide Pesavento | 809f754 | 2021-03-24 18:53:05 -0400 | [diff] [blame] | 677 | BOOST_CHECK(verifySignature(data, nullopt)); |
| 678 | BOOST_CHECK(verifySignature(interest, nullopt)); |
Eric Newberry | e36aae1 | 2020-08-31 22:23:13 -0700 | [diff] [blame] | 679 | } |
| 680 | |
Alexander Afanasyev | 574aa86 | 2017-01-10 19:53:28 -0800 | [diff] [blame] | 681 | BOOST_AUTO_TEST_SUITE_END() // TestVerificationHelpers |
| 682 | BOOST_AUTO_TEST_SUITE_END() // Security |
| 683 | |
| 684 | } // namespace tests |
| 685 | } // namespace security |
| 686 | } // namespace ndn |