使用 OpenSSL 解码/提取 smime.p7m 文件内容(带有嵌入文件的电子邮件)?
我们有一个旧的进程(VBScript),它读取一个公共邮箱并将某些电子邮件处理到数据库中。
新法规要求所有带附件的邮件都经过数字签名。
该进程现在仅提取一个文件 (smime.p7m)。 使用基于 GUI 的查看器,我可以查看嵌入的文件并毫无问题地提取它们。 然而,我真正需要的是一个基于命令行的提取器,它将写出嵌入文件(PDF、DOC、XLS)——它们没有加密,只是签名。 我使用没有证书的笔记本电脑进行了测试,只需使用上述查看器打开 smime.p7m 文件即可。
看起来 OpenSSL 会解码/提取这个,并且有人设法获得在 Windows 上编译的版本。 然而,对可执行文件的大量试验和错误测试令人沮丧,因为我找不到正确的标志组合来表示“打开 smime.p7m 文件并写出您找到的所有嵌入文件”。 在所有选项之后,“openssl smime”似乎总是想要一个“cert.pem”,但我还没有得到。
我缺少什么? 提前致谢。
We have an old process (VBScript) that reads a common mailbox and processes certain emails into a database.
New regulations have all messages with attachments now being digitally signed.
The process now only extracts one file (smime.p7m). Using a GUI-based viewer, I can see the embedded files and extract them with no problem. However, what I really need is a command-line based extracter that will write out the embedded files (PDFs, DOCs, XLSs) - they're not encrypted, just signed. I tested this by using a laptop that had no certificates and simply opened the smime.p7m file with the aforementioned viewer.
It looks like OpenSSL will decode/extract this and someone managed to get a version compiled on Windows. However, a lot of trial and error testing of the executable has been frustrating because I can't find the right combination of flags to just say "open the smime.p7m file and write out all the embedded files you find". "openssl smime" always seems to want a "cert.pem" after all the options and I haven't got that.
What am I missing? Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过 openssl 的“-noverify”选项?
对于仅签名的消息,您可以使用
然后您可以使用类似 RFC822 的解析器从该“blob”中获取正文和附件。 这意味着您的解析器必须能够进行诸如quoted-printable 和base64 之类的编码。
Did you try the "-noverify" option of openssl?
For a signed-only message, you can use
Then you can use a RFC822-like parser to get the body and attachment(s) out of that "blob". That means that your parser has to be capable of encodings like quoted-printable and base64.
看起来唯一可用的选择是使用 Chilkat 的库编写一个简单的程序。 此选项的价格为 149 美元或 289 美元,具体取决于每个开发人员的许可证类型,但至少是免版税的。
Looks like the only available option is to write a simple program using Chilkat's library. This option costs $149 or $289, depending on what kind of license, per developer, but at least it's royalty-free.