I'm interested in trying to read fields out of a digital signature. I have code that calls CryptQueryObject, then CryptMsgGetParam to get some fields and finally CertFindCertificateInStore to load the certificate.
Any hints on how to do this using the Cryptography Next Generation APIs? Microsoft tells me CryptQueryObject is deprecated but doesn't point to its replacement.
CryptDecodeObject[Ex]
is not marked as deprecated. Just sayin'.
You can emulate the logic of detecting the blob type by calling CryptDecodeObjectEx
in a loop with different object types to see which one doesn't error out.
That said, if you use CryptQueryObject
to parse a file/data block (as opposed to detecting its type), and you have a good idea what that is, see if there's a subject type constant for your data block under https://learn.microsoft.com/en-us/windows/win32/seccrypto/constants-for-cryptencodeobject-and-cryptdecodeobject
In general, CryptoAPI functions that deal with ASN.1 data structures (certs, CSRs, CRLs and the like) are not deprecated and have no counterpart in CNG API. Maybe this one was marked as deprecated by mistake.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With