Hi, I'm trying to
sign a pdf document using external hash and signature.
I
notice that if i hash the same document (the result of the method
getRangeStream() ) twice, i obtain two different
digests.
I suppose that this
is becouse the pdf signature methods introduce some randomness into the document
before hashing it.
This is a problem in
this case:
- i generate a hash
x of the document d
- i send the hash x
to a user to make it signed
- i receive the
signed hash x and i want to build a signed pdf document with
it.
the signed value and
the hash x in the method setExternalDigest, i obtain an invalid
signature, becouse the hash calculated by
the
PdfAppearence methods is different from the hash
x.
Is there a
method to rebuild the document corrisponding to the hash x and to compose a
valid pdf signature?
(in some way i
want to get the randomness, apply it to the original pdf document, and build the
pdf signature structure).
Thanks
Francesca
Merighi