当前位置:网站首页>Quickly understand the commonly used asymmetric encryption algorithm, and no longer have to worry about the interviewer's thorough inquiry
Quickly understand the commonly used asymmetric encryption algorithm, and no longer have to worry about the interviewer's thorough inquiry
2022-06-23 13:17:00 【51CTO】
interviewer : Tell me about your common encryption algorithms ?
Encryption algorithms are usually divided into two types : Symmetric encryption algorithm and Asymmetric encryption algorithm . among , Symmetric encryption algorithm uses the same key for encryption and decryption ; Asymmetric encryption algorithm uses different keys for encryption and decryption , It is divided into public key and private key . Besides , There is also a class called Message digest algorithm , It is an irreversible algorithm for summarizing data .
This time we will learn about asymmetric encryption algorithm .
Asymmetric encryption algorithm
Asymmetric encryption algorithm uses two different keys for encryption and decryption , One of the keys that can be made public is called Public key , Another fully secret key is called Private key . Only the same public key and private key pair can be encrypted and decrypted normally .
For the same public and private key pair , If you use the public key to encrypt the data , Only the corresponding private key can be used for decryption ; If you use a private key to encrypt data , Only the corresponding public key can be used for decryption .
The common asymmetric encryption algorithms are :RSA Algorithm 、DSA.
RSA Algorithm
RSA The algorithm is the most influential public key encryption algorithm at present , It consists of Ron Rivest、Adi Shamir and Leonard Adleman Three big men are 1977 It was put forward together when working at the Massachusetts Institute of technology in ,RSA It's a combination of the three of them .

in addition ,1973 year , A mathematician working at the British government communications headquarters Clifford Cocks An equivalent algorithm is proposed in an internal file , But the algorithm is classified , until 1997 It was only in .
RSA The algorithm utilizes two number theoretic properties :
- p1、p2 For two prime numbers , n=p1 * p2. It is known that p1、p2 seek n Simple , It is known that n seek p1、p2 It is difficult to .
- (m^e) mod n=c, It is known that m、e、n seek c Simple , It is known that e、n、c seek m It is difficult to .
Public and private key generation process : Randomly select two prime numbers p1、p2,n=p1 * p2, And then randomly select one and φ(n) Coprime and less than φ(n) The integer of e, And then calculate e about φ(n) The modulo inverse elements of d, Finally get n and e For public key ,n and d For private key .
The encryption process :(m^e) mod n = c, among m In plain text ,c For the cipher ,n and e For public key .
The decryption process :(c^d) mod n = m, among m In plain text ,c For the cipher ,n and d For private key .
We use it Java Write an example :
The operation results are as follows :
RSA The algorithm solves the problem that the security of symmetric algorithm depends on the same key . however ,RSA The algorithm is computationally quite complex , Poor performance 、 Far less than symmetric encryption algorithm . therefore , In general practice , Asymmetric encryption algorithms are often used to randomly create temporary symmetric keys , Then a large number of... Are transmitted through symmetric encryption 、 Subject data .
DSA
DSA(Digital Signature Algorithm, Digital signature algorithm ) yes Schnorr and ElGamal A variety of signature algorithms , Complexity based on modulo arithmetic and discrete logarithm .
National institute of standards and technology (NIST) On 1991 Proposed in DSA For its DSS(DigitalSignature Standard, Digital signature standard ), And in 1994 It was regarded as FIPS 186 use .
and RSA The algorithm uses public key encryption and private key decryption in different ways ,DSA Use the private key to encrypt the data to generate a digital signature , Then the decrypted data is compared with the original data using the public key , To verify the digital signature .
Digital signatures provide information authentication ( The recipient can verify the source of the message ), integrity ( The receiver can verify that the message has not been modified since it was signed ) And non repudiation ( Senders cannot falsely claim that they have not signed the message ).
We use it Java Write an example :
The operation results are as follows :
adopt Java You can see the example of , The private key will not be directly encrypted to the data , Instead, the data is summarized through the information summarization algorithm , Then encrypt the private key of the summary information .
summary
Asymmetric encryption algorithm uses two different keys for encryption and decryption , They are called public key and private key respectively , Only the same public key and private key pair can be encrypted and decrypted normally .
The common asymmetric encryption algorithms are :RSA Algorithm 、DSA.RSA The algorithm mainly encrypts the data with public key ,DSA Mainly for signature verification of data .
边栏推荐
- R语言使用nnet包的multinom函数构建无序多分类logistic回归模型、使用回归系数及其标准误计算每个系数对应的Z统计量的值、使用pnorm函数计算Z统计量对应的p值判断变量的显著性
- What should testers do if the requirements need to be changed when the project is half tested?
- R语言glm函数使用频数数据构建二分类logistic回归模型,分析的输入数据为频数数据、将频数数据转化为正常样本数据(拆分、裂变为每个频数对应的样本个数)
- Configure SSH Remote Login for H3C switch
- What are the criteria for judging the end of the test?
- Ablebits Ultimate Suite for Excel
- "Developer talk" nail connector +oa approval to realize digitalization of school students' leave and work scenes
- Principle analysis of three methods for exchanging two numbers
- Homekit supports the matter protocol. What does this imply?
- Unity learning day14 -- collaboration and WWW
猜你喜欢

