简体   繁体   中英

How to check ECDSA (on p-256) signature using public key from certificate

I have certificate and ECDSA (on p-256) signature. Now i want to verify this signature using provided certificate. I use c++ (on Windows). Managed code (.NET) can't be used. I found that CryptoAPI doesn'r support ECDSA, so i should use CryptoAPI NG (CNG). However i can't find how to import public key from certificate to the CNG.

Can you help with my problem? Thanks

Issue was solved. I use OpenSSL for this purpose.

"The CryptImportPublicKeyInfoEx2 function imports a public key into the CNG asymmetric provider..."

My C may be a bit off, but I believe it to be something like

BCRYPT_KEY_HANDLE hKey;
BOOL imported = CryptImportPublicKeyInfoEx2(
    X509_ASN_ENCODING,
    &(pCertContext->pCertInfo->SubjectPublicKeyInfo),
    0,
    NULL,
    &hKey);

if (!imported)
    goto :err;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM