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

Are there any papers, books, or link where it explains how the plain vanilla "textbook RSA" is actually implemented in practice with all the padding and stuff?

Basically, I would like to know the intricacies of implementing an algorithm into production level code…

share|improve this question
up vote 7 down vote accepted

Vanilla textbook RSA does not include "padding and stuff", the term "textbook RSA" generally refers to simply encoding a plaintext message as an integer and raising it to an exponent. Implementing this is pretty easy, just follow the steps outlined on Wikipedia. You can easily translate those steps into some given programming language.

Based on the rest of your statement, it sounds like you want to implement a real-world encryption/signing scheme using RSA, but not some higher protocol that uses it. If so, I would suggest looking at PKCS #1 v2. It's an authoritative specification for several such RSA padding schemes. (RSA-OAEP is probably the most recommended padding scheme for encryption if that's what you want.)

share|improve this answer

In addition to B-Con's correct answer, there is one additional thing you may need to worry about: RSA key generation. Now, PKCS #1 doesn't discuss it; for formal advice on how to do that, you might consider FIPS 186-3, and in particular, section 5.1 and appendix B.3.3. Now, FIPS 186-3 discusses several possible methods for finding primes (which is the hard part in generating an RSA key); I selected B.3.3 as the easiest, if it isn't the fastest.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.