CryptoAPI digital signature and OpenSSL verification signature

Source: Internet
Author: User
During this period, an authentication protocol is implemented, which can be divided into the client and the server. The client uses the Windows operating system, the server uses the Linux operating system, and the client (Windows ), use the signature certificate in the Windows certificate library to sign the message (use the Windows crypto Library), and then use the OpenSSL library

During this period, an authentication protocol is implemented, which can be divided into the client and the server. The client uses the Windows operating system, the server uses the Linux operating system, and the client (Windows ), use the signature certificate in the Windows certificate library to sign the message (use the Windows crypto Library), and then use the OpenSSL library to verify the signature value on the server (Linux ~~

The client uses the function interface:

CertOpenSystemStore-open the system certificate library

CryptUIDlgSelectCertifiCatEFromStore-select a certificate from the certificate library to obtain the certificate Context

CertGetCertificateContExTProperty-obtain the secret container name corresponding to the CRYPT_KEY_PROV_INFO structure of the CERT_KEY_PROV_INFO_PROP_ID attribute.

CryptAcquireContext-connect to the key container

CryptCreateHash-create a Hash object

CryptHashData-obtain the Hash value

CryptSignHash-sign the Hash value to obtain the signature Value

The server uses the function interface:

D2i_X509_bio-generate an x509 Certificate from the encoded Certificate

X509_get_pubkey-get the public key from the x509 Certificate

EVP_MD_CTX_init-Initialize ctx

EVP_VerifyInit_ex-verify the signature

EVP_VerifyUpDate

EVP_VerifyFinal

There is a key point here: the signature value generated by the crypto library must be reversed before it can be verified by the OpenSSL library ~~ Remember ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.