Skip to content

Immediately resolve InputStreams when building emails, don't reuse #268

Closed

Description

@DJAxion

Hi, we run into a problem where we have an email signed with a PKCS12 key store. Sending the mail goes as expected, and the mail is signed and sent.
Next, we want to store that email for archiving, but EmailConverter.emailToEML(email) seems to re-use the stream in which the key store is provided, resulting in an IOException.

Activity

  1. bbottema commented on Jun 13, 2020

    @bbottema
    Owner

    Are you providing the input stream yourself?

    I'm not too happy how input streams are handled, because it provides the problem you describe. However reading the contents in the Email means moving some logic to the builder which also shouldn't be there. Perhaps I should remove support for manual input streams altogether...

  2. DJAxion commented on Jun 15, 2020

    @DJAxion
    Author

    No, we are using the EmailBuilder and indeed add the inputstream to signWithSmime (for the key). There is an option to add a file, but the first thing that happens in the EmailPopulatingBuilderImpl is creating an inputstream of that file, so that also isn't a solution/workarround for us.

  3. changed the title [-]Converting signed mail to .eml re-uses PKCS12 key store stream[/-] [+]Immediately resolve InputStreams when building emails, don't reuse[/+] on Jul 19, 2020
  4. added this to the 6.4.0 milestone on Jul 19, 2020
  5. added a commit that references this issue on Jul 19, 2020
  6. bbottema commented on Jul 19, 2020

    @bbottema
    Owner

    Fix released in 6.4.0.

    The api remains largely the same (expanded with byte[] versions), but any input stream passed into the api is resolved immediately now so it won't cause issues lateron.

    It would be of great help if you could confirm whether 6.4.0 works for your use case.

  7. DJAxion commented on Sep 17, 2020

    @DJAxion
    Author

    Sorry for the late response, but I can confirm it's working now! Thanks for your support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions