Home > Common Problem > body text

What are the security mechanisms used to implement authentication?

烟雨青岚
Release: 2020-07-06 14:43:42
Original
14267 people have browsed it

The security mechanisms used to achieve identity authentication are: encryption mechanism and digital signature mechanism. Encryption is to use a special algorithm to change the original information data, so that even if unauthorized users obtain the encrypted information, they still cannot understand the content of the information; all data interface requests of the signature mechanism must pass in a digital signature. The signature uses the "MD5" 32-bit specification.

What are the security mechanisms used to implement authentication?

The security mechanisms used to achieve identity authentication are encryption mechanisms and digital signature mechanisms.

Encryption is to use a special algorithm to change the original information data, so that even if unauthorized users obtain the encrypted information, they still cannot decrypt it because they do not know the method. Understand the content of the message. In aeronautics, it refers to the operation of using a small number of known control points on aerial photography photos to add control points to the image pair or the entire aerial photography belt by measuring and calculating the photos.

Signature mechanism

All data interface requests must pass in a digital signature, and the digital signature uses the MD5 32-bit specification.

Signature algorithm calculation rules:

sign= ((noncestr + openid + PublicKey + timestamp).MD5()+ PrivateKey).MD5().ToLower();
Copy after login

Step one:

//拼接字符串
String str1 = (随机字符串noncestr + 开放平台openid + 公钥PublicKey+ 时间戳timestamp);
//对str1进行md5运算之后得到str1MD5;
String str1MD5 = str1.MD5();
Copy after login

Step two:

//第二次拼接字符串
String str2 = (第一步得到的str1MD5 + 私钥PrivateKey);
//对str2进行md5运算之后并转换为小写的32位
String sign = str2.MD5().ToLower();
Copy after login

All requests require incoming numbers Sign, the system will verify that the digital signature is correct before making other responses.

Example:

Openid:IOS1101
Timestamp:1439950776
Noncestr:xy19102724
PrivateKey: defe97621eef237896e489228fb68786
PublicKey: 38dae8d211692021116dd85793487f6b
Copy after login

Correct sign: 6f2573587a4ca0379d32a8975014cc0f

For more related knowledge, please visit PHP Chinese website! !

The above is the detailed content of What are the security mechanisms used to implement authentication?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!