How to prepare PDF for digital certificate on iOS

I'm looking for guidance on how to prepare a PDF for inserting a digital certificate on iOS without a commercial 3rd party tool.

The idea is to... Set up a signature annotation with PDFKit, Set up/prepare the PDF with the required information (contact info, adbe.pkcs7.detached, the Adobe.PPKLite filter , info/annotation reference, the UTC time, etc.) Pad the content area with zeros (I believe it would 4096 Then compute the hash.

I am following Adobe's Spec (Acrobat_DigitalSignatures_in_PDF)

  • Would this be possible with parsing out and adding the data from a byte stream?

  • Can I simply build the signature object on my own and place them into the PDF, or are there any other items I need to change.

  • Are there any tools out there that can help me manipulate the data and/or get the document hash easily?

For example the data would look something like this is...

<</ByteRange [0 552215 560537 907]                        /ContactInfo (my contact info)/Contents < 
AREA OF ZERO PADDING FOR CERT INSET)
00>/Filter /Adobe.PPKLite/M (D:20240223095734Z)/Reason (Some reason)/Reference [<</Data 13 0 R/TransformMethod/FieldMDP/TransformParams 39 0 R/Type/SigRef>>]/SubFilter /adbe.pkcs7.detached/Type /Sig>>

Thank you