CryptoAPI and PKCS#7 objects (for PDF signature)



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.

.



Relevant Pages

  • Re: Digitally Sign PDF with CAPICOM Certificate
    ... I have a problem regarding the signing of pdf files from another ... The popup returns a CAPICOM Certificate object ... and that can sign a PDF file using a CAPICOM certificate without ...
    (microsoft.public.platformsdk.security)
  • PDF problem..
    ... this via the USPS Electronic Postmark (EPM) SDK. ... Our original intent was to ... The ideal soluton would be to somehow incorporate the EPM certificate into ... to accomplish this with respect to handling the PDF file? ...
    (borland.public.delphi.thirdpartytools.general)