从数字证书中提取签名 [英] extract signature from digital certificate

查看:540
本文介绍了从数字证书中提取签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的系统中有很多PDF.我需要检查所有这些文件是否为:-

I get lot of pdfs in my system. I need to check if all of these files are:-

  • 数字签名
  • 保持其完整性(通过将文件内容的哈希与/Contents中嵌入的消息摘要进行比较..

我正在使用python来做到这一点.到现在为止,我已经能够使用PyPDF2从签名字典中获取/Content.内容是pkcs7-der编码的.有什么方法可以提取签名的邮件摘要?

I am using python to do this. Till now I have been able to get the /Content from signature dictionary using PyPDF2. The content is pkcs7--der encoded. Is there a way I can extract the signed message digest?

类似的操作在C中作为此答案

推荐答案

DER是二进制格式,其结构称为ASN.1. PEM格式是Base64编码的DER.

DER is binary format, its structure is called ASN.1. PEM format is Base64 encoded DER.

此在线PEM解码器非常有用: http://lapo.it/asn1js/其中的消息签名,您可以编写代码以通过任何ASN.1库将其提取.

This online PEM decoder is very useful: http://lapo.it/asn1js/ After you identify the message signature in it, you can write code to extract it by any ASN.1 library.

这篇关于从数字证书中提取签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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