I need to sign xml using xmlSecDSigCtxSign. I need to create xmlSecDSigCtxPtr using xmlSecDSigCtxCreate method. I have PCCERT_CONTEXT found by CertFindCertificateInStore(). I'm calling xmlSecCryptoAppKeysMngrCertLoadMemory with success, signKey in xmlSecDSigCtx is NULL. I'm feeling that I'm doing something wrong.
HCERTSTORE hStore = NULL;
hStore = CertOpenStore(CERT_STORE_PROV_SYSTEM, 0, 0, CERT_SYSTEM_STORE_CURRENT_USER, storeName.c_str());//storeName.c_str());
PCCERT_CONTEXT pContext = NULL;
pContext = CertFindCertificateInStore(hStore,
X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0, CERT_FIND_HASH,
&hashBlob, NULL);
xmlSecCryptoAppKeysMngrCertLoadMemory(mngr, pContext->pbCertEncoded, pContext->cbCertEncoded, xmlSecKeyDataFormatDer, xmlSecKeyDataTypeTrusted);
xmlSecDSigCtxPtr dsigCtx = xmlSecDSigCtxCreate(mngr);
xmlSecDSigCtxSign(dsigCtx, signNode);
May be I can init xmlsec specifying store? Please, help.