1 #ifndef RSACRT_SHAMIRS_TRICK_H
2 #define RSACRT_SHAMIRS_TRICK_H
11 class RsaCrtShamirsTrick
14 class UnableToSignWithShamirsTrick
: public std::exception
{};
24 * Generate a pair of keys (public, private).
26 static std::pair
<Rsa::KeyPub
, KeyPriv
> generateRSAKeys(uint exponent
, uint keySizeBits
);
29 * m must not be greater or equal than kPriv.n.
30 * Use the Shamir's trick to test if a fault has been created during the computation of Sp and Sq.
31 * If so it throws 'UnableToSignWithShamirsTrick'.
32 * @param m the message to sign. No padding is used.
34 static mpz_class
sign(const mpz_class
& m
, const KeyPriv
& kPriv
);
37 * Sp is altered by flipping its 42nd bit.
38 * @param m the message to sign. No padding is used.
40 static mpz_class
signWithFaultySp(const mpz_class
& m
, const KeyPriv
& kPriv
);
43 static mpz_class
sign(const mpz_class
& m
, const KeyPriv
& kPriv
, bool withError
);