Closed tuck1s closed 6 years ago
Hey @tuck1s , nice work, but the code looks to solve a very particular case. Let me know if we can actually simplify the encrypt function a little bit, so all these filtering can be handled from outside the function. Do you agree?
Simpler is always better. A few comments -
MIMEText
call on the payload - which also removes non-needed headers), at least according to my reading of "RFC5751, section 3. Creating S/MIME Messages".Content-Type: text/plain; charset=utf-8; format=flowed
with long lines.I think my header removal code is rather ugly (please improve if you can), but in terms of inputs the intent is to make it more general rather than less general :-)
However I think you are right, we should move the "filtering" part outside of encrypt
. Because I think the filtering should be done once only, before signing and/or encrypting. I'm trying to get some workable signing code together. So feel free to reject this PR (or even better .. suggest improvements to my code and also reject it)!
I'll withdraw this and submit a simpler version.
Accept multipart messages, fixing text/plain parts for compatibility with block crypto. encrypt() accepts string or message object type.