I'm developing an iOS app (Swift) that will digitally sign PDF files. The following steps explain what it needs to do and how it will be used:
- The user will open a PDF with my app.
- My app will send a digest (SHA-256) of that PDF to a signature server.
- The signature server will sign the digest and return a PKCS#7 signature.
- My app has to embed the returned signature into the PDF.
In short, I need an iOS library that can embed a PKCS#7 digital signature into a PDF file. Please see detailed requirements below.
- It needs to be a free library with license that enables usage on commercial products (my client doesn't want to buy a commercial solution).
- It needs to work on iOS platform.
- To be able to successfully sign a PDF, it has to:
- Generate the signature field on PDF.
- Generate the signature dictionary (generate PDF object and define byte range).
- Embed the PKCS#7 signature into the signature dictionary.
What I have tried
I found some commercial libraries that do what I need, like:
And other commercial libraries that aren't native to iOS, but I can bridge with:
And also libraries that doesn't work on iOS environment:
Besides that, I came across many documentations explaining the theoretical part of PDF signing and PDF in general: