CAPICOM sign file directly using spc store and pkv private key file
- From: "Tech" <support@xxxxxxxxxxxxxxxxxxx>
- Date: Sat, 9 Jun 2007 15:37:47 -0700
is there a way to:assign in CAPICOM Signer object a certificate and private
key?
ok I open a certificate store, actually - create one and load certificates
fom file
hr =
ptrStore->Open(CAPICOM::CAPICOM_CURRENT_USER_STORE,"MyStorage",CAPICOM::CAPICOM_STORE_OPEN_READ_WRITE);
hr =
ptrStore->Load(bstrSPCFile,bstrPassword,CAPICOM::CAPICOM_KEY_STORAGE_USER_PROTECTED);
then select my certificate
ptrCertificates = ptrStore->Certificates;
ptrCertificate = (CAPICOM::ICertificate2Ptr)ptrCertificates->GetItem(1);
then assign my certificate to the signer object, build chain
ptrSigner->Certificate = ptrCertificate;
ptrSigner->Chain->Build(ptrCertificate);
Now I want to load private key from pvk and assign it to selected
certificate.
CAPICOM::IPrivateKeyPtr ptrPrivateKey;
hr = ptrPrivateKey.CreateInstance( __uuidof( CAPICOM::PrivateKey ) );
// or yes I do this also later
// associate private key
ptrCertificate->PrivateKey = ptrPrivateKey;
Assuming I am sucessfull in parsing undocumented PVK file format, getting
the CRYPTOBLOB data
how do I fill in all data in ptrPrivateKey CAPICOM object? Or it is not
possible at all via CAPICOM?
Or am I on a wrong track here altogether? Any way to do this straight from
CryptoAPI, samples are welcomed since I am stuck on filling this PrivateKey
object step.
TECH
http://www.tversoft.com
.
- Prev by Date: Re: Digitally Sign PDF with CAPICOM Certificate
- Next by Date: Re: KERB_SMART_CARD_LOGON
- Previous by thread: Re: Digitally Sign PDF with CAPICOM Certificate
- Next by thread: Re:gina inituser problem
- Index(es):
Relevant Pages
|