Read certificate from pdf

限于喜欢 提交于 2019-12-07 09:25:08

问题


I'm using ITextSharp in order to read certificate informations from digitally signed pdf document.

The ITextSharp.Text.Pdf.PdfPKCS7 class exposes three properties:

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


回答1:


Certificates gives you the list in no particular order, including certificates that weren't used for the main signature.

SignCertificate gives you the certificate of the actual signer.

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.

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:

'all info about a single certificate'

kind of contradicts with

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



来源:https://stackoverflow.com/questions/12477580/read-certificate-from-pdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!