pkcs7-签名消息
创建 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
S/MIME 格式基于 CMS 规范(加密消息语法),该规范标准化了数据结构以承载加密、经过身份验证或签名的数据。 S/MIME(和 CMS)对这些数据结构使用 ASN.1 表示法。
在 S/MIME 签名消息中,消息数字签名和签名证书都封装在电子邮件 MIME 多部分的第二部分中。可以手动构建消息多部分,但 S/MIME 签名是二进制格式,需要专用库进行计算。
一些技术细节:
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:
ContentInfo
containing aSignedData
structureSignedData
contains aSignerInfo
(most of the time only one since the e-mail is signed by a single sender). ASignerInfo
contains the message digital signature, the signature algorithm and a signer certificate unique identifier (for instance the certificate issuer & serial number)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)