when cryptography has random-access AES, update helper to use it #266
Labels
No Label
0.2.0
0.3.0
0.4.0
0.5.0
0.5.1
0.6.0
0.6.1
0.7.0
0.8.0
0.9.0
1.0.0
1.1.0
1.10.0
1.10.1
1.10.2
1.10a2
1.11.0
1.12.0
1.12.1
1.13.0
1.14.0
1.15.0
1.15.1
1.2.0
1.3.0
1.4.1
1.5.0
1.6.0
1.6.1
1.7.0
1.7.1
1.7β
1.8.0
1.8.1
1.8.2
1.8.3
1.8β
1.9.0
1.9.0-s3branch
1.9.0a1
1.9.0a2
1.9.0b1
1.9.1
1.9.2
1.9.2a1
LeastAuthority.com automation
blocker
cannot reproduce
cloud-branch
code
code-dirnodes
code-encoding
code-frontend
code-frontend-cli
code-frontend-ftp-sftp
code-frontend-magic-folder
code-frontend-web
code-mutable
code-network
code-nodeadmin
code-peerselection
code-storage
contrib
critical
defect
dev-infrastructure
documentation
duplicate
enhancement
fixed
invalid
major
minor
n/a
normal
operational
packaging
somebody else's problem
supercritical
task
trivial
unknown
was already fixed
website
wontfix
worksforme
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Reference: tahoe-lafs/trac-2024-07-25#266
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
to build the offloaded-uploader (#116), we need the ability to do AES CTR
mode at arbitrary places in the input stream. I think a second (optional)
argument to
aes.AES.process()
that accepts a byte offset would do thetrick. I'm imagining something like:
(with all the appropriate joy of handling block boundaries, of course)
hmm, robk astutely points out that we might want to re-encrypt the data on
the second pass anyways, to build up the hash trees. So we can build the
offloaded uploader without this. Lowering the priority.
Note: once pycryptopp can do this, revisit upload.py EncryptoAnUploadable.read_encrypted, to allow it to avoid encrypting all the data that we're going to throw away (when hash_only==True).
it sounds like zooko just added this feature to pycryptopp-0.3.0, right?
Yes. You can pass an "iv" argument to the constructor of an AES object now.
ok, changing the ticket description to reflect that this is now an action item for the helper, rather than pycryptopp
pycryptopp: we need random-access AES encryptionto update helper to take advantage of random-access AES encryptionhrm. Tell me about this "iv" argument: is it a string or an integer? I think I'd rather have pycryptopp be responsible for the pack-int-to-string and block-alignment issues.. it is more likely to get them right than I would.
It would also be nice to be able to pass an offset into
process()
, so you could create one AES object and then seek around with it (rather than creating a new AES object for every segment), but if that were a hassle I suppose I could live without it.What happens if my segment starts on a non-AES-blocksize boundary?
Incidentally, I added pycryptopp#18 to request this feature, having forgotten about this #266 ticket.
As I understand it, pycryptopp's
iv=
argument is not sufficient for this, at least not without a huge amount of work on the tahoe side.iv=
is a string, which defaults to an AES-sized block of all zeros. To process data at an arbitrary location, the application must figure out the right offset, pack that value into the IV block, handle non-multiple-of-the-blocksize shifts, and then keep track of exactly how much data you pass into process() if you want to call it more than once. Then, to actually seek() to a different location, you have to throw away that AES object and make a new one, since the AES() constructor is the only place that takes aniv=
argument, not process().Updating title to reflect this. Note that pycryptopp ticket 18 is still the feature request: this ticket is to remind us (on tahoe) that this sort of feature is blocked on pycryptopp-18. Also note that better random-access downloading (i.e. anything other than starting at the beginning of the file and fetching everything from there to the point of interest) also requires random-access AES.
update helper to take advantage of random-access AES encryptionto when pycryptopp has random-access AES, update helper to use itticket:3031 switched Tahoe-LAFS from pycryptopp to cryptography but cryptography also doesn't offer a random-access AES so I'm modifying this ticket to be about the same problem but with cryptography.
when pycryptopp has random-access AES, update helper to use itto when cryptography has random-access AES, update helper to use itI filed ticket:3230 for considering an alternate solution. From #cryptography-dev there was neither a clear yes or no on whether providing a simpler API in
cryptography
would be sensible. The use case is slightly obscure and the functionality is already available, just with a slightly inconvenient API. However, OpenStack Swift does basically the same thing as Tahoe-LAFS:https://github.com/openstack/swift/blob/ae36030278b244148363d4a1c6ed0c7fc7cb5204/swift/common/middleware/crypto/crypto_utils.py#L76-L84
The fact that there are two applications seemed to carry some weight.