2341939de47445c6e015290ad13b13ced9cb7c01
[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 n; // Modulus.
15 uint e; // Exponent.
16
17 mpz_class p;
18 mpz_class q;
19 mpz_class dp;
20 mpz_class dq;
21 mpz_class qInv;
22 mpz_class d;
23 };
24
25 static std::pair<Rsa::KeyPub, KeyPriv> generateRSAKeys(uint exponent, uint keySizeBits);
26
27 /**
28 * m must not be greater or equal than kPriv.n.
29 */
30 static mpz_class sign(const mpz_class& m, const KeyPriv& kPriv);
31 };
32
33 #endif