OpenSSL treats smime message with Content-type 'Application/EDI' as text and changes line breaks

空扰寡人 提交于 2019-12-08 13:25:35

问题


I receive smime message with content-type 'Application/EDI'. It is non-standard mime type and content should be interpreted as binary. But OpenSSL during verifying signature treats it as text and changes line breaks from '\n' to '\r\n' (as needed by spec for content-type 'text'). So digest becomes wrong and verification fails.

Is there any way to make openssl not chaging anything in original message? Argument '-binary' doesn't work on any version (I tried 0.9.7, 0.9.8, 1.0.0).


回答1:


Ok, answering my own question.

I've split input data into two separate files with content and signature removing unnecessary metadata. After that I changed mime type of signature to application/pkcs7-mime and verification became successful with this command:

openssl.exe smime -verify -inform SMIME -CAfile caCert.pem -certfile cert.pem -in signature.txt -content content.txt

Variant with changing -inform to PEM also works, but signature must be without Content-xxx headers



来源:https://stackoverflow.com/questions/3975612/openssl-treats-smime-message-with-content-type-application-edi-as-text-and-cha

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!