当前位置:网站首页>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 .
边栏推荐
- ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked.
- The R language inputs the distance matrix to the hclust function for hierarchical clustering analysis, uses the cutree function to divide the hierarchical clustering clusters, specifies the number of
- AssetBundle resource management
- 那些技术实战中的架构设计方法
- How about stock online account opening and account opening process? Is it safe to open a mobile account?
- LM05丨曾经的VIX(二代产品)
- js: 获取页面最大的zIndex(z-index)值
- 唐人街徒步:在异国情调的纽约感受浓厚的中式气息
- Meta said that the UK security law will "scan all private information", which risks infringing on users' privacy
- Esp32-c3 introductory tutorial problem ⑦ - fatal error: ESP_ Bt.h: no such file or directory ESP not found_ bt.h
猜你喜欢

夏日炎炎玩转新加坡:盘点室内景点和夜游好去处

How to test the third-party payment interface?

Architecture design methods in technical practice

Analysis and solution of connection failure caused by MySQL using replicationconnection

Configure SSH Remote Login for H3C switch

Overview of national parks in the United States

16 channel HD-SDI optical transceiver multi channel HD-SDI HD video optical transceiver 16 channel 3g-sdi HD audio video optical transceiver
![解决“Thread 1: “-[*.CollectionNormalCellView isSelected]: unrecognized selector sent to instance 0x7f”](/img/35/65511c49eca5ae8a1896d776b479d9.jpg)
解决“Thread 1: “-[*.CollectionNormalCellView isSelected]: unrecognized selector sent to instance 0x7f”

Cloud native essay deep understanding of ingress

Ablebits Ultimate Suite for Excel
随机推荐
Hanyuan high tech USB3.0 optical transceiver USB industrial touch screen optical transceiver USB3.0 optical fiber extender USB3.0 optical fiber transmitter
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
Cloud native essay deep understanding of ingress
【深入理解TcaplusDB技术】单据受理之事务执行
HomeKit支持matter协议,这背后将寓意着什么?
R language is used to build ordered multi classification logistic regression model, ordinal or. The display function obtains the summary statistical information of the ordered logistic regression mode
夏日炎炎玩转新加坡:盘点室内景点和夜游好去处
Basic data type and corresponding packing class
R language dplyr package mutate_ The all function multiplies all numeric columns (variables) in the dataframe by a fixed value to generate a new data column, and specifies a user-defined suffix name f
How to enable the SMS function of alicloud for crmeb knowledge payment
Chinatown hiking: feel the strong Chinese flavor in the exotic New York
面试题:举例说一下工作中你的接口测试是怎么做的?
C # learning (advanced course) day14 - features
R语言使用nnet包的multinom函数构建无序多分类logistic回归模型、使用回归系数及其标准误计算每个系数对应的Z统计量的值、使用pnorm函数计算Z统计量对应的p值判断变量的显著性
解决:Argument type ‘String‘ expected to be an instance of a class or class-constrained type
AssetBundle resource management
理财产品长期是几年?新手最好买长期还是短期?
The project experience of resume and several problems that testers should pay attention to in writing
Tuikit audio and video low code solution navigation page
[system architecture] - five styles of software architecture