msinatl,

msinatl wrote:
> I am using the example from Chapter 12
> (http://itextpdf.com/examples/iia.php?id=225) for signing using a
> timestamp and OCSP.
> 
> On the line where estimated space is declared:
> 
> // preserve some space for the contents
> int contentEstimated = 15000;
> 
> What is the source of that number, 15000?  I am inclined to replace it
> with the number of bytes in my content input stream.  Am I mistaken?

You're mistaken. This is not the estimated size of your initial content
(which you do know the size of, at least if signing in append mode, and
therefore do not have to guess) but the estimated size of the PKCS#7
signature structure (which you do not know the size of in advance). The name
of the variable is a bit misleading; it quite likely is due to the fact that
the signature eventually is stored as value for the key /Contents in some
dictionary.

Depending on your use case you might try to cut down this estimate, 15000
bytes generally sounds quite reasonable, though.


msinatl wrote:
> I ask because a PDF that was previously 201 Kb when signing without a
> timestamp is now 7.7 Mb when signing (five signatures) with the timestamp. 
> Is this expected?  That seems extreme.

As Andreas already answered, more than 7 MB for 5 signatures is extreme.

Generally you have to expect twice the expected signature size (due to hex
encoding) plus a very few bytes. If you have a visible signature, add the
bytes required for that visual representation. If you use some high
resolution image in that representation, this will result in your file
growing quite a bit.

If you used the size of the document you sign as value of contentEstimated,
that would explain quite a bit of growth, as during each signing process
your PDF would more than triple its size. 3^5 * 210 KB is some 50 MB, thus
this is not exactly what you have done, though.

Regards,   Michael.
-- 
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Estimated-space-signing-with-timestamp-tp2537612p2538520.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
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