aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorFrancis Dupont <[email protected]>2017-09-04 15:58:20 +0200
committerFrancis Dupont <[email protected]>2017-09-04 15:58:20 +0200
commitb79c0fceb74b3fb860518b0e62a8df1032bd6404 (patch)
treee35af34150abc7cc4414ded831e8bd2daf47a668 /src/lib
parent16e5a43a77eeb5f2c23362309ca59fb011fc62bc (diff)
Added SHA3_XXX_PKCS OID
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/pk_pad/hash_id/hash_id.cpp28
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));