pkcs7-签名消息

发布于 2024-11-01 03:40:38 字数 190 浏览 10 评论 0原文

创建 as/mime 消息时,您在第二部分(第一部分是实际消息)中应该提供您签署消息所用的证书以及签名的结果(即摘要),您应该如何提供连接它们?

我不使用任何像充气城堡或类似的库。我正在手工构建消息。您是否应该将它们连接在一起,或者在它们之间添加一个新行,或者如何完成?我确实尝试看看 BC 是如何完成的,并进行了一些谷歌搜索,但没有任何明确的答案。

When creating a s/mime message where you in the second part (the first part is the actual message) are supposed to provide BOTH the certificate you signed the message with, AND the result of the signing, i.e the digest, how are you supposed to concatenate them?

I dont use any libraries like bouncy castle or similar. I am building the message by hand. Are you just supposed to concatenate them after each other, or with a new line between or how is it done? I did try to look how it is done in BC, and some googling without any clear answers.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怪我鬧 2024-11-08 03:40:38

S/MIME 格式基于 CMS 规范(加密消息语法),该规范标准化了数据结构以承载加密、经过身份验证或签名的数据。 S/MIME(和 CMS)对这些数据结构使用 ASN.1 表示法。

在 S/MIME 签名消息中,消息数字签名和签名证书都封装在电子邮件 MIME 多部分的第二部分中。可以手动构建消息多部分,但 S/MIME 签名是二进制格式,需要专用库进行计算。

一些技术细节:

  • S/MIME ASN.1 模块的最新版本在 RFC 5911< 中进行了描述/a>
  • 消息签名是包含 SignedData 结构的 ContentInfo
  • SignedData 包含 SignerInfo (大多数情况下由于电子邮件是由单个发件人签署的,因此只有一封)。 SignerInfo 包含消息数字签名、签名算法和签名者证书唯一标识符(例如证书颁发者和序列号),
  • 证书可以添加到 SignedData 中(这是可选的,因为证书是公共对象,可以从存储库下载它们,或者收件人可能已经将签名证书链存储在她的邮件应用程序中)

The S/MIME format is based on the CMS specification (Cryptographic Message Syntax), which standardize the data structures to carry encrypted, authenticated or signed data. S/MIME (and CMS) uses ASN.1 notation for these data structures.

In a S/MIME signed message, both the message digital signature and the signing certificates are encapsulated in the second part of the e-mail MIME multipart. It is possible to manually build the message multipart, but the S/MIME signature is a binary format which requires a dedicated library to be computed.

Some technical details:

  • the last version of the S/MIME ASN.1 module is described in the RFC 5911
  • the message signature is ContentInfo containing a SignedData structure
  • the SignedData contains a SignerInfo (most of the time only one since the e-mail is signed by a single sender). A SignerInfo contains the message digital signature, the signature algorithm and a signer certificate unique identifier (for instance the certificate issuer & serial number)
  • the certificates can be added in the SignedData (this is optinal since certificates are public objects, they can be downloaded from a repository or the recipient may already have the signing certificate chain stored in her mail application)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文