I am generating PDF's in my app. I want to give the best security to these pdf's generated through my app. I have added the default security options provided by Apple, like Owner password, allow copying, allow printing etc...
But I would like to add my certificate information or call it as Digitally sign the pdf's using the custom certificate(X.509 certificate) files.
Does security framework help in any way ? or How can this be achieved?
Unfortunately, iOS doesn't seem to provide this feature natively. Searching for a library that will apply a digital signature to a PDF is difficult, as many tools apply pictures of handwritten signatures. There doesn't seem to be any in C or Objective-C that you could use on iOS, most implementations are in Java or C#, or are not available for iPhone (e.g. Acrobat SDK or PLOP DS).
You can nevertheless implement the digital signature yourself, this is quite straightforward and documented. You will need to serialize your PDF as mentioned in this document, make some room for the signature object (this requires a minimum parsing of the PDF layout), then compute the signature and store it in the file.
For the cryptographic part, it seems that Security Framework does not provide an API to generate the required PKCS#7 signature. So you could use OpenSSL instead.
来源:https://stackoverflow.com/questions/19901417/how-to-digitally-sign-a-pdf-using-x-509-certificate-data-from-ios-application