X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=src%2FRsaCrt.h;h=6e93e6bd25269d646e69bc4eb0b0905a6a09c929;hb=44666fce380623d5194f623155b15f3c39ce2ca8;hp=373d58325c4fad2efd50abc391ddecab96f8f8a7;hpb=d061bc06b7e5681e9da4c2c0b7642f50d126ff76;p=crypto_lab3.git diff --git a/src/RsaCrt.h b/src/RsaCrt.h index 373d583..6e93e6b 100644 --- a/src/RsaCrt.h +++ b/src/RsaCrt.h @@ -2,6 +2,7 @@ #define RSACRT_H #include +#include #include @@ -18,12 +19,25 @@ public: mpz_class qInv; }; + /** + * 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); + +private: + static mpz_class sign(const mpz_class& m, const KeyPriv& kPriv, bool withError); }; #endif