You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This RFC conceptualise the implementation and migration of libsodium instead of OpenSSL to power transcrypt.
It will increase security and usability at a minor cost of installation ease and while supporting a lot of platforms.
Motivation
Expected outcome is to have better security and usability, while still supporting a wide range of platforms and being easy to install
Indeed aes-256-cbc is a cipher without authentication which means that transcrypt won't crash if the key is wrong or undefined.
Today in one of our project we spend a few hours debugging an issue with a new CI were the password wasn't set and transcrypt was doing. (This issue happened twice for me in two years so I think it is worth considering it.)
transcrypt -c aes-256-cbc -p 'undefined'
Ultimately this should not have happened and the step were transcrypt was executed should have failed with proper authentication.
Open SSL platform variability
As specified in the readme, the different platforms have very different version of OpenSSL.
I didn't find a marketshare of openssl version but I tend to agree that it is hard to move forward with new openSSL algorithms, as old platform may not support them.
Guide-level explanation
Phase 1
With the new transcrypt people will be able to execute the same worklow than today.
We can start by just implementing python backend, as it is widely stared, support old python version, and python itself as a really great platform support, is preinstalled in almost every UNIX system
Phase 2
Now three would be a depreciation warning. People can use the provided utility to migrate to new backend
transcrypt -m modern
New project are done with backend modern but can use
importnacl.secretkey="previously define key"# This is your safe, you can use it to encrypt or decrypt messagesbox=nacl.secret.SecretBox(key)
# This is our message to send, it must be a bytestring as SecretBox will# treat it as just a binary blob of data.message=b"test"# Encrypt our message, it will be exactly 40 bytes longer than the# original message as it stores authentication information and the# nonce alongside it.encrypted=box.encrypt(message)
to cipher
and
# Decrypt our message, an exception will be raised if the encryption was# tampered with or there was otherwise an error.plaintext=box.decrypt(encrypted)
print(plaintext.decode('utf-8'))
to decrypt.
Drawbacks
libsodium is not install by default in the system
libsodium is a lib thus it doesn't come with a a CLI. We need a high level wrapper for it.
there is less history to the ChaCha20 cipher than AES one's
Rationale and alternatives
Chacah20Poly1305 looks a compelling cipher to use. It increases the security by preventing malleability attacks. It is standard, and high security.
Two alternatives are:
stick to CBC and add an HMAC on top it: that looks better than existing and keep openssl but is less featureproof, and require doing our own crypto: should we pad the cipher ? the mac ? ect)
[RFC] Use libsodium instead of OpenSSL
Summary
This RFC conceptualise the implementation and migration of libsodium instead of OpenSSL to power transcrypt.
It will increase security and usability at a minor cost of installation ease and while supporting a lot of platforms.
Motivation
Expected outcome is to have better security and usability, while still supporting a wide range of platforms and being easy to install
Malleability issue
The main motivation is the malleability issues described in https://github.com/elasticdog/transcrypt#cipher-selection
Indeed
aes-256-cbc
is a cipher without authentication which means that transcrypt won't crash if the key is wrong or undefined.Today in one of our project we spend a few hours debugging an issue with a new CI were the password wasn't set and transcrypt was doing. (This issue happened twice for me in two years so I think it is worth considering it.)
transcrypt -c aes-256-cbc -p 'undefined'
Ultimately this should not have happened and the step were transcrypt was executed should have failed with proper authentication.
Open SSL platform variability
As specified in the readme, the different platforms have very different version of OpenSSL.
I didn't find a marketshare of openssl version but I tend to agree that it is hard to move forward with new openSSL algorithms, as old platform may not support them.
Guide-level explanation
Phase 1
With the new transcrypt people will be able to execute the same worklow than today.
but they would get a hint in CLI to opt in and use the new backend "modern"
When using this modern backend this will add a step that check for a CLI wrapper to libsodium. Eg:
We can start by just implementing python backend, as it is widely stared, support old python version, and python itself as a really great platform support, is preinstalled in almost every UNIX system
Phase 2
Now three would be a depreciation warning. People can use the provided utility to migrate to new backend
New project are done with backend modern but can use
to use old backend
Phase 3
(Probably in a very long time)
We remove support for legacy backend.
Reference-level explanation
We will use libsodium secretbox constructions.
(Maybe we should use the file specific operation to work on a stream: libsodium secretstream)
How to chose between secretbox and secretstream.
Key derivation function
Libsodium already implement keygen function so manual steps are not needed.
We just need to use the high level equivalent for:
eg in pynacl
and store it.
Encryption and authentication
(Note the algorithm provides encryption and authentication in the same time, not encrypt then mac).
The algorithm is:
It is:
We just need to use the high level equivalent for:
eg in pynacl
to cipher
and
to decrypt.
Drawbacks
Rationale and alternatives
Chacah20Poly1305 looks a compelling cipher to use. It increases the security by preventing malleability attacks. It is standard, and high security.
Two alternatives are:
References
The text was updated successfully, but these errors were encountered: