Extracts a key from a specified certificate context obtainable from any of the CryptoAPI methods returning the CERT_CONTEXT structure.
IXMLDSigKeyPtr keyRef = objIXMLDigitalSignatureEx->createKeyFromCertContext(pCertContext);
HRESULT createKeyFromCertContext( void* pCertContext, IXMLDSigKey** keyRef);
keyRef
parameter points to a valid XMLDSigKey
object.keyRef
parameter is NULL.This method can be used to access a private key for signing and is available for C/C++ applications only.
This C/C++ example illustrates how to sign an XML document with a key generated from a certificate context stored on your local machine. Generation of the key is encapsulated in the function GetCertContext
, which uses three CryptoAPI functions: CertOpenSystemStore
, CertFindCertificateInstore
, and CertClosestore
.
This example uses one resource file. You should get output similar to that provided at the end of the sample.
MSXML 5.0 and later
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button in the upper-left corner of the page.
createKeyFromCSP Method | createKeyFromHMACSecret Method | createKeyFromHMACSecretBinary Method | createKeyFromNode Method