aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/rsa/rsa.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-05 16:10:55 +0000
committerlloyd <[email protected]>2010-03-05 16:10:55 +0000
commitdf56028cad58fad04b9866326cb62700af8f2fbe (patch)
treedcaa1a80c9f20db7b7993ac54b1aaafd488354c0 /src/pubkey/rsa/rsa.h
parent93873731f73e905d8714556f1ebe23acb32de0e1 (diff)
Add verification ops for all signature key types
Diffstat (limited to 'src/pubkey/rsa/rsa.h')
-rw-r--r--src/pubkey/rsa/rsa.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/pubkey/rsa/rsa.h b/src/pubkey/rsa/rsa.h
index 989cfd038..72b90fe5a 100644
--- a/src/pubkey/rsa/rsa.h
+++ b/src/pubkey/rsa/rsa.h
@@ -115,6 +115,27 @@ class BOTAN_DLL RSA_Signature_Operation : public PK_Ops::Signature_Operation
u32bit n_bits;
};
+class BOTAN_DLL RSA_Verification_Operation : public PK_Ops::Verification
+ {
+ public:
+ RSA_Verification_Operation(const RSA_PublicKey& rsa) :
+ powermod_e_n(rsa.get_e(), rsa.get_n()),
+ n_bits(rsa.get_n().bits())
+ {}
+
+ u32bit max_input_bits() const { return (n_bits - 1); }
+ bool with_recovery() const { return true; }
+
+ SecureVector<byte> verify_mr(const byte msg[], u32bit msg_len)
+ {
+ return BigInt::encode(powermod_e_n(BigInt(msg, msg_len)));
+ }
+
+ private:
+ Fixed_Exponent_Power_Mod powermod_e_n;
+ u32bit n_bits;
+ };
+
}
#endif