Brief introduction to the principle of asymmetric encryption RSA encryption algorithm

Source: Internet
Author: User
Tags asymmetric encryption

It is estimated that there will be more updates in cryptography over time.


Asymmetric Encryption:Asymmetric encryption is the opposite of symmetric encryption concept, symmetric encryption refers to the encryption and decryption using the same key keys, such as Stream encryption, block encryption, one-time password. Instead of symmetric encryption, use the encryption key to call the public key, and decrypt it with the private key. Why do we have to do this? Because this can be greatly convenient to see the key management. Suppose a banking institution, if using symmetric encryption, a user A key, tens of thousands of users, tens of thousands of key, can not be managed, and using asymmetric encryption, a decryption with the private key can solve all problems. In addition, public key cryptography does not require shared universal keys compared to symmetric key encryption, which reduces a lot of unnecessary hassles.
RSA:In 1977, three MIT people suggested that RSA was taken from the beginning of their three-person name. In 1997, the mathematician, who disclosed a British Government Communications Headquarters, first discovered it with three people, but was immediately classified as confidential and was only disclosed until 1994.
Mathematical principles:
m= plaintext c= ciphertext n= random number e= Public key d= key is still multiplied by two large prime numbers to obtain the large number is difficult to be factored into the core.Core:M^e mod n = C (plaintext m encrypted with the public key E and the random number n takes the remainder to get ciphertext c) c^d mod n = m (ciphertext c is decrypted with the key and the random number n takes the remainder to get clear m) Therefore, the combination of the two is: m^ (e^d) mod N = m, that is: m^ (ed) mo D N =m
The question is, how to finalize this decryption with d? This requires the introduction of a concept called: Euler function φ (n): The number of positive integers less than or equal to n coprime the number of N. For example φ (8), 1 2 3 4 5 6 7, this condition is: 1 3 5 7, so φ (8) =4 so we can know that φ (n) if n is prime, φ (n) = n-1 and φ (n) also conforms to φ (a*b) =φ (a ) *φ (b)
In addition, Euler's theorem is used:
Therefore, the method of calculating the modulo element d of E is as follows: 1. Select two large prime number p1,p2,p1*p2=n, and can get Φ (n) 2. The more Euler theorem can be learned that ed=1 (modφ (n)) 3. is equivalent to ed-1 = Kφ (n) 4. So it's equivalent to solving the two-element first-time equation E x +φ (n) y = 1 The x in a set of solutions is calculated as D
steps:Specifically, take a look at the steps, and give a chestnut, assuming Alice and Bob have to communicate with each other, this time using asymmetric encryption. 1.Alice randomly takes large prime number p1=53,p2=59, that n=53*59=3127,φ (n) = 3016, takes a e=3, calculates the d=2011. 2. Pass n=3127,e=3 as the public key only to Bob. 3. Suppose Bob needs to encrypt the plaintext m=89,c = 89^3 mod 3127=1394, so Bob returns c=1394 4.Alice using c^d mod n = 1394^2011 mod 3127 to get the plaintext m=89. Looking back, the attacker can intercept the n=3127,e=3,c=1394, but he still cannot decode the ciphertext without passing d.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.