Actually i am searching certificate on the basis of common name. For that we have done :-
PSTR pszCommonName = "cn.com";
CERT_RDN_ATTR certRDNAttr[1];
certRDNAttr[0].pszObjId = szOID_COMMON_NAME;
certRDNAttr[0].dwValueType = CERT_RDN_PRINTABLE_STRING;
certRDNAttr[0].Value.pbData = (PBYTE) pszCommonName;
certRDNAttr[0].Value.cbData = lstrlen(pszCommonName);
CERT_RDN certRDN = {1, certRDNAttr};
// Find the certificate context
if (pCertContext = CertFindCertificateInStore(hCertStore, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0, CERT_FIND_SUBJECT_ATTR, &certRDN, NULL))
My Store contains the desired Cert with given common name but it is not located by the api, it returns null.
Not able to find the issue.