Shamir's trick implementation.
[crypto_lab3.git] / src / RsaCrt.h
index 373d583..6e93e6b 100644 (file)
@@ -2,6 +2,7 @@
 #define RSACRT_H
 
 #include <utility>
+#include <exception>
 
 #include <gmpxx.h>
 
@@ -18,12 +19,25 @@ public:
       mpz_class qInv;
    };
 
+   /**
+    * Generate a pair of keys (public, private).
+    */
    static std::pair<Rsa::KeyPub, KeyPriv> 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