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. Commented May 1, 2018 at 13:31

3 Answers 3


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. Commented May 1, 2018 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 Commented May 1, 2018 at 13:34

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)


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .