Content-Transfer-Encoding changed to Base64 after being signed
Jimex opened this issue · 1 comments
Jimex commented
Describe the bug
I have a content part with Binary Content-Transfer-Encoding, but it switches to Base64 after being signed. Did I miss anything?
Platform (please complete the following information):
- OS: [e.g. Windows
- .NET Runtime: CoreCLR
- .NET Framework: .Net 8
- MimeKit Version: 4.3.0
To Reproduce
Steps to reproduce the behavior:
- Create a MimePart with Binary Content-Transfer-Encoding
- Used MultipartSigned.Create to sign the part
Expected behavior
The contentPart's Content-Transfer-Encoding should remain the same after signed.
Code Snippets
var signPart = MultipartSigned.Create(SecureMimeContext, signer, contentPart);
Update****
It worked after I change to the codes below.
var signPart = new MultipartSigned();
signPart.Add(contentPart);
ApplicationPkcs7Signature signature;
using (var memory = new MemoryBlockStream())
{
// var prepared = Prepare(entity, memory);
contentPart.WriteTo(memory);
memory.Position = 0;
// sign the cleartext content
signature = ctx.Sign(cmsSigner, memory);
}
// add the detached signature as the second part
signPart.Add(signature);
jstedfast commented
It changes the Content-Transfer-Encoding to base64 because the binary
transfer encoding often gets forcefully changed to base64 in transit if any SMTP server along the way does not support the BINARYMIME extension.
I don't consider this a bug.