aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/pk_ops.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-05 01:09:28 +0000
committerlloyd <[email protected]>2010-03-05 01:09:28 +0000
commit1c7dbb21d19702872379421e6ae44a15caf67da2 (patch)
treebd4ee9e01f8cfd9631655d0e0b0991d49c0a7e8e /src/pubkey/pk_ops.h
parent78b5b103291ee668185dc71d138a50e8e7e54808 (diff)
Add signature generation operation classes. Remove sign() from
PK_Signing_Key, though for the moment the class remains because there are a few pieces of code that use it to detect if signatures are supported, or for passing to functions in look_pk
Diffstat (limited to 'src/pubkey/pk_ops.h')
-rw-r--r--src/pubkey/pk_ops.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/pubkey/pk_ops.h b/src/pubkey/pk_ops.h
index 2b9ac4366..5aa50efdb 100644
--- a/src/pubkey/pk_ops.h
+++ b/src/pubkey/pk_ops.h
@@ -9,11 +9,46 @@
#define BOTAN_PK_OPERATIONS_H__
#include <botan/secmem.h>
+#include <botan/rng.h>
namespace Botan {
namespace PK_Ops {
+class Signature_Operation
+ {
+ public:
+ /**
+ * Find out the number of message parts supported by this scheme.
+ * @return the number of message parts
+ */
+ virtual u32bit message_parts() const { return 1; }
+
+ /**
+ * Find out the message part size supported by this scheme/key.
+ * @return the size of the message parts
+ */
+ virtual u32bit message_part_size() const { return 0; }
+
+ /**
+ * Get the maximum message size in bits supported by this public key.
+ * @return the maximum message in bits
+ */
+ virtual u32bit max_input_bits() const = 0;
+
+ /*
+ * Perform a signature operation
+ * @param msg the message
+ * @param msg_len the length of msg in bytes
+ * @param rng a random number generator
+ */
+ virtual SecureVector<byte> sign(const byte msg[],
+ u32bit msg_len,
+ RandomNumberGenerator& rng) = 0;
+
+ virtual ~Signature_Operation() {}
+ };
+
/*
* A generic Key Agreement Operation (eg DH or ECDH)
*/