RSA
Will be introduced in this page the fundamentals of RSA, mathematical requirement and also some application with python and openSSL.
Last updated
Was this helpful?
Will be introduced in this page the fundamentals of RSA, mathematical requirement and also some application with python and openSSL.
Last updated
Was this helpful?
This page is pretty long, probably could be split up
Edit: I haved deleted the last part, application with RSA, and i made a special part for this. Maybe we can do the same with the second part: Arithmetic for RSA.
RSA is a public-key cryptosystem that is widely used in the world today to provide a secure transmission system to millions of communications, is one of the oldest such systems in existence. The acronym RSA comes from the surnames of Ron Rivest, Adi Shamir, and Leonard Adleman, who publicly described the algorithm in 1977. An equivalent system was developed secretly, in 1973 at GCHQ (the British signals intelligence agency), by the English mathematician Clifford Cocks. That system was declassified in 1997.
All public-key systems are based on the concept of trapdoor functions, functions that are simple to compute in one direction but computationally hard to reverse without knowledge of some special information called the trapdoor. In RSA, the trapdoor function is based on the hardness of factoring integers. The function involves the use of a public keyto encrypt data, which is (supposed to be) encrypted in such a way that the function cannot be reversed without knowledge of the prime factorisation of, something that should be kept private. Except in certain cases, there exists no efficient algorithm for factoring huge integers.
Further reading: Shor's algorithm
Formalize the introduction and include a discussion of the security based on the hardness of factoring integers.
Before starting to introducing you RSA, a few arithmetic notions need to be introduce to understand perfectly other steps.
We pick two primes and
Using and , we calculate modulus and its Euler's totient
Now, choose the public exponent such as
By using the Extended Euclidean algorithm, we compute the invert of : which is our private exponent.
Public key:
Private key:
Now, chose a message that you convert into integers
We can encrypt this plaintext and receive a ciphertext
We can decrypt a ciphertext with
A digital signature is a proof of the authenticity of a message, i.e. a proof that the message has not been tampered with. RSA allows us to sign messages by "encrypting" them using the private key, the result being a signature that anyone can verify by "decrypting" it with the public key and comparing it to the associated message. Any attempt to tamper with the message will result in it no longer matching the signature, and vice-versa. Futhermore, a signature can only be generated using the private key, making it a secure and efficient method of confirming the authenticity of messages.
Say Alice wants to send a message to Bob, but does not want Mallory, who has established herself as a middleman, to make changes to the message or swap it out entirely. Fortunately, Bob knows Alice's public key, and since and are inverses such that , Alice can sign her message by "encrypting" it with the private key such that , where is the signature verifying that the message came from Alice. Alice can now send and to Bob, who is now able to check the authenticity of the message by checking if . If Mallory tries to change , this congruence no longer holds, and since she does not have the private key, she is also unable to provide a maching for her tampered message.