I need to sign XML using xmlsec and certificate provided by csp. (C++, Linux only) Here is the simplified code.
HCERTSTORE hStore = NULL;
hStore = CertOpenStore();
PCCERT_CONTEXT pContext = CertFindCertificateInStore(hStore...);
//xml preparation using libxml2
xmlSecKeyPtr signKey = xmlSecKeyCreate();
xmlSecDSigCtxPtr dsigCtx = xmlSecDSigCtxCreate(mngr);
dsigCtx->signKey = ???; // How to set sign key?
xmlSecDSigCtxSign(dsigCtx, signNode);
How to set signkey? How to extract it from cert? In Java it's done by CryptAcquireCertificatePrivateKey with cryptSetProvParam setting password. But in Linux no success with this call.