当前位置:网站首页>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 .
边栏推荐
- 能把SAP系统玩成鸡肋的公司,太有才了!
- 2 万字 + 30 张图 |MySQL 日志:undo log、redo log、binlog 有什么用?
- The project experience of resume and several problems that testers should pay attention to in writing
- Network foundation and framework
- 同花顺网上开户安全吗,需要注意什么
- Is it safe for flush to open an account online? What should we pay attention to
- R语言使用构建有序多分类逻辑回归模型、ordinal.or.display函数获取有序逻辑回归模型的汇总统计信息(变量对应的优势比及其置信区间、以及假设检验的p值)、汇总统计结果保存到csv
- sql增加表记录的重复问题。
- js: 获取页面最大的zIndex(z-index)值
- First exposure! The only Alibaba cloud native security panorama behind the highest level in the whole domain
猜你喜欢

Cloud native essay deep understanding of ingress

User behavior modeling

Go寫文件的權限 WriteFile(filename, data, 0644)?

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

Germancreditdata of dataset: a detailed introduction to the introduction, download and use of germancreditdata dataset

Architecture design methods in technical practice

Homekit and NFC support: smart Ting smart door lock SL1 only costs 149 yuan

What if the test time is not enough?
![解决“Thread 1: “-[*.CollectionNormalCellView isSelected]: unrecognized selector sent to instance 0x7f”](/img/35/65511c49eca5ae8a1896d776b479d9.jpg)
解决“Thread 1: “-[*.CollectionNormalCellView isSelected]: unrecognized selector sent to instance 0x7f”

windows 安装 MySQL
随机推荐
企业该如何进行高效IT运维管理?
在线文本过滤小于指定长度工具
【网站架构】10年数据库设计浓缩的绝技,实打实的设计步骤与规范
What are the criteria for judging the end of the test?
华三交换机配置SSH远程登录
那些技术实战中的架构设计方法
R语言将距离矩阵输入给hclust函数进行层次聚类分析,使用cutree函数进行层次聚类簇的划分、参数k指定聚类簇的个数、给每个样本都分配了簇标签
How should enterprises conduct efficient IT operation and maintenance management?
Capacity limited facility location problem
服务稳定性治理
Ablebits Ultimate Suite for Excel
20000 words + 30 pictures | MySQL log: what is the use of undo log, redo log and binlog?
Principle analysis of three methods for exchanging two numbers
"Developer talk" nail connector +oa approval to realize digitalization of school students' leave and work scenes
2 万字 + 30 张图 |MySQL 日志:undo log、redo log、binlog 有什么用?
R language uses matchit package for propensity matching analysis (set the matching method as nearest, match the control group and case group with the closest propensity score, 1:1 ratio), and use matc
R语言dplyr包mutate_all函数将dataframe中的所有数值数值列(变量)乘以某一固定值并生成新的数据列,为新的数据列(变量)指定自定义后缀名称
夏日炎炎玩转新加坡:盘点室内景点和夜游好去处
美国的国家公园概览
What are the risks of opening a mobile account? Is it safe to open an account?