aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pk_pad/emsa1/emsa1.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2014-01-10 03:41:59 +0000
committerlloyd <[email protected]>2014-01-10 03:41:59 +0000
commit6894dca64c04936d07048c0e8cbf7e25858548c3 (patch)
tree5d572bfde9fe667dab14e3f04b5285a85d8acd95 /src/lib/pk_pad/emsa1/emsa1.h
parent9efa3be92442afb3d0b69890a36c7f122df18eda (diff)
Move lib into src
Diffstat (limited to 'src/lib/pk_pad/emsa1/emsa1.h')
-rw-r--r--src/lib/pk_pad/emsa1/emsa1.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/lib/pk_pad/emsa1/emsa1.h b/src/lib/pk_pad/emsa1/emsa1.h
new file mode 100644
index 000000000..f84ca5ae7
--- /dev/null
+++ b/src/lib/pk_pad/emsa1/emsa1.h
@@ -0,0 +1,48 @@
+/*
+* EMSA1
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#ifndef BOTAN_EMSA1_H__
+#define BOTAN_EMSA1_H__
+
+#include <botan/emsa.h>
+#include <botan/hash.h>
+
+namespace Botan {
+
+/**
+* EMSA1 from IEEE 1363
+* Essentially, sign the hash directly
+*/
+class BOTAN_DLL EMSA1 : public EMSA
+ {
+ public:
+ /**
+ * @param h the hash object to use
+ */
+ EMSA1(HashFunction* h) : hash(h) {}
+ ~EMSA1() { delete hash; }
+ protected:
+ /**
+ * @return const pointer to the underlying hash
+ */
+ const HashFunction* hash_ptr() const { return hash; }
+ private:
+ void update(const byte[], size_t);
+ secure_vector<byte> raw_data();
+
+ secure_vector<byte> encoding_of(const secure_vector<byte>&, size_t,
+ RandomNumberGenerator& rng);
+
+ bool verify(const secure_vector<byte>&, const secure_vector<byte>&,
+ size_t);
+
+ HashFunction* hash;
+ };
+
+}
+
+#endif