当前位置:网站首页>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 .
边栏推荐
- #yyds干货盘点# 解决剑指offer: 判断是不是平衡二叉树
- PHP handwriting a perfect daemon
- C#部分——值类型和引用类型
- Hanyuan hi tech 8-way telephone +1-way 100M Ethernet RJ11 telephone optical transceiver 8-way PCM telephone optical transceiver
- js: 获取页面最大的zIndex(z-index)值
- 面试题:举例说一下工作中你的接口测试是怎么做的?
- Part C - value types and reference types
- Solution: argument type 'string' expected to be an instance of a class or class constrained type
- 美国的国家公园概览
- 唐人街徒步:在异国情调的纽约感受浓厚的中式气息
猜你喜欢
[email protected] Hdmi2.0 optical transceiver HDMI HD video optical transceiver"/>4k-hdmi optical transceiver 1 channel [email protected] Hdmi2.0 optical transceiver HDMI HD video optical transceiver

那些技术实战中的架构设计方法

Broadcast level E1 to aes-ebu audio codec E1 to stereo audio XLR codec

Analyse et résolution des défaillances de connexion causées par MySQL utilisant replicationconnection

Hanyuan high tech USB3.0 optical transceiver USB industrial touch screen optical transceiver USB3.0 optical fiber extender USB3.0 optical fiber transmitter

MySQL使用ReplicationConnection导致的连接失效分析与解决

AssetBundle resource management

Part C - value types and reference types

首次曝光!唯一全域最高等级背后的阿里云云原生安全全景图

2 万字 + 30 张图 |MySQL 日志:undo log、redo log、binlog 有什么用?
随机推荐
Capacity limited facility location problem
MySQL使用ReplicationConnection導致的連接失效分析與解决
Solve "thread 1:" -[*.collectionnormalcellview isselected]: unrecognized selector sent to instance 0x7F "
解决:Argument type ‘String‘ expected to be an instance of a class or class-constrained type
C# 文件下载方式
Follow the promotional music MV of domestic tour in Thailand and travel to Bangkok like local people
Tt-slam: dense monocular slam for flat environment (IEEE 2021)
4k-hdmi optical transceiver 1 channel [email protected] Hdmi2.0 optical transceiver HDMI HD video optical transceiver
A bug development means that the user will not operate like this, and there is no need to repair it. How should testers respond?
js: 获取页面最大的zIndex(z-index)值
R语言dplyr包arrange函数排序dataframe数据、通过多个数据列排序dataframe数据(默认是升序排序)
Analysis and solution of connection failure caused by MySQL using replicationconnection
C#部分——值类型和引用类型
Homekit and NFC support: smart Ting smart door lock SL1 only costs 149 yuan
企业该如何进行高效IT运维管理?
"Developer talk" nail connector +oa approval to realize digitalization of school students' leave and work scenes
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
SQL adds the problem of duplicate table records.
R语言将距离矩阵输入给hclust函数进行层次聚类分析,使用cutree函数进行层次聚类簇的划分、参数k指定聚类簇的个数、给每个样本都分配了簇标签
What if the test time is not enough?