3
$\begingroup$

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…

$\endgroup$

2 Answers 2

7
$\begingroup$

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.)

$\endgroup$
4
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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