From b0fbcf8d24fb1c677aad3d2cfdd0c18274493f07 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Fri, 19 May 2017 12:13:42 -0400 Subject: Add SM3 OIDs and PKCSv1.5 hash prefix --- src/lib/pk_pad/hash_id/hash_id.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/lib/pk_pad/hash_id') diff --git a/src/lib/pk_pad/hash_id/hash_id.cpp b/src/lib/pk_pad/hash_id/hash_id.cpp index 71a3dbe22..4cb613f76 100644 --- a/src/lib/pk_pad/hash_id/hash_id.cpp +++ b/src/lib/pk_pad/hash_id/hash_id.cpp @@ -44,6 +44,11 @@ const uint8_t SHA_512_256_PKCS_ID[] = { 0x30, 0x31, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x06, 0x05, 0x00, 0x04, 0x20 }; +const uint8_t SM3_PKCS_ID[] = { +0x30, 0x30, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x81, 0x1C, 0xCF, +0x55, 0x01, 0x83, 0x11, 0x05, 0x00, 0x04, 0x20, +}; + const uint8_t TIGER_PKCS_ID[] = { 0x30, 0x29, 0x30, 0x0D, 0x06, 0x09, 0x2B, 0x06, 0x01, 0x04, 0x01, 0xDA, 0x47, 0x0C, 0x02, 0x05, 0x00, 0x04, 0x18 }; @@ -91,6 +96,9 @@ std::vector pkcs_hash_id(const std::string& name) return std::vector(SHA_512_256_PKCS_ID, SHA_512_256_PKCS_ID + sizeof(SHA_512_256_PKCS_ID)); + if(name == "SM3") + return std::vector(SM3_PKCS_ID, SM3_PKCS_ID + sizeof(SM3_PKCS_ID)); + if(name == "Tiger(24,3)") return std::vector(TIGER_PKCS_ID, TIGER_PKCS_ID + sizeof(TIGER_PKCS_ID)); -- cgit v1.2.3