Home  >  Article  >  What are the security mechanisms used to implement authentication?

What are the security mechanisms used to implement authentication?

烟雨青岚
烟雨青岚Original
2020-07-06 14:43:4214332browse

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();

Step one:

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

Step two:

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

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

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!

Statement:
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