summaryrefslogtreecommitdiff
path: root/pkcspad.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-10-04 23:24:18 -0400
committerJeffrey Walton <noloader@gmail.com>2017-10-04 23:24:18 -0400
commit1d0df34ae8304fa964cb7702e4f4476bbf6e9e7c (patch)
tree2cb9b3b3804af9e94102d985ade4f89483554751 /pkcspad.cpp
parent73928489f97d8dc45bf7a3fe9fe275cd1adb5d97 (diff)
downloadcryptopp-git-1d0df34ae8304fa964cb7702e4f4476bbf6e9e7c.tar.gz
Add PKCS #1 SHA3-based signatures (GH #517)
Diffstat (limited to 'pkcspad.cpp')
-rw-r--r--pkcspad.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/pkcspad.cpp b/pkcspad.cpp
index 322a5a26..d7204c54 100644
--- a/pkcspad.cpp
+++ b/pkcspad.cpp
@@ -39,10 +39,21 @@ template<> const unsigned int PKCS_DigestDecoration<SHA256>::length = (unsigned
template<> const byte PKCS_DigestDecoration<SHA384>::decoration[] = {0x30,0x41,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x02,0x05,0x00,0x04,0x30};
template<> const unsigned int PKCS_DigestDecoration<SHA384>::length = (unsigned int)sizeof(PKCS_DigestDecoration<SHA384>::decoration);
-template<> const byte PKCS_DigestDecoration<SHA512>::decoration[] = {0x30,0x51,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x03,0x05,0x00,0x04,0x40};
+template<> const byte PKCS_DigestDecoration<SHA512>::decoration[] = {0x30,0x51,0x30,0x0d, 0x06,0x09,0x60,0x86, 0x48,0x01,0x65,0x03, 0x04,0x02,0x03,0x05, 0x00,0x04,0x40};
template<> const unsigned int PKCS_DigestDecoration<SHA512>::length = (unsigned int)sizeof(PKCS_DigestDecoration<SHA512>::decoration);
-template<> const byte EMSA2HashId<SHA1>::id = 0x33;
+// http://github.com/weidai11/cryptopp/issues/517. OIDs and encoded prefixes found at
+// http://www.ietf.org/archive/id/draft-jivsov-openpgp-sha3-01.txt
+template<> const byte PKCS_DigestDecoration<SHA3_256>::decoration[] = {0x30,0x31,0x30,0x0d, 0x06,0x09,0x60,0x86, 0x48,0x01,0x65,0x03, 0x04,0x02,0x08,0x05, 0x00,0x04,0x20};
+template<> const unsigned int PKCS_DigestDecoration<SHA3_256>::length = (unsigned int)sizeof(PKCS_DigestDecoration<SHA3_256>::decoration);
+
+template<> const byte PKCS_DigestDecoration<SHA3_384>::decoration[] = {0x30,0x41,0x30,0x0d, 0x06,0x09,0x60,0x86, 0x48,0x01,0x65,0x03, 0x04,0x02,0x09,0x05, 0x00,0x04,0x30};
+template<> const unsigned int PKCS_DigestDecoration<SHA3_384>::length = (unsigned int)sizeof(PKCS_DigestDecoration<SHA3_384>::decoration);
+
+template<> const byte PKCS_DigestDecoration<SHA3_512>::decoration[] = {0x30,0x51,0x30,0x0d, 0x06,0x09,0x60,0x86, 0x48,0x01,0x65,0x03, 0x04,0x02,0x0a,0x05, 0x00,0x04,0x40};
+template<> const unsigned int PKCS_DigestDecoration<SHA3_512>::length = (unsigned int)sizeof(PKCS_DigestDecoration<SHA3_512>::decoration);
+
+template<> const byte EMSA2HashId< SHA1>::id = 0x33;
template<> const byte EMSA2HashId<SHA224>::id = 0x38;
template<> const byte EMSA2HashId<SHA256>::id = 0x34;
template<> const byte EMSA2HashId<SHA384>::id = 0x36;