aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/rw/rw.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/rw/rw.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/rw/rw.h')
-rw-r--r--src/pubkey/rw/rw.h29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/pubkey/rw/rw.h b/src/pubkey/rw/rw.h
index efdca04e7..a46cb5bb3 100644
--- a/src/pubkey/rw/rw.h
+++ b/src/pubkey/rw/rw.h
@@ -49,11 +49,6 @@ class BOTAN_DLL RW_PrivateKey : public RW_PublicKey,
public IF_Scheme_PrivateKey
{
public:
- SecureVector<byte> sign(const byte[], u32bit,
- RandomNumberGenerator& rng) const;
-
- bool check_key(RandomNumberGenerator& rng, bool) const;
-
RW_PrivateKey(const AlgorithmIdentifier& alg_id,
const MemoryRegion<byte>& key_bits,
RandomNumberGenerator& rng) :
@@ -66,6 +61,30 @@ class BOTAN_DLL RW_PrivateKey : public RW_PublicKey,
IF_Scheme_PrivateKey(rng, p, q, e, d, n) {}
RW_PrivateKey(RandomNumberGenerator& rng, u32bit bits, u32bit = 2);
+
+ bool check_key(RandomNumberGenerator& rng, bool) const;
+
+ SecureVector<byte> sign(const byte[], u32bit,
+ RandomNumberGenerator& rng) const;
+ };
+
+class BOTAN_DLL RW_Signature_Operation : public PK_Ops::Signature_Operation
+ {
+ public:
+ RW_Signature_Operation(const RW_PrivateKey& rw);
+
+ u32bit max_input_bits() const { return (n.bits() - 1); }
+
+ SecureVector<byte> sign(const byte msg[], u32bit msg_len,
+ RandomNumberGenerator& rng);
+ private:
+ const BigInt& q;
+ const BigInt& c;
+ const BigInt& n;
+
+ Fixed_Exponent_Power_Mod powermod_d1_p, powermod_d2_q;
+ Modular_Reducer mod_p;
+ u32bit n_bits;
};
}