验证是否使用iText对PDF进行了数字签名 [英] Verify if a PDF is digitally signed with iText
本文介绍了验证是否使用iText对PDF进行了数字签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
正如标题所述,我想知道给定的PDF文件是否已经进行了数字签名.
As the title says I want to know if a given PDF file is already digitally signed.
我使用iText对其进行了签名,但是我不知道它是否已经被签名以最终对其进行签名或执行其他操作.
I used iText to sign it but I'm not able to know if it is already signed to eventually resign it or perform other actions.
是否有一种简单的方法(可能使用iText)?
Is there a way to do it simply (possibly using iText)?
推荐答案
使用iText:
PdfReader reader = new PdfReader(...);
AcroFields acroFields = reader.getAcroFields();
List<String> signatureNames = acroFields.getSignatureNames();
现在signatureNames
包含所有包含签名的可访问签名字段的名称,请参见. JavaDoc:
Now signatureNames
contains the names of all reachable signature fields containing signatures, cf. the JavaDoc:
/**
* Gets the field names that have signatures and are signed.
*
* @return the field names that have signatures and are signed
*/
public ArrayList<String> getSignatureNames()
这篇关于验证是否使用iText对PDF进行了数字签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文