CryptoAPI and PKCS#7 objects (for PDF signature)
- From: "idly" <alain.serrano@xxxxxxxxx>
- Date: 9 Jun 2006 02:09:30 -0700
Hello!
I need to programmatically sign a PDF file with Visual C++ 6.
There are two ways to do that:
(1st way) insert in the PDF file a DER-encoded PKCS#1 object containing
a SHA1 hash of a byre range of the PDF file. I succeeded doing it,
after a long research (and thanks to the newsgroups):
1) create a SHA1 hash of the byte range, using CryptCreateHash and
CryptHashData
2) sign the hash with my certificate using CryptSignHash
3) reverse the bytes in order to obtain a valid PKCS#1 signature
4) DER-encode the result using CryptEncodeObject
The certificate is included somewhere else in the PDF file.
This works.
(2nd way) insert in the PDF file a DER-encoded PKCS#7 object containg
both the SHA1 hash and the certificate. This object can also include a
time stamp.
Since I would like to include a time stamp into my PDF file, I would
like to be able to use this 2nd way. But I can't find how to create a
PKCS#7 object that contains several objects. Do you know if there is a
way to do such a thing using CryptoAPI?
Thanks a lot!
Alain Serrano.
.
- Follow-Ups:
- Re: CryptoAPI and PKCS#7 objects (for PDF signature)
- From: Innokentiy Ivanov
- Re: CryptoAPI and PKCS#7 objects (for PDF signature)
- Prev by Date: Mapping Home Directory using custom GINA - Disconnected Network Drive
- Next by Date: Display certificate list using Visual C++ 6
- Previous by thread: Mapping Home Directory using custom GINA - Disconnected Network Drive
- Next by thread: Re: CryptoAPI and PKCS#7 objects (for PDF signature)
- Index(es):
Relevant Pages
|
|