Attack implementation.
[crypto_lab3.git] / src / RsaCrt.h
1 #ifndef RSACRT_H
2 #define RSACRT_H
3
4 #include <utility>
5
6 #include <gmpxx.h>
7
8 #include "Rsa.h"
9
10 class RsaCrt
11 {
12 public:
13 struct KeyPriv {
14 mpz_class p;
15 mpz_class q;
16 mpz_class dp;
17 mpz_class dq;
18 mpz_class qInv;
19 };
20
21 /**
22 * Generate a pair of keys (public, private).
23 */
24 static std::pair<Rsa::KeyPub, KeyPriv> generateRSAKeys(uint exponent, uint keySizeBits);
25
26 /**
27 * m must not be greater or equal than kPriv.n.
28 */
29 static mpz_class sign(const mpz_class& m, const KeyPriv& kPriv);
30
31 static mpz_class signWithFaultySp(const mpz_class& m, const KeyPriv& kPriv);
32 };
33
34 #endif