[GH-ISSUE #43] "stream" attachments to the SMTP server on send #37

Open
opened 2026-02-25 21:33:58 +03:00 by kerem · 3 comments
Owner

Originally created by @jasonmunro on GitHub (Mar 8, 2016).
Original GitHub issue: https://github.com/cypht-org/cypht/issues/43

Originally assigned to: @jasonmunro on GitHub.

Currently we read attachments into memory to format them to be sent. We need to do this one line at a time so we don't overflow available memory with larger attachments.

Originally created by @jasonmunro on GitHub (Mar 8, 2016). Original GitHub issue: https://github.com/cypht-org/cypht/issues/43 Originally assigned to: @jasonmunro on GitHub. Currently we read attachments into memory to format them to be sent. We need to do this one line at a time so we don't overflow available memory with larger attachments.
Author
Owner

@jasonmunro commented on GitHub (Jun 21, 2016):

One issue here is we currently encrypt the attachment while it rests on the server between upload and send. If we stream these (which we should), we have to do something like line by line encryption, which presents it's own set of problems.

<!-- gh-comment-id:227351072 --> @jasonmunro commented on GitHub (Jun 21, 2016): One issue here is we currently encrypt the attachment while it rests on the server between upload and send. If we stream these (which we should), we have to do something like line by line encryption, which presents it's own set of problems.
Author
Owner

@dumblob commented on GitHub (Jun 21, 2016):

Well, I think we shouldn't be focused on lines, because no devices nowadays use text protocols, but rather some packets to send data over the network (not considering circuit networks which are very rarely used for plain data nowadays). I would take the maximum TCP packet payload size which causes no fragmentation (for the whole Ethernet frame it's 1492 octets in case of PPPoE/DSL, 1500 octets otherwise; after removing Ethernet frame 24 octets, IPv4 header 20 octets, and TCP header 20 octets, we'll end up with payload 1492 - 24 - 20 - 20 = 1428 octets) and split the data according to this size. Of course, not everybody is using Ethernet-based connection, but this one is most prevalent and will cover 99.999% of users of Cypht in my opinion.

In general I would avoid small pieces of data (like lines in an email), because the packet size grows (in IPv6 it's 65535 octets) and devices will try not to fragment those. It is also inefficient to cipher small pieces of data, because it involves more copying and shuffling with meta data.

For ciphering the most suitable would be of course a block cipher mode of operation of an existing cipher of your choice.

<!-- gh-comment-id:227386319 --> @dumblob commented on GitHub (Jun 21, 2016): Well, I think we shouldn't be focused on lines, because no devices nowadays use text protocols, but rather some packets to send data over the network (not considering circuit networks which are very rarely used for plain data nowadays). I would take the maximum TCP packet payload size which causes no fragmentation (for the whole Ethernet frame it's 1492 octets in case of PPPoE/DSL, 1500 octets otherwise; after removing Ethernet frame 24 octets, IPv4 header 20 octets, and TCP header 20 octets, we'll end up with payload 1492 - 24 - 20 - 20 = 1428 octets) and split the data according to this size. Of course, not everybody is using Ethernet-based connection, but this one is most prevalent and will cover 99.999% of users of Cypht in my opinion. In general I would avoid small pieces of data (like lines in an email), because the packet size grows (in IPv6 it's 65535 octets) and devices will try not to fragment those. It is also inefficient to cipher small pieces of data, because it involves more copying and shuffling with meta data. For ciphering the most suitable would be of course a block cipher mode of operation of an existing cipher of your choice.
Author
Owner
<!-- gh-comment-id:1200491827 --> @marclaporte commented on GitHub (Jul 31, 2022): Related: https://github.com/jasonmunro/cypht/issues/351 https://github.com/jasonmunro/cypht/issues/469
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cypht#37
No description provided.