The principle of "turn" two asymmetric algorithms: RSA and DH

Source: Internet
Author: User

Transferred from:http://blog.chinaunix.net/uid-7550780-id-2611984.html

two principles of asymmetric algorithms: RSA and DH

Although the symmetric algorithm is efficient, the transmission of the key requires additional channels. The asymmetric algorithm RSA and DH can solve the key transmission problem (of course, they are not limited to the role of this). The names of the two algorithms are derived from the acronym of the algorithm author, hoping that one day it will be possible to have a Chinese-named encryption algorithm. The fundamental principle of asymmetric algorithm is one-way function, f (a) =b, but it is difficult to get a with B. RSA AlgorithmThe RSA algorithm is based on the principle that large numbers are difficult to decompose. It can be used not only for authentication, but also for key transmission. So how do users A and B use the RSA algorithm to transfer keys? 1: A generates a key K, encrypts k with the public key of B, and sends the resulting ciphertext to B. 2: B decrypts the received key with its own private key, the key can be obtained. (Thanks to the user's reminder, has been modified)

DH AlgorithmThe DH algorithm appears to be used for key transmission. The DH algorithm is implemented based on discrete logarithm. How do users A and B use the RSA algorithm to transfer keys? Before the communication, the user A and B mutually agreed 2 large integers n and g, of which 1, the two integers can be exposed 1) a randomly produces a large integer a, and then calculates KA=GA mod n. (a requires secrecy) 2) b randomly produces a large integer b, then calculates KB=GB mod n. (b need to be confidential) 3) A to send Ka to b,b to send KB to A4) a calculation k=kba mod n5) b calculation k=kab mod n due to Kba mod n= (GB mod n) a mod n= (GA mod n) b mod n, so can be guaranteed The k is the same for both parties, and K is the shared key.

The principle of "turn" two asymmetric algorithms: RSA and DH

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.