X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=src%2FRsaCrt.h;h=adf6c72f4193478812289a5936a7833309eb2cb4;hb=22aac262156e81085b22bdfcd0cc38950768be9b;hp=2341939de47445c6e015290ad13b13ced9cb7c01;hpb=fb173a9728e915fc7b3f99bc41f55034757105df;p=crypto_lab3.git diff --git a/src/RsaCrt.h b/src/RsaCrt.h index 2341939..adf6c72 100644 --- a/src/RsaCrt.h +++ b/src/RsaCrt.h @@ -2,6 +2,7 @@ #define RSACRT_H #include +#include #include @@ -11,23 +12,29 @@ class RsaCrt { public: struct KeyPriv { - mpz_class n; // Modulus. - uint e; // Exponent. - mpz_class p; mpz_class q; mpz_class dp; mpz_class dq; mpz_class qInv; - mpz_class d; }; + /** + * Generate a pair of keys (public, private). + */ static std::pair generateRSAKeys(uint exponent, uint keySizeBits); /** * m must not be greater or equal than kPriv.n. + * @param m the message to sign. No padding is used. */ static mpz_class sign(const mpz_class& m, const KeyPriv& kPriv); + + /** + * Sp is altered by flipping its 42nd bit. + * @param m the message to sign. No padding is used. + */ + static mpz_class signWithFaultySp(const mpz_class& m, const KeyPriv& kPriv); }; #endif