Search code examples
pdfitextelectronic-signature

MakeSignature.signDetached performance improvement


I am using MakeSignature.signDetached method to add digital signature in PDF.
I do sign the PDF in bulk, it works, but after each method call I have to write Thread.Sleep(500) in order to continue the process, if I do not use Thread.sleep(500) I have to replug the usb dongle.

This process takes more time to process hundreds of PDFs.

In a nutshell, I would like to know:

  1. How to improve the performace?
  2. how can I ignore Thread.Sleep statement?

Solution

  • There's a tiny smart card in your USB dongle. Many smart cards have a built-in limitation that allows you to create only one signature per second. That's why you have to use Thread.sleep(500).

    You can't improve the performance using code. If you want to improve the performance, you need to change your hardware. For instance: replace your USB dongle with a Hardware Security Module (HSM).

    This is not a question about (or for) iText. This is a question you should ask the provider of your security hardware. Buy hardware that is suited to process hundreds of PDFs instead of using a USB dongle that is created to sign documents manually, not in batch.