RSA algorithm Detailed

Source: Internet
Author: User
Tags asymmetric encryption

1.RSA encryption algorithm is the most common asymmetric encryption algorithm

2.RSARSA with its three inventors Ron Rivest, Adi Shamir, Leonard Adleman, named after the first letter,

3. At present, the academic community can not prove the absolute correctness of the RSA algorithm, but also can not prove to negate its security, so it just shows that the algorithm is quite credible.

The 4.RSA principle is based on the difficulty of large number decomposition, its public key and private key is a pair of large prime pairs of functions, from a public key and ciphertext recovery of the difficulty of clear text, equivalent to decomposition of two large prime numbers of the product (this is a recognized mathematical problem)

5. Specific encryption, decryption, process

The RSA's public key, the private key's composition, and the encrypted, decrypted formula are visible in the following table:

A clear concept is needed:

Prime number: That is prime, p,q must be prime (for example, 5,7)

Congruence operation:, Level C (mod n) = m^e (mod n)

6. Application examples

Assume that user a needs to pass the plaintext "key" to user B after encrypting it through RSA , as follows:

A. Take two large prime p,q

Here we take p=3,q=11 for the sake of simplicity, ( of course, if the actual application, P,q are more than hundreds of large prime numbers )

B. Calculate N=pxq and f (n) = (p-1) x (q-1)

Make p=3,q=11, Draw n=pxq=3x11=33;

F (n) = (p-1) (q-1) =2x10=20;

C. Determining the public key E and the private key D

Take the public key e=3, (3 and 20 coprime) then exd≡1 mod f (n), that is, 3xd≡1 MoD 20, the same remainder operation.

How does the private key D value? Can use the method of trial calculation to find, here is simple to use this approach, in fact, it must be used in large computer (encryption machine calculation). The results of the trial calculation are shown in the following table:

By trial we find that when d=7,exd≡1 mod f (n) is set up with the remainder equation. Therefore, the private key can be derived as d=7. So we can design a pair of public private keys, the encryption key (the key) is:KU = (e,n) = (3,33), the decryption key (private key) is:KR = (d,n) = (7,33).

At this point we have got a pair of public private keys (e,d) and large prime product N (N=PXQ, but p,q to be absolutely confidential)

( 2 ) digital in English.

Digitize the plaintext information and group each block of two digits. It is assumed that the plain English alphabet encodes the values in alphabetical order, i.e.:

The plaintext information for the key after the packet is: 11,05,25.

( 3 ) PlainText Encryption

The User encryption Key (3,33) encrypts digitized plaintext packet information into ciphertext. by C≡m^e (mod n):

C1 mod 33=11^3 mod (=11) = c1=11

C2 mod 33=5^3 mod (=26 =>c2=26)

C3 mod 33=25^3 mod (=16 =>c3=16)

So the ciphertext that can be encrypted is 11 26 16

(4) ciphertext decryption.

Decrypt the ciphertext into plaintext with the decryption key (7,33), m≡c^d (mod n)

M1 mod = 11^7 mod ($) =11 = m1=11

M2 mod =26^7 mod = 5 =>m2=5

M3 mod = 16^7 mod (=25 =>m3=25)

The decrypted plaintext is the same as the original, and the whole RSA plus decryption process ends.

Of course, the actual application is much more complicated than this, because the RSA algorithm's key private key Length (modulus length) to 1024 bits or even 2048-bit to ensure security, because of this,p,Q,E, the choice of public key private key generation, encryption and decryption mode index operations have a certain computational procedures, need to rely on the computer high-speed completion.

In RSA cipher applications, public key KU is exposed, i.e. the values of E and n can be obtained by third-party eavesdroppers. The problem with decrypting the RSA cipher is that from the known values of E and N (n equals PQ), the idea is to find the value of D so that the private key can be used to crack the ciphertext. From the formula above: D≡e-1 (mod (p-1) (q-1)) or de≡1 (mod (p-1) (q-1)) we can see. The essence of password cracking is: From the value of the PQ, to find out (p-1) and (q-1). In other words, only the values of P and Q are required, so we can find the value of D and get the private key.

When P and Q are a large prime number, the decomposition factor p and Q from their product PQ is a recognized mathematical problem. For example, when PQ is as large as 1024 bits, no one has yet been able to use any computational tool to complete the decomposition factor task. Therefore, RSA from the proposed to now nearly 20 years, experienced a variety of attacks, gradually accepted by people, generally considered to be one of the best public key scheme at present.

However, although RSA's security relies on the factorization of large numbers, it does not theoretically prove that the difficulty of deciphering RSA is equivalent to the difficulty of large number decomposition. The major flaw of RSA is that it can't theoretically grasp how its secrecy performance is.

In addition, the disadvantages of RSA are: a) to generate a key is cumbersome, by the number of technology constraints, it is difficult to do once a secret. B) packet length is too large, in order to ensure security, n at least more than bits, so that the computational cost is very high, especially slow, more than symmetric cipher algorithm several orders of magnitude, and with the development of large number decomposition technology, this length is still increasing, not conducive to the standardization of data format. Therefore, the use of RSA can only encrypt a small amount of data, a large number of data encryption also rely on symmetric cryptographic algorithms.

RSA algorithm Detailed

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.