Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MessageDispositionNotification ContentTransferEncoding ignored when added to MultipartSigned #626

Closed
ProH4Ck opened this issue Nov 27, 2020 · 1 comment
Labels
bug Something isn't working enhancement New feature or request

Comments

@ProH4Ck
Copy link

ProH4Ck commented Nov 27, 2020

Describe the bug
I have a problem with a MessageDispositionNotification added to a MultipartSigned. When I create the MDN (Message Disposition Notification) I specify ContentTransferEncoding = ContentEncoding.SevenBit but when I try to sign the message, MDN content is converted to a base64 string. This is a problem because my AS2 partner need to receive this part in plain-text

Platform (please complete the following information):

  • OS: Windows
  • .NET Runtime: NET 5
  • MimeKit Version: 2.10.0

To Reproduce

public static async Task Main(string[] args)
{
    var multipartReport = new MultipartReport("disposition-notification");

    var textPart = new TextPart
    {
        ContentTransferEncoding = ContentEncoding.SevenBit,
        Content = new MimeContent(
            new MemoryStream(Encoding.UTF8.GetBytes("The AS2 message has been received.")))
    };

    var hl = new HeaderList
    {
        new Header("Reporting-UA", "AS2_Server"),
        new Header("Original-Recipient", "rfc822; AS2_SENDER"),
        new Header("Final-Recipient", "rfc822; AS2_SENDER"),
        new Header("Original-Message-ID", "TEST_MESSAGE"),
        new Header("Disposition", "automatic-action/MDN-sent-automatically; processed"),
        new Header("Received-Content-MIC", "<<MIC>>, sha1")
    };
    var mdnContent = new MemoryStream();
    await hl.WriteToAsync(mdnContent);
    var reportPart = new MessageDispositionNotification
    {
        Content = new MimeContent(mdnContent),
        ContentTransferEncoding = ContentEncoding.SevenBit
    };

    multipartReport.Add(textPart);
    multipartReport.Add(reportPart);

    Console.WriteLine("UNSIGNED MDN: " + Environment.NewLine + multipartReport);

    using var ctx = new TemporarySecureMimeContext();
    var signer = new CmsSigner("as2.pfx", "1234");
    var finalEntity = MultipartSigned.Create(ctx, signer, multipartReport);

    Console.WriteLine("SIGNED MDN: " + Environment.NewLine + finalEntity.ToString());
}

Expected behavior
The MDN is left in plain-text

Screenshots
image

jstedfast added a commit that referenced this issue Nov 28, 2020
…e same as text/* when preparing for signing

Fixes issue #626
@jstedfast jstedfast added bug Something isn't working enhancement New feature or request labels Nov 28, 2020
@jstedfast
Copy link
Owner

Released v2.10.1 to nuget.org with this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants