Reputation: 700
I'm trying to extract attributes from a certificate on Windows and have been using Wincrypt api's for that.
When I encouter the SUBJECT_ALT_NAME certificate extension (szOID_SUBJECT_ALT_NAME "2.5.29.7") with the "OTHER_NAME" option - I get the CERT_OTHER_NAME struct which I cant find the correct API to decode it a char string.
Thanks!
I can see the value in it's CRYPT_OBJID_BLOB member is ASN1 decoded (UTF8 string) however CertNameToStrW fails to decode it when passing as the blob.
Any appropriate way to decode this structure (without manually decoding it)
Upvotes: 1
Views: 377
Reputation: 700
as @RbMm suggested.
Call CryptDecodeObjectEx() with X509_NAME_VALUE, it returns a CERT_NAME_VALUE that can be passed to CertRDNValueToStrW() to decode:
CertRDNValueToStrW(CertNameValue->dwValueType, &CertNameValue->Value, NULL, 0);
Upvotes: 0