BTW, you might not need to use xmlSecCryptoAppKeyLoadMemory function at all. Instead, you can create key directly from the PCCERT_CONTEXT: http://www.aleksey.com/xmlsec/api/xmlsec-mscrypto-certkeys.html#XMLSECMSCRYPTOCERTADOPT Aleksey