When using smartcard then it works differently. There is an external
digest that is encrypted. This digest is a an hash across the PDF byte
range. For that purpose iText exposes method SetExternalDigest. Now I
being confused: if hash is already calculated and signed then it's
impossible to add any OCSP response to PdfPKCS7 object, right ? This
will invalidate signature. If second digest is calculated across
signature itself then what method must be used to retrieve those bytes ?
And what private key will be used to encrypt it, is it digital id or
must it be done on smartcard ?

> Sorry, but due to other requirements we do most of the crypto stuff
outside of iText and so I'm not very familiar with the method you
mentioned.
> But a short look atv the code tells me that the 'second digest' is the
digest that is build across the PDF byte range that becomes an
authenticated attribute. I guess the word 'second' denotes the contrast
to the 'first' digest that is calculated across the signature itself and
will be encrypted by the private key.
> 
> Good luck
> 
> Andreas
> 
>  
> ----- Original Message ----
> From: Whatever <[email protected]>
> To: [email protected]
> Sent: Wed, April 7, 2010 8:16:45 AM
> Subject: Re: [iText-questions] OCSP digest
> 
> Andreas, thank you for your thoughts. I need to include revocation
> information before signing on smartcard. Haven't figured out how to
> achieve this. PDF reference says "... it must be obtained before the
> computation of the digital signature". How to embed OCSP response
before
> creating signature ? That is the question. Examples available use
> digital id for doing that.
> 
> iText's implementation won't include OCSP response unless there is a
> magical second digest argument supplied when calling GetEncodedPKCS7.
> That magical digest is calculated over signature appearance and there
is
> no RSA data involved. If I use smartcard then there is RSA data
involved
> and I can't use iText implementation, can I ? Am I wrong ?
> 
> > Hi,
> > 
> > your assumption seems to hold true : No one seems to be able to
aswer
> the question, but I'll try to help you a bit further :
> > 
> > The first thing to mention is that PDF expects the the OCSP
response
> to be available at signing time. So you do the OCSP call _before_ the
> hashing. And then there is no magic in putting the signed attribute
into
> the signature. There was a thread on this list regarding this topic
> about a year ago ...
> > 
> > Second point ( deriving from the first ) the OCSP response is
required
> to have a validity period longer than zero. The OCSP information is
> ignored if the signing time of the signature isn't within the
validity
> period of the OCSP response. And that's where we got stuck : The CAs
at
> hand return a OCSP response with a validity period of zero. So this
> topic is deferred until our own test CA got a responder with a
positive
> validity .... currently we didn't got a useful OCSP response in our
> signatures.
> > 
> > But if you got a CA fitting the validity period requirement I would
be
> eager to test our code with it ;-)
> > 
> > As I remember vaguely there are some more strangenesses around PDF
and
> OCSP. I would recommend to check the list's archive for it ...
> > 
> > Good luck
> > 
> > Andreas
> > 
> > ----- Original Message ----
> > From: Whatever <[email protected]>
> > To: Post all your questions about iText here
> <[email protected]>
> > Sent: Tue, April 6, 2010 1:18:51 PM
> > Subject: Re: [iText-questions] OCSP digest
> > 
> > Is there really nobody who is able to answer the question ?
> > 
> > My ultimate goal is to include OCSP response. I am using external
> digest
> > from smartcard. I have OCSP responder certificate that is issued by
> the
> > same CA that issued signing certificate. I can't include basic OCSP
> > response in the signed data because it is already signed and hash
is
> > encrypted (external digest).
> > 
> > May be itext doesn't allow all that and I need to staple the
signing
> > certificate with OCSP response
> > (http://en.wikipedia.org/wiki/OCSP_Stapling) ?
> > 
> > > Hi!
> > > 
> > > I am reading RFC 2560 regarding OCSP response... My question is
how
> > is
> > > the second
> > > digest calculated when supplying first argument to
GetEncodedPKCS7
> ?
> > Is
> > > it hash over 
> > > all BasicOCSPResponse bytes ?

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to