encoding: convert to span
Change-Id: I8bd73284fbd5acc0ff8ad2626af9b4324e9df7a1
diff --git a/tests/unit/security/verification-helpers.t.cpp b/tests/unit/security/verification-helpers.t.cpp
index 479a655..5e313ec 100644
--- a/tests/unit/security/verification-helpers.t.cpp
+++ b/tests/unit/security/verification-helpers.t.cpp
@@ -49,7 +49,7 @@
// };
// auto print = [] (const std::string& name, const uint8_t* buf, size_t size) {
-// std::cout << " std::vector<uint8_t> " + name + " = {\n ";
+// std::cout << " const Block " + name + "{{\n ";
// std::string hex = toHex(buf, size);
@@ -63,7 +63,7 @@
// if ((i + 1) != hex.size())
// std::cout << ", ";
// }
-// std::cout << "\n };";
+// std::cout << "\n }};";
// };
// for (const auto& i : identities) {
@@ -130,7 +130,7 @@
struct EcdsaDataset
{
const std::string name = "Ecdsa";
- std::vector<uint8_t> cert = {
+ const Block cert{{
0x06, 0xFD, 0x01, 0x62, 0x07, 0x47, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79,
0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x02, 0x45, 0x43, 0x08, 0x03, 0x4B,
@@ -154,8 +154,8 @@
0x6B, 0x24, 0xF5, 0x7F, 0x02, 0x20, 0x1C, 0x88, 0xDE, 0x32, 0x3F, 0x1A, 0xE6, 0x60, 0xA2, 0x29,
0x94, 0xD9, 0x05, 0x8F, 0x57, 0x14, 0xD6, 0x17, 0x3C, 0x78, 0xBF, 0x85, 0xF5, 0x1D, 0xCC, 0x03,
0x35, 0x9E, 0xC9, 0xA9, 0x6B, 0x09
- };
- std::vector<uint8_t> goodData = {
+ }};
+ const Block goodData{{
0x06, 0xA2, 0x07, 0x13, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x14, 0x00, 0x15, 0x00, 0x16, 0x3D, 0x1B, 0x01, 0x03,
0x1C, 0x38, 0x07, 0x36, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17,
@@ -167,8 +167,8 @@
0xC3, 0x02, 0x21, 0x00, 0xB5, 0xA3, 0x87, 0xD8, 0x9B, 0xB6, 0x92, 0xAD, 0x19, 0x84, 0xAE, 0x4D,
0xF5, 0x64, 0xEC, 0x1C, 0xF2, 0xA0, 0xB7, 0x4D, 0x6B, 0x74, 0xFF, 0x39, 0x38, 0xFD, 0x5D, 0x9D,
0x46, 0xE0, 0xD2, 0xB4
- };
- std::vector<uint8_t> badSigData = {
+ }};
+ const Block badSigData{{
0x06, 0xA5, 0x07, 0x13, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x14, 0x00, 0x15, 0x00, 0x16, 0x40, 0x1B, 0x01, 0x03,
0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17,
@@ -180,8 +180,8 @@
0x13, 0xB4, 0xB8, 0x95, 0x02, 0x21, 0x00, 0xDA, 0x54, 0x99, 0xF8, 0xE5, 0xC1, 0x74, 0xAC, 0xE0,
0xF2, 0xDF, 0x0D, 0xC5, 0xE1, 0xCF, 0x99, 0x28, 0x6C, 0xB0, 0x2D, 0x55, 0xC8, 0x74, 0x63, 0x56,
0x2A, 0x1A, 0xB0, 0x00, 0xBD, 0xFF, 0xC5
- };
- std::vector<uint8_t> goodInterest = {
+ }};
+ const Block goodInterest{{
0x05, 0xCA, 0x07, 0x39, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
0x72, 0x65, 0x73, 0x74, 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x02, 0x20, 0x8F, 0x41, 0x49,
0x40, 0xDA, 0x38, 0xC1, 0x0E, 0x75, 0x5A, 0x6D, 0x4A, 0xD4, 0xFC, 0xE2, 0xDF, 0xBA, 0x52, 0xAF,
@@ -195,8 +195,8 @@
0xDB, 0xEA, 0x3A, 0x71, 0x83, 0x0D, 0xC4, 0x26, 0xB7, 0x24, 0x02, 0x20, 0x0F, 0x14, 0x10, 0xDB,
0xDB, 0x24, 0xCB, 0xB3, 0xD2, 0x4B, 0x45, 0x6D, 0xA0, 0xBB, 0x4B, 0x87, 0xC1, 0x59, 0x9F, 0xC8,
0xBE, 0x75, 0xF5, 0xCC, 0xCB, 0xD2, 0x4F, 0xD8, 0x87, 0x26, 0x51, 0xBF
- };
- std::vector<uint8_t> badSigInterest = {
+ }};
+ const Block badSigInterest{{
0x05, 0xCF, 0x07, 0x39, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
0x72, 0x65, 0x73, 0x74, 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x02, 0x20, 0x53, 0x14, 0x5E,
0xA3, 0x31, 0x41, 0xD8, 0xA1, 0x10, 0x06, 0x3C, 0x8E, 0xF3, 0x51, 0xA0, 0xC2, 0x8A, 0xBC, 0xFC,
@@ -211,8 +211,8 @@
0x00, 0xC7, 0x23, 0x25, 0xF7, 0xFA, 0x6A, 0x2D, 0x3D, 0xF4, 0xD8, 0xDB, 0xE9, 0x76, 0x6A, 0x63,
0xD4, 0x11, 0x17, 0x4A, 0xDB, 0x7F, 0x85, 0x52, 0x97, 0xFC, 0x5B, 0x0B, 0x1B, 0xBA, 0xE5, 0xED,
0x9A
- };
- std::vector<uint8_t> goodInterestOldFormat = {
+ }};
+ const Block goodInterestOldFormat{{
0x05, 0xCB, 0x07, 0x39, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
0x72, 0x65, 0x73, 0x74, 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x02, 0x20, 0xDB, 0x6D, 0x5E,
0xA7, 0xBF, 0xAF, 0xEC, 0xA0, 0xC6, 0x20, 0x4E, 0xF2, 0x04, 0xF8, 0xFF, 0x39, 0x2A, 0x5F, 0xE6,
@@ -226,8 +226,8 @@
0x60, 0x63, 0x51, 0xB3, 0x52, 0xBC, 0x6D, 0x24, 0x0C, 0x6D, 0x38, 0x02, 0x20, 0x0E, 0x21, 0xF1,
0x51, 0x39, 0x2D, 0x4A, 0x45, 0x05, 0x45, 0xFA, 0x85, 0xA7, 0xCC, 0x00, 0xFE, 0x89, 0x8A, 0xD6,
0xD7, 0x34, 0x0D, 0x31, 0x6A, 0x94, 0xAE, 0x1F, 0xD8, 0x07, 0xF1, 0xDF, 0x80
- };
- std::vector<uint8_t> badSigInterestOldFormat = {
+ }};
+ const Block badSigInterestOldFormat{{
0x05, 0xFD, 0x01, 0x5B, 0x07, 0xC9, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E,
0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x08, 0x05, 0x45, 0x63, 0x64, 0x73, 0x61, 0x02, 0x20, 0xDB,
0x6D, 0x5E, 0xA7, 0xBF, 0xAF, 0xEC, 0xA0, 0xC6, 0x20, 0x4E, 0xF2, 0x04, 0xF8, 0xFF, 0x39, 0x2A,
@@ -250,13 +250,13 @@
0x64, 0xAA, 0x60, 0x63, 0x51, 0xB3, 0x52, 0xBC, 0x6D, 0x24, 0x0C, 0x6D, 0x38, 0x02, 0x20, 0x0E,
0x21, 0xF1, 0x51, 0x39, 0x2D, 0x4A, 0x45, 0x05, 0x45, 0xFA, 0x85, 0xA7, 0xCC, 0x00, 0xFE, 0x89,
0x8A, 0xD6, 0xD7, 0x34, 0x0D, 0x31, 0x6A, 0x94, 0xAE, 0x1F, 0xD8, 0x07, 0xF1, 0xDF, 0x80
- };
+ }};
};
struct RsaDataset
{
const std::string name = "Rsa";
- std::vector<uint8_t> cert = {
+ const Block cert{{
0x06, 0xFD, 0x02, 0xED, 0x07, 0x48, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79,
0x08, 0x17, 0x54, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
0x6F, 0x6E, 0x48, 0x65, 0x6C, 0x70, 0x65, 0x72, 0x73, 0x08, 0x03, 0x52, 0x53, 0x41, 0x08, 0x03,
@@ -305,8 +305,8 @@
0x3E, 0xFA, 0xE6, 0xB9, 0x8E, 0x08, 0x82, 0x50, 0xCA, 0xEE, 0x7F, 0x5D, 0x80, 0x65, 0xBA, 0x10,
0x1F, 0x24, 0xC1, 0x15, 0x78, 0xB7, 0x90, 0xE5, 0x3D, 0xDA, 0x0F, 0x0E, 0x03, 0x20, 0xC1, 0xEA,
0x85
- };
- std::vector<uint8_t> goodData = {
+ }};
+ const Block goodData{{
0x06, 0xFD, 0x01, 0x5B, 0x07, 0x11, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61,
0x74, 0x61, 0x08, 0x03, 0x52, 0x73, 0x61, 0x14, 0x00, 0x15, 0x00, 0x16, 0x3E, 0x1B, 0x01, 0x01,
0x1C, 0x39, 0x07, 0x37, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17,
@@ -329,8 +329,8 @@
0x4F, 0xD9, 0xEB, 0xC1, 0x5D, 0x53, 0x15, 0xBF, 0x8C, 0x7C, 0x6B, 0x22, 0xB9, 0x24, 0x70, 0xAE,
0x63, 0x13, 0x96, 0x3B, 0x2A, 0xDA, 0x7F, 0x64, 0x0D, 0x9E, 0xA7, 0x90, 0x20, 0x2A, 0x2A, 0xAB,
0xA9, 0xA6, 0xC9, 0xB2, 0x37, 0x8E, 0xE3, 0x09, 0xFD, 0xA3, 0x68, 0x06, 0xCB, 0x96, 0x80
- };
- std::vector<uint8_t> badSigData = {
+ }};
+ const Block badSigData{{
0x06, 0xA2, 0x07, 0x11, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
0x08, 0x03, 0x52, 0x73, 0x61, 0x14, 0x00, 0x15, 0x00, 0x16, 0x40, 0x1B, 0x01, 0x03, 0x1C, 0x3B,
0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08, 0x17, 0x54, 0x65,
@@ -342,8 +342,8 @@
0x1E, 0x02, 0x21, 0x00, 0xA5, 0x62, 0xA5, 0x04, 0x60, 0xBC, 0x96, 0x54, 0x2C, 0x9E, 0x6F, 0xA8,
0x1B, 0xDB, 0xF9, 0xF0, 0x7E, 0xFF, 0xED, 0x92, 0x3A, 0x4B, 0xDE, 0x3D, 0x20, 0x02, 0x7B, 0xD7,
0x1C, 0xD0, 0xAA, 0xAB
- };
- std::vector<uint8_t> goodInterest = {
+ }};
+ const Block goodInterest{{
0x05, 0xFD, 0x01, 0x85, 0x07, 0x37, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E,
0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x08, 0x03, 0x52, 0x73, 0x61, 0x02, 0x20, 0x08, 0x39, 0xEE,
0x12, 0xF1, 0x10, 0xB7, 0x8B, 0x49, 0xF2, 0xE2, 0x54, 0x23, 0xFF, 0x66, 0xB3, 0x0F, 0xC6, 0x91,
@@ -369,8 +369,8 @@
0xE3, 0x11, 0x85, 0xCC, 0x0E, 0xAF, 0x56, 0x6B, 0xE1, 0xAC, 0xB3, 0x20, 0xF2, 0x47, 0xFE, 0x95,
0xC8, 0x71, 0x99, 0xCC, 0x52, 0x8A, 0x6F, 0xF1, 0x01, 0xD6, 0xE9, 0x2E, 0x6C, 0x27, 0xC3, 0xED,
0xE3, 0xF2, 0xDD, 0x78, 0xB4, 0x7F, 0xFA, 0xD0, 0xC2
- };
- std::vector<uint8_t> badSigInterest = {
+ }};
+ const Block badSigInterest{{
0x05, 0xCC, 0x07, 0x37, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
0x72, 0x65, 0x73, 0x74, 0x08, 0x03, 0x52, 0x73, 0x61, 0x02, 0x20, 0x64, 0xE3, 0x6F, 0xD5, 0x73,
0x21, 0xBC, 0xAB, 0xDE, 0xDE, 0x0F, 0x99, 0xCB, 0x49, 0x7F, 0x46, 0xE7, 0xF0, 0x7A, 0xF1, 0x2C,
@@ -384,8 +384,8 @@
0x4A, 0xBF, 0xC0, 0x5B, 0xA8, 0x05, 0xA2, 0xC8, 0x61, 0xC4, 0x2E, 0x64, 0x02, 0x20, 0x1F, 0x5E,
0xF5, 0x8E, 0xC9, 0xDC, 0x9E, 0x15, 0x1C, 0xFA, 0x58, 0x5F, 0xDF, 0xAE, 0xA0, 0xFD, 0xDA, 0x34,
0x21, 0xE0, 0xA8, 0x2D, 0x32, 0x47, 0x9E, 0x44, 0x83, 0x79, 0x23, 0x5F, 0xBE, 0x16
- };
- std::vector<uint8_t> goodInterestOldFormat = {
+ }};
+ const Block goodInterestOldFormat{{
0x05, 0xFD, 0x01, 0x85, 0x07, 0x37, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E,
0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x08, 0x03, 0x52, 0x73, 0x61, 0x02, 0x20, 0x08, 0x39, 0xEE,
0x12, 0xF1, 0x10, 0xB7, 0x8B, 0x49, 0xF2, 0xE2, 0x54, 0x23, 0xFF, 0x66, 0xB3, 0x0F, 0xC6, 0x91,
@@ -411,8 +411,8 @@
0xE3, 0x11, 0x85, 0xCC, 0x0E, 0xAF, 0x56, 0x6B, 0xE1, 0xAC, 0xB3, 0x20, 0xF2, 0x47, 0xFE, 0x95,
0xC8, 0x71, 0x99, 0xCC, 0x52, 0x8A, 0x6F, 0xF1, 0x01, 0xD6, 0xE9, 0x2E, 0x6C, 0x27, 0xC3, 0xED,
0xE3, 0xF2, 0xDD, 0x78, 0xB4, 0x7F, 0xFA, 0xD0, 0xC2
- };
- std::vector<uint8_t> badSigInterestOldFormat = {
+ }};
+ const Block badSigInterestOldFormat{{
0x05, 0xFD, 0x02, 0x15, 0x07, 0xC7, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E,
0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x08, 0x03, 0x52, 0x73, 0x61, 0x02, 0x20, 0x08, 0x39, 0xEE,
0x12, 0xF1, 0x10, 0xB7, 0x8B, 0x49, 0xF2, 0xE2, 0x54, 0x23, 0xFF, 0x66, 0xB3, 0x0F, 0xC6, 0x91,
@@ -447,23 +447,22 @@
0xE3, 0x11, 0x85, 0xCC, 0x0E, 0xAF, 0x56, 0x6B, 0xE1, 0xAC, 0xB3, 0x20, 0xF2, 0x47, 0xFE, 0x95,
0xC8, 0x71, 0x99, 0xCC, 0x52, 0x8A, 0x6F, 0xF1, 0x01, 0xD6, 0xE9, 0x2E, 0x6C, 0x27, 0xC3, 0xED,
0xE3, 0xF2, 0xDD, 0x78, 0xB4, 0x7F, 0xFA, 0xD0, 0xC2
- };
+ }};
};
struct Sha256Dataset
{
const std::string name = "Sha256";
- std::vector<uint8_t> cert = {
-
- };
- std::vector<uint8_t> goodData = {
+ const Block cert{{
+ }};
+ const Block goodData{{
0x06, 0x41, 0x07, 0x14, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x14, 0x00, 0x15, 0x00, 0x16, 0x03, 0x1B, 0x01,
0x00, 0x17, 0x20, 0xE2, 0xE2, 0x2F, 0x02, 0x70, 0xA7, 0xF7, 0x48, 0x70, 0x45, 0x29, 0x46, 0xBD,
0xD2, 0x62, 0x24, 0xA6, 0x1E, 0x1D, 0x75, 0x2A, 0x26, 0x98, 0x04, 0xAD, 0x9C, 0x47, 0x63, 0xF8,
0x98, 0x5A, 0x49
- };
- std::vector<uint8_t> badSigData = {
+ }};
+ const Block badSigData{{
0x06, 0xA6, 0x07, 0x14, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x04, 0x64, 0x61, 0x74, 0x61,
0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x14, 0x00, 0x15, 0x00, 0x16, 0x40, 0x1B, 0x01,
0x03, 0x1C, 0x3B, 0x07, 0x39, 0x08, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x08,
@@ -475,8 +474,8 @@
0x28, 0x19, 0x6C, 0x5C, 0xD6, 0x02, 0x21, 0x00, 0xF0, 0xD2, 0x23, 0xEA, 0xD9, 0x43, 0x6D, 0x8A,
0xD2, 0x02, 0x3F, 0xF1, 0x41, 0x12, 0xA6, 0xED, 0x87, 0xB3, 0xD5, 0x5A, 0x27, 0x5D, 0x4E, 0xEB,
0x13, 0x29, 0x01, 0xBC, 0x3C, 0xCC, 0x50, 0x61
- };
- std::vector<uint8_t> goodInterest = {
+ }};
+ const Block goodInterest{{
0x05, 0x6B, 0x07, 0x3A, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x8F, 0x03,
0x0B, 0x85, 0xA7, 0x05, 0xD8, 0x05, 0x31, 0x8E, 0x80, 0x81, 0xD3, 0xE2, 0xA8, 0x5E, 0x74, 0xD7,
@@ -484,8 +483,8 @@
0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x03, 0x1B, 0x01, 0x00, 0x2E, 0x20, 0xEF, 0x45, 0x55,
0x75, 0xC8, 0x18, 0x5E, 0xE9, 0x2A, 0xAE, 0x52, 0x61, 0x0A, 0x94, 0x41, 0x03, 0x36, 0x4C, 0x13,
0x59, 0xD4, 0xC7, 0xA4, 0x3A, 0xA0, 0x40, 0x61, 0x44, 0x33, 0x93, 0x5E, 0x99
- };
- std::vector<uint8_t> badSigInterest = {
+ }};
+ const Block badSigInterest{{
0x05, 0xCE, 0x07, 0x3A, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x32, 0x3F,
0x2F, 0xA3, 0xDC, 0x15, 0x7E, 0x8C, 0xA9, 0x75, 0xF7, 0x66, 0xFF, 0xFD, 0x13, 0x42, 0x1B, 0xE1,
@@ -499,8 +498,8 @@
0x73, 0xB3, 0xA6, 0xD2, 0x99, 0x32, 0x26, 0xE2, 0x46, 0x3A, 0xE0, 0x69, 0xDF, 0xB2, 0x02, 0x20,
0x6A, 0x03, 0xCE, 0xB6, 0x85, 0x1E, 0x01, 0x5E, 0xF8, 0x48, 0xDE, 0x65, 0xB9, 0xE1, 0xEB, 0x9A,
0xF8, 0x47, 0x43, 0x5B, 0xBA, 0x63, 0xCB, 0xBA, 0xFB, 0x62, 0x1C, 0x38, 0xE8, 0x53, 0xF7, 0x29
- };
- std::vector<uint8_t> goodInterestOldFormat = {
+ }};
+ const Block goodInterestOldFormat{{
0x05, 0x6B, 0x07, 0x3A, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x8F, 0x03,
0x0B, 0x85, 0xA7, 0x05, 0xD8, 0x05, 0x31, 0x8E, 0x80, 0x81, 0xD3, 0xE2, 0xA8, 0x5E, 0x74, 0xD7,
@@ -508,8 +507,8 @@
0xF7, 0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x03, 0x1B, 0x01, 0x00, 0x2E, 0x20, 0xEF, 0x45, 0x55,
0x75, 0xC8, 0x18, 0x5E, 0xE9, 0x2A, 0xAE, 0x52, 0x61, 0x0A, 0x94, 0x41, 0x03, 0x36, 0x4C, 0x13,
0x59, 0xD4, 0xC7, 0xA4, 0x3A, 0xA0, 0x40, 0x61, 0x44, 0x33, 0x93, 0x5E, 0x99
- };
- std::vector<uint8_t> badSigInterestOldFormat = {
+ }};
+ const Block badSigInterestOldFormat{{
0x05, 0xFA, 0x07, 0xC9, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x08, 0x69, 0x6E, 0x74, 0x65,
0x72, 0x65, 0x73, 0x74, 0x08, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x02, 0x20, 0x8F, 0x03,
0x0B, 0x85, 0xA7, 0x05, 0xD8, 0x05, 0x31, 0x8E, 0x80, 0x81, 0xD3, 0xE2, 0xA8, 0x5E, 0x74, 0xD7,
@@ -526,7 +525,7 @@
0x2C, 0x8A, 0x4B, 0x24, 0x00, 0x2C, 0x03, 0x1B, 0x01, 0x00, 0x2E, 0x20, 0xEF, 0x45, 0x55, 0x75,
0xC8, 0x18, 0x5E, 0xE9, 0x2A, 0xAE, 0x52, 0x61, 0x0A, 0x94, 0x41, 0x03, 0x36, 0x4C, 0x13, 0x59,
0xD4, 0xC7, 0xA4, 0x3A, 0xA0, 0x40, 0x61, 0x44, 0x33, 0x93, 0x5E, 0x99
- };
+ }};
};
// Note about the datasets:
@@ -547,18 +546,17 @@
BOOST_AUTO_TEST_CASE_TEMPLATE(VerifySignature, Dataset, SignatureDatasets)
{
const Dataset dataset;
- Certificate cert(Block(dataset.cert.data(), dataset.cert.size()));
- Buffer keyRaw = cert.getPublicKey();
+ Certificate cert(dataset.cert);
+ auto keyRaw = cert.getPublicKey();
transform::PublicKey key;
key.loadPkcs8(keyRaw);
- Data data(Block(dataset.goodData.data(), dataset.goodData.size()));
- Data badSigData(Block(dataset.badSigData.data(), dataset.badSigData.size()));
- Interest interest(Block(dataset.goodInterest.data(), dataset.goodInterest.size()));
- Interest badSigInterest(Block(dataset.badSigInterest.data(), dataset.badSigInterest.size()));
- Interest interestOldFormat(Block(dataset.goodInterestOldFormat.data(),
- dataset.goodInterestOldFormat.size()));
- Interest badSigInterestOldFormat(Block(dataset.badSigInterestOldFormat.data(),
- dataset.badSigInterestOldFormat.size()));
+
+ Data data(dataset.goodData);
+ Data badSigData(dataset.badSigData);
+ Interest interest(dataset.goodInterest);
+ Interest badSigInterest(dataset.badSigInterest);
+ Interest interestOldFormat(dataset.goodInterestOldFormat);
+ Interest badSigInterestOldFormat(dataset.badSigInterestOldFormat);
BOOST_CHECK(verifySignature(data, key));
BOOST_CHECK(verifySignature(data, keyRaw));
@@ -634,14 +632,12 @@
BOOST_AUTO_TEST_CASE_TEMPLATE(VerifyDigest, Dataset, DigestDatasets)
{
const Dataset dataset;
- Data data(Block(dataset.goodData.data(), dataset.goodData.size()));
- Data badSigData(Block(dataset.badSigData.data(), dataset.badSigData.size()));
- Interest interest(Block(dataset.goodInterest.data(), dataset.goodInterest.size()));
- Interest badSigInterest(Block(dataset.badSigInterest.data(), dataset.badSigInterest.size()));
- Interest interestOldFormat(Block(dataset.goodInterestOldFormat.data(),
- dataset.goodInterestOldFormat.size()));
- Interest badSigInterestOldFormat(Block(dataset.badSigInterestOldFormat.data(),
- dataset.badSigInterestOldFormat.size()));
+ Data data(dataset.goodData);
+ Data badSigData(dataset.badSigData);
+ Interest interest(dataset.goodInterest);
+ Interest badSigInterest(dataset.badSigInterest);
+ Interest interestOldFormat(dataset.goodInterestOldFormat);
+ Interest badSigInterestOldFormat(dataset.badSigInterestOldFormat);
BOOST_CHECK(verifySignature(data, nullopt));
BOOST_CHECK(verifySignature(interest, nullopt));
@@ -683,8 +679,8 @@
BOOST_AUTO_TEST_CASE(VerifyWithUnrecognizedElements) // Bug #4583
{
- Data data(Block(sha256DataUnrecognizedElements, sizeof(sha256DataUnrecognizedElements)));
- Interest interest(Block(sha256InterestUnrecognizedElements, sizeof(sha256InterestUnrecognizedElements)));
+ Data data(Block{sha256DataUnrecognizedElements});
+ Interest interest(Block{sha256InterestUnrecognizedElements});
BOOST_CHECK(verifySignature(data, nullopt));
BOOST_CHECK(verifySignature(interest, nullopt));