Current location - Quotes Website - Signature design - How does php do digital signature?
How does php do digital signature?
The summary is: "Learn to use openssl extensions of PHP! ! "

1. First, use the openssl_pkey_new () function to generate a private key pri_key.

2. Use openssl_csr_new () function to generate a letter of credit csr with private key pri_key.

3. Use openssl_sign () function to generate a digital signature for a piece of data with private key pri_key.

4. Use the openssl_pkey_get_public () function to get the public key pub_key from the letter of credit csr.

5. Send the public key pub_key, digital signature and data data to the other party.

6. After the other party receives three items, use openssl_verify () function or other verification tools to verify the signature.

7. The other party verifies that it is valid and starts to use your information and data. If the verification fails, I'll argue with you again.

The whole process can be interchanged, that is, the other party can issue three items for your verification.