I am going through the RSA algorithm and I have a few questions.

My understanding of RSA Algorithm:

RSA algorithm

How does a receiver get his private keys P and Q?

For a particular public key, if every receiver has the same private keys then one malicious receiver can decrypt any message that is intended to send to other receivers?

  • 2
    All the math is not needed to understand the concept: each user has a private and a public keys. There are 2 numbers computed by some algorithm and linked in such a way that everything encrypted by one of them can be decrypted only by the other one. Then by convention one is called public and is propagated publicly and the other is called private and is kept secured. To secure a message to Bob you encrypt it with its public key. To ensure Alice message authenticity she encrypts it with its private key. This is of course a simplified view but it is the core of it. – Patrick Mevzek May 1 '18 at 13:31

This image is confusing. The private key of the sender is different from the private key of the receiver. These keys are private, so not even the proper sender and receiver know each others private keys. They are not distributed at all, only public keys are. I don't know why this image portraits them being the same. Also there are two public keys. One for each private key. You should probably find a better image.

  • Can you please suggest me a resource that can explain how RSA can be implemented in some software system with some dummy examples. – Pawan Kumar May 1 '18 at 13:15
  • @PKChem If you want to implement RSA for some reason, read the RFC. Always read the RFC if you want to implement something yourself. If you just want to use it from a library, a basic understanding should suffice. RFC tools.ietf.org/html/rfc8017 Simple explanation: pagedon.com/rsa-explained-simply/programming – Peter Harmann May 1 '18 at 13:34

Each one of the endpoints have it's own pair of keys a private and a public one, what is shared is just their public keys, each one have the other's public key, uses it to encrypt the data before sending it.

for addition: Generally RSA or asymmetric encryption algorithms are not used as a standalone algorithm, they are used just share a symetric session key, and here is how it goes : suppose that there are two endpoints A and B,

A, generates a pair of keys a pirvare and a public one, sends the public one two B.

B, generates a symetric session key, encrypt it with the received public key, and send it back to A.

Now that A and B have a symetric session key, they will communicate using it, as symetric encryption algrithms are much faster than the asymetric ones. the asymetric session ensure that the symetric session key is transported safely.


The private keys are not distributed. Each actor (in this case the sender and the receiver) generate a (public key, private key) pair, and then share the public one.

Thus, the private key doesn't need to be distributed safely, because it doesn't leave the computer on which it was created.

(your picture is wrong, sender and receiver have different p and q values that make their keys, which affects the rest of the formulas)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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