0

My document is on server and user wants to sign that with USB token which contains DSC, Currently I am able to sign the document with following approach.

1 Client raise a document sign request.

2 Server generates document Hash, stores Signature appearance and BinaryArrayOutputStream object in session.

3 Client signs the document Hash and creates PKCS7 and send it to server.

4 Server embeds PKCS7 to PDF using SignatureAppearance and BinaryArrayOutputStream object stored in session. Now I have the signed PDF.

5 Server returns a response to the client and client shows a hyperlink to user get the signed copy of PDF.

My file size is too large and I don't want to store the above mentioned objects in session, what are other alternatives to achieve this ? Currently I am using IText 5.5.13.

dpilwal
  • 361
  • 1
  • 5
  • 14
  • If you use the `PdfReader` in partial mode and provide the temp file parameter when creating the signing `PdfStamper` in append mode, the memory footprint is fairly small, cf. [this answer](https://stackoverflow.com/a/30479556/1729265). – mkl Sep 07 '18 at 13:38
  • @mkl Ohh I missed that, thanks a lot. I will try it . – dpilwal Sep 07 '18 at 13:57
  • @mkl In client server architecture, what happens with the temporary file when due to any reason the transaction is not completed, i.e the objects stored in session are not closed. In ideal scenario, everything is working fine with the above mentioned approach, but in case of incomplete transactions, temporary file objects are kept locked by Java container. What do you suggest to overcome this issue? – dpilwal Sep 11 '18 at 11:05

0 Answers0