AAIG看全球6月刊(上)发布|AI人格真的觉醒了吗?NLP哪个细分方向最具社会价值?Get新观点新启发~

华三交换机配置SSH远程登录

Wallys/DR6018-S/ 802.11AX MU-MIMO OFDMA / 2* GE PORTS/WIFI 6e / BAND DUAL CONCURRENT

【网站架构】10年数据库设计浓缩的绝技,实打实的设计步骤与规范

Chinatown hiking: feel the strong Chinese flavor in the exotic New York

How to test the third-party payment interface?

Solve "thread 1:" -[*.collectionnormalcellview isselected]: unrecognized selector sent to instance 0x7F "

64 channel PCM telephone optical transceiver 64 channel telephone +2-channel 100M Ethernet telephone optical transceiver 64 channel telephone PCM voice optical transceiver

AssetBundle resource management

C#部分——值类型和引用类型
随机推荐
Go write file permission WriteFile (filename, data, 0644)?
What are the risks of opening a mobile account? Is it safe to open an account?
The GLM function of R language uses frequency data to build a binary logistic regression model. The input data for analysis is frequency data, which is transformed into normal sample data (split and s
R语言dplyr包mutate_all函数将dataframe中的所有数值数值列(变量)乘以某一固定值并生成新的数据列,为新的数据列(变量)指定自定义后缀名称
Dataset之GermanCreditData:GermanCreditData数据集的简介、下载、使用方法之详细攻略
Technology sharing | wvp+zlmediakit realizes streaming playback of camera gb28181
[website architecture] the unique skill of 10-year database design, practical design steps and specifications
CDH mail alarm configuration
#云原生征文#深入了解Ingress
New project, how to ensure the coverage of the test?
SQL adds the problem of duplicate table records.
R语言使用MatchIt包进行倾向性匹配分析(设置匹配方法为nearest,匹配倾向性评分最近的对照组和病例组,1:1配比)、使用match.data函数构建匹配后的样本集合
React query tutorial ④ - cache status and debugging tools
Hanyuan hi tech 1-channel gigabit optical port to 4-channel Gigabit Ethernet electrical port Gigabit 1-optical 4-electric optical fiber transceiver
MySQL使用ReplicationConnection导致的连接失效分析与解决
Esp32-c3 introductory tutorial problem ⑦ - fatal error: ESP_ Bt.h: no such file or directory ESP not found_ bt.h
唐人街徒步:在异国情调的纽约感受浓厚的中式气息
Broadcast level E1 to aes-ebu audio codec E1 to stereo audio XLR codec
华三交换机配置SSH远程登录
腾讯的技术牛人们,是如何完成全面上云这件事儿的?