summaryrefslogtreecommitdiff
path: root/eccrypto.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2016-12-11 01:02:00 -0500
committerJeffrey Walton <noloader@gmail.com>2016-12-11 01:02:00 -0500
commit7e427805174b9fc672caf838f9e456a09be32043 (patch)
tree7e97b8bd55bed4f1da97c48596c5a1d065aa1498 /eccrypto.h
parent26db40567dabc842ac8e49df7188c10e1087ac42 (diff)
downloadcryptopp-git-7e427805174b9fc672caf838f9e456a09be32043.tar.gz
Add Deterministic DSA and ECDSA Signatures (Issue 121)
Based on Douglas Roark PR 131
Diffstat (limited to 'eccrypto.h')
-rw-r--r--eccrypto.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/eccrypto.h b/eccrypto.h
index c5049f13..ebfda2a8 100644
--- a/eccrypto.h
+++ b/eccrypto.h
@@ -1,4 +1,5 @@
// eccrypto.h - written and placed in the public domain by Wei Dai
+// deterministic signatures added by by Douglas Roark
//! \file eccrypto.h
//! \brief Classes and functions for Elliptic Curves over prime and binary fields
@@ -343,6 +344,16 @@ public:
CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "ECDSA";}
};
+//! \class DL_Algorithm_ECDSA_RFC6979
+//! \brief Elliptic Curve DSA (ECDSA) signature algorithm
+//! \tparam EC elliptic curve field
+template <class EC, class H>
+class DL_Algorithm_ECDSA_RFC6979 : public DL_Algorithm_DSA_RFC6979<typename EC::Point, H>
+{
+public:
+ CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "ECDSA-RFC6979";}
+};
+
//! \class DL_Algorithm_ECNR
//! \brief Elliptic Curve NR (ECNR) signature algorithm
//! \tparam EC elliptic curve field
@@ -363,6 +374,23 @@ struct ECDSA : public DL_SS<DL_Keys_ECDSA<EC>, DL_Algorithm_ECDSA<EC>, DL_Signat
{
};
+//! \class ECDSA_RFC6979
+//! \brief Elliptic Curve DSA (ECDSA) deterministic signature scheme
+//! \tparam EC elliptic curve field
+//! \tparam H HashTransformation derived class
+//! \sa <a href="http://tools.ietf.org/rfc/rfc6979.txt">Deterministic Usage of the
+//! Digital Signature Algorithm (DSA) and Elliptic Curve Digital Signature Algorithm (ECDSA)</a>
+template <class EC, class H>
+struct ECDSA_RFC6979 : public DL_SS<
+ DL_Keys_ECDSA<EC>,
+ DL_Algorithm_ECDSA_RFC6979<EC, H>,
+ DL_SignatureMessageEncodingMethod_DSA,
+ H,
+ ECDSA_RFC6979<EC,H> >
+{
+ static std::string CRYPTOPP_API StaticAlgorithmName() {return std::string("ECDSA-RFC6979/") + H::StaticAlgorithmName();}
+};
+
//! \class ECNR
//! \brief Elliptic Curve NR (ECNR) signature scheme
//! \tparam EC elliptic curve field
@@ -415,7 +443,8 @@ struct ECIES
DL_EncryptionAlgorithm_Xor<HMAC<HASH>, DHAES_MODE, LABEL_OCTETS>,
ECIES<EC> >
{
- static std::string CRYPTOPP_API StaticAlgorithmName() {return "ECIES";} // TODO: fix this after name is standardized
+ // TODO: fix this after name is standardized
+ CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "ECIES";}
};
NAMESPACE_END