- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我有一个签名的电子邮件消息作为字符串。我想获取带有附件和正文的完整未签名消息的字符串,我可以使用这些消息进行解析,例如 Mail gem。
我找到了问题:Decode/extract smime.p7m file contents (email with embedded files) with OpenSSL?现在我知道如何通过命令行来完成了。
我可以将我的字符串转储到临时文件,通过命令行解密,然后解析它。但这不是什么好主意。我想为 Ruby 使用 OpenSSL 库。
最佳答案
我想我应该写一个解决方案,因为我花了很长时间才弄明白。另请参阅我上面关于从何处获取的评论:
include OpenSSL
# assuming that mail contains the message that you have likely fetched with the mail gem
data = mail.to_s
# load your certificate and key
# if you need to convert from a .p12 file for example
# check this https://stackoverflow.com/questions/13732826/convert-pem-to-crt-and-key
cert = X509::Certificate.new(File::read("your_cert.cer"))
key = PKey::RSA.new(File::read("your.key"))
# load the encrypted mail
p7enc = PKCS7::read_smime(data)
# this is the plain email that you can read back into the mail gem and extract the required data
Mail.read_from_string(p7enc.decrypt(key, cert))
关于ruby - 如何使用 Ruby OpenSSL 库解码/提取 SMIME 签名电子邮件的 smime.p7m 文件内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7332871/
我正在尝试使用 java 邮件阅读多部分/签名邮件,但是当我阅读 .mime 时,我没有看到原始附件,原始附件被忽略,只有我可以看到 smime.7ps 文件。这是我使用的代码: ByteArrayD
我有一个签名的电子邮件消息作为字符串。我想获取带有附件和正文的完整未签名消息的字符串,我可以使用这些消息进行解析,例如 Mail gem。 我找到了问题:Decode/extract smime.p7
我在 OSX 10.6 上使用 openssl 1.0.1b 的命令行界面。 首先,我创建一个 DSA key 。 openssl dsaparam -noout -out privatekey.pe
我想用JAVA开发一个基于SMIME的应用程序。在某些领域,我需要对 SMIME 加密/解密进行更多说明。我了解在单个收件人的情况下如何对消息进行加密和解密。 如果只有一个收件人 随机生成的 sess
我找不到任何对我有帮助的东西。我在保留 smime 电子邮件的签名时遇到问题。我正在尝试获取加密的 smime 消息,解密它,然后将其保存到数据库(用于工作)。由于消息首先被签名然后被加密,所以我认为
我们的服务正在运行 python,突然我无法验证其他人的 java 签名。 我尝试在 java 中验证,它有效... 它只是突然发生,没有对代码和证书文件做任何更改 和合作伙伴也声称他们没有改变任何东
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题? Update the question所以它是on-topic对于堆栈溢出。 8年前关闭。 Improve this que
我已经在我的系统中生成了一个本地证书,我正在尝试通过 smime 加密一个文件。但是当我运行命令时,它给我错误 Unable to load certificate Expecting trusted
我正在使用 openssl smime 来签署和验证数据。 要使用 openssl 签署文本文件,我使用以下命令: openssl smime -sign -in sample.txt -out ma
我正在尝试在一个较大的项目中编写一个简单的文件加密/解密。由于许可证问题,我想避免使用 libgpgme。 openPGP 标准对于我的项目时间框架来说太复杂了。我想用 openssl 做我的加密工作
您好,我找不到一种方法将不透明的 pkcs#7(p7m) 转换为明文分离的 smime,以便常规 mime 库可以处理签名的内容。 我想获取 p7m 文件并将其转换为保留有效签名的 smime 消息。
问题 1- 我想创建一条 MIME 消息。像这样的事情: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="---1
我想创建具有 S/MIME 格式的 pkcs7 签名信封并且还想阅读它。文件扩展名为 pk7。 如何使用 OpenSSL 库做到这一点? 最佳答案 SMIME_read_PKCS7()和 SMIME_
我正在寻找一种在客户端解密 S/MIME 电子邮件的方法。我特别不希望客户端与服务器共享私钥,因此需要找到一种方法让客户端自行完成所有操作。 我不需要支持多种浏览器,所以使用类似 window.Cry
所以,我有这个应用程序可以创建一个包含图像和内容的 zip 文件 我想使用 smime 对其进行签名。 如果我使用终端命令: openssl smime -binary -sign -passin "
我正在使用 BC 加密和签署用于 AS2 的 SMIME 消息。我们的代码适用于绝对古老的充气城堡版本 bcmail-1.4:125。升级到更新的版本会导致消息的接收者(不是太古老的 Cyclone
我试图做的是在 Mac 上复制通过终端运行的以下命令,但在 iPhone/Cocoa 上: openssl smime -binary -sign -signer cert.pem -inkey ke
我正在尝试使用 java 解码 PEM 编码文件。已经发布了一个非常相似的问题,但是它针对的是 DER 编码文件,而不是 PEM 编码文件。 openssl -decrypt by Java 那里使用
我见过很多可以使用 SMIME 加密和发送电子邮件的示例,但没有加密常规文件的示例。我有一种将 key 插入 bd 的方法,但我不知道如何使用 bouncycaSTLe 的 SMIME 来加密文件。
我将一个苹果关联文件上传到我的服务器,该服务器通过 HTTPS 提供内容,但链接验证器 here给我这个错误 你的文件应该使用 openssl smime -verify -inform DER -n
我是一名优秀的程序员,十分优秀!