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

Unnecessary base64 output makes fernet inappropriate for files encryption #32

Open
LukasJerabek opened this issue May 23, 2024 · 2 comments

Comments

@LukasJerabek
Copy link

What is the reason there is a base64 for output of encryption? Is it really necessary? Why wont we get rid of it and make fernet usable even for files encryption - saving approx 1/3 of storage.

here are few issues addressing this problem in implementations of fernet spec:
pyca/cryptography#8755
pyca/cryptography#4921

@zamicol
Copy link

zamicol commented May 28, 2024

I suspect that if the fernet program is streaming, like when a compatible program uses a Unix pipe, converting to bytes would be idiomatic and fast. The question then is fernet streaming capable conversion efficient?

I assume that for large payload on disk storage should be converted into bytes.

I understand the desire for a byte output/input mode. For comparison, Age also outputs base64.

@chrispy-snps
Copy link

I would also like to see an allowance in the Fernet specification for binary-encoded encrypted objects that simplify skip the final base64 encoding step.

The base64 encoding is wasteful for binary storage applications (disk files, database binary BLOBs). Sure, objects can be decoded after encryption and reencoded before decryption, but that is four unnecessary base64/binary transcodings for each encryption/decryption round-trip.

There have been multiple requests to the pyca/cryptography package to add binary encoding support:

pyca/cryptography#4921
pyca/cryptography#4953
pyca/cryptography#8755

and every request is denied because the Fernet specification itself does not allow for it. There is no material change to the encryption/decryption process itself. Please consider it.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants