diff options
author | Jack Lloyd <[email protected]> | 2017-09-04 10:32:20 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-09-04 10:32:20 -0400 |
commit | 7e9574550140043ef50ff13b72827f7e7d4e30f1 (patch) | |
tree | e35af34150abc7cc4414ded831e8bd2daf47a668 /src | |
parent | 16e5a43a77eeb5f2c23362309ca59fb011fc62bc (diff) | |
parent | b79c0fceb74b3fb860518b0e62a8df1032bd6404 (diff) |
Merge GH #1184 Add ids for SHA-3 with PKCS1v1.5
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/pk_pad/hash_id/hash_id.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/lib/pk_pad/hash_id/hash_id.cpp b/src/lib/pk_pad/hash_id/hash_id.cpp index 4cb613f76..ce92ad5e9 100644 --- a/src/lib/pk_pad/hash_id/hash_id.cpp +++ b/src/lib/pk_pad/hash_id/hash_id.cpp @@ -44,6 +44,18 @@ 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 SHA3_224_PKCS_ID[] = { +0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x03, 0x0D }; + +const uint8_t SHA3_256_PKCS_ID[] = { +0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x03, 0x0E }; + +const uint8_t SHA3_384_PKCS_ID[] = { +0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x03, 0x0F }; + +const uint8_t SHA3_512_PKCS_ID[] = { +0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x03, 0x10 }; + const uint8_t SM3_PKCS_ID[] = { 0x30, 0x30, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x81, 0x1C, 0xCF, 0x55, 0x01, 0x83, 0x11, 0x05, 0x00, 0x04, 0x20, @@ -96,6 +108,22 @@ std::vector<uint8_t> pkcs_hash_id(const std::string& name) return std::vector<uint8_t>(SHA_512_256_PKCS_ID, SHA_512_256_PKCS_ID + sizeof(SHA_512_256_PKCS_ID)); + if(name == "SHA-3(224)") + return std::vector<uint8_t>(SHA3_224_PKCS_ID, + SHA3_224_PKCS_ID + sizeof(SHA3_224_PKCS_ID)); + + if(name == "SHA-3(256)") + return std::vector<uint8_t>(SHA3_256_PKCS_ID, + SHA3_256_PKCS_ID + sizeof(SHA3_256_PKCS_ID)); + + if(name == "SHA-3(384)") + return std::vector<uint8_t>(SHA3_384_PKCS_ID, + SHA3_384_PKCS_ID + sizeof(SHA3_384_PKCS_ID)); + + if(name == "SHA-3(512)") + return std::vector<uint8_t>(SHA3_512_PKCS_ID, + SHA3_512_PKCS_ID + sizeof(SHA3_512_PKCS_ID)); + if(name == "SM3") return std::vector<uint8_t>(SM3_PKCS_ID, SM3_PKCS_ID + sizeof(SM3_PKCS_ID)); |