阅读从PDF证书 [英] Read certificate from pdf
问题描述
为了读取数字签名的PDF文档证书信息我使用iTextSharp的。
I'm using ITextSharp in order to read certificate informations from digitally signed pdf document.
ITextSharp.Text.Pdf.PdfPKCS7
类公开三个属性:
-
证书
(如列表) -
SignCertificate
(如单个对象) -
SignCertificateChain
(如表)
Certificates
(as list)SignCertificate
(as single object)SignCertificateChain
(as list)
我怎么能为了实现关于单个证书的信息结合这三个属性?
How can I combine these three properties in order to achieve all info about a single certificate?
我就能显示所有证书路径(所有嵌套证书)。
I'd be able to show all certificate path (all nested certificates).
推荐答案
证书
给你的清单中没有特定的顺序,其中包括了未用于主签名的证书。
Certificates
gives you the list in no particular order, including certificates that weren't used for the main signature.
SignCertificate
为您提供了实际的签名者的证书。
SignCertificate
gives you the certificate of the actual signer.
SignCertificateChain
为您提供了列表,其中的第一个证书是SignCertificate,接下来就是颁发SignCertificate实例的证书,接下来就是颁发以前的证书实例证书,等等。这不是证书
,因为只有用于主签名的证书将被返回。返回较少证书。
SignCertificateChain
gives you the list where the first Certificate is the SignCertificate, the next is the certificate of the instance that issued the SignCertificate, the next is the certificate of the instance that issued the previous certificate, and so on. This can return less certificates than Certificates
, because only the certificates used for the main signature will be returned.
所以,你不需要'结合'的属性,以显示证书路径,你只需要SignCertificateChain。请注意,你的问题是不完全清楚:
So you don't need to 'combine' the properties to show the certificate path, you just need SignCertificateChain. Note that your question isn't entirely clear:
所有信息一的单的证书
与
显示一种矛盾的所有的证书路径(所有嵌套证书)
'show all certificate path (all nested certificates)'
如果你想可视化导致进入签名证书链,你需要查看多单证书的详细(除非该证书在这种情况下,只有一种链元素的自签名)。
If you want to visualize the chain that resulted into the signing certificate, you need to look at more than a single certificate (unless the certificate was self-signed in which case there's only one element in the chain).
这篇关于阅读从PDF证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!