Robert,
please reply to the list.
RobertQ wrote:
>
> How are you? You repplied my post "Verifying signature!!
> NoSuchAlgorithmException: 1.2.840.113549.1.1.1" suggesting me this:
>
> mkl wrote:
>>
>> Use the AcroFields methods getSignatureNames and getSignatureDictionary.
>> The latter dictionary contains the signature container (key:
>> PdfName.CONTENTS, apply getOriginalBytes) and the range data (key:
>> PdfName.BYTERANGE). Use something like the class
>> PdfSignatureAppearance.RangeStream to extract the signed data.
>>
>
> What I tryied to do is the following:
>
> PdfReader reader = new PdfReader(new
> RandomAccessFileOrArray("temp.pdf"), null);
> AcroFields acrFs = reader.getAcroFields();
>
> PdfDictionary dic = acrFs.getSignatureDictionary("Signature1");
>
> PdfObject sigContainer = dic.get(PdfName.CONTENTS);
> PdfObject rangeData = dic.get(PdfName.BYTERANGE);
>
> But it didn't work out, I stopped at this point.
> Can you send me an example code of what you suggested.
>
What exactly didn't work out?
Obviously you have to inspect the individual attributes more thoroughly,
e.g.:
((PdfString)PdfReader.getPdfObject(dic.get(PdfName.CONTENTS))).getOriginalBytes()
contains the signature container and some trailing debris, most often filled
with 0 bytes.
(PdfArray)PdfReader.getPdfObject(dic.get(PdfName.BYTERANGE)) will give you
the byterange array; you might want to use this array in concert with a
class like PdfSignatureAppearance.RangeStream to extract the signed data
stream.
And obviously you should do some sanity checks (e.g. for null values) in
production code...
Regards, Mikel.
--
View this message in context:
http://www.nabble.com/Verifying-signature%21%21-NoSuchAlgorithmException%3A-1.2.840.113549.1.1.1-tp23673079p23827739.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php
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/