Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose I implement RSA myself in C and I use just the formulas from number theory. What attacks would my implementation be vulnerable to? Can anyone explain this to me like I'm 5?

share|improve this question
RSA is a trapdoor permutation used in various protocols and cryptographic schemes. The attacks are on the protocol/scheme and the primitive together. What scheme are you implementing? – pg1989 Aug 22 '13 at 0:55
Shall we assume textbook RSA with no message padding / formatting? – rath Aug 22 '13 at 2:51
Not my answer, but a quick search turned up which is about as simple an explanation as I've seen. – John Deters Aug 22 '13 at 3:40
Additionally, there are sidechannel attacks. E.g. the decryption is done with square-and-multiply exponentiation, then the timing is a linear function of the Hamminh weight of the key (n times squaring and the Hamming weight in multiplications). If the 0s and 1s are almost uniform, this is not a problem, but otherwise you have a problem. If the attacker can even identify the order of multiplications and squaring (the operations take different amounts of time and cache access), he can just grab $d$ directly. – tylo Aug 22 '13 at 11:13
@rath Yes, textbook RSA with no message padding or formatting. – bodacydo Aug 22 '13 at 21:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.