如何使用iOS应用程序中的X.509证书数据对PDF进行数字签名 [英] How to digitally sign a PDF using X.509 certificate data from iOS application

查看:385
本文介绍了如何使用iOS应用程序中的X.509证书数据对PDF进行数字签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在我的应用中生成PDF。我想通过我的应用程序为这些pdf提供最好的安全性。我添加了Apple提供的默认安全选项,如所有者密码,允许复制,允许打印等...

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...

但我想添加我的证书信息或致电它使用自定义证书(X.509证书)文件对pdf进行数字签名。

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?

推荐答案

不幸的是, iOS似乎没有本机提供此功能。搜索将数字签名应用于PDF的库很困难,因为许多工具都应用了手写签名的图片。似乎没有任何可以在iOS上使用的C或Objective-C,大多数实现都是Java或C#,或者不适用于iPhone(例如 Acrobat SDK PLOP DS )。

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).

你可以自己实施数字签名,这非常简单和记录。您需要按照本文档中的说明序列化PDF,为签名对象腾出一些空间(这需要最少解析PDF布局),然后计算签名并将其存储在文件中。

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.

对于加密部分,似乎Security Framework不提供API来生成所需的PKCS#7签名。所以你可以改用OpenSSL。

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.

这篇关于如何使用iOS应用程序中的X.509证书数据对PDF进行数字签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