This repository was archived by the owner on Apr 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Discussion: Encryption with Libsodium
Olga Kopylova edited this page May 4, 2018
·
4 revisions
The original Design Document is at HLD Removing mcrypt and adding libsodium.
Purpose of this page is to provide transparency via an open discussion. The page may include:
- open questions
- ideas and proposals
- notes and action items from the meetings
The page will be updated as the discussion progresses. See revisions of the page if needed.
See epic https://app.zenhub.com/workspace/o/magento-engcom/php-7.2-support/issues/127
- Decide on migration strategy (#134)
- Calculate possible amount of stored encrypted data
- Investigate if it's safe to use https://github.com/paragonie/sodium_compat (#133)
- It supports functions mentioned above
- Based on the #2 decide on the implementation strategy:
- Completely switch to sodium (if
sodium_compat
is an acceptable option) - Support both
mcrypt
andsodium
based on what's installed in the system. Usemcrypt_compat
formcrypt
support as we don't havemcrypt
incomposer.json
requirements
- Completely switch to sodium (if
- Use
crypto_aead_*
: What functions should we use:crypto_aead_*
orcrypto_secretbox*
? See - recommendations (includes code sample)- Also, clarify what ciphers are used to understand what needs to be added to the ciphertext
-
XChaCha20-Poly1305-IETF
(check what's supported by current library version) forcrypto_aead_xchacha20poly1305_ietf
orxsalsa20poly1305
forcrypto_secretbox
-
- Also, clarify what ciphers are used to understand what needs to be added to the ciphertext
- Use
mcrypt
for decrypting existing data. Usemcrypt_compat
. The\Magento\Framework\Encryption\Crypt::encrypt()
in Magento Framework should be deprecated
- First step: encryption only. Hashing can be done as a separate step later.
- To confirm with Piotr (Olga)
- Use
crypto_aead_xchacha20poly1305_ietf*
- Update HLD (Olga)
- Data migration:
- Support "on-demand" approach. Current pattern in decryption supports this, we should follow it.
- Migrate on upgrade step. Investigate upgrade performance implications. Run test on different amount of data.
- Create a task (Olga)
-
https://github.com/paragonie/sodium_compat
- Follow-up on whether we can use this (Steven)
- Use sodium_compat for development now. Change later if necessary
-
https://github.com/phpseclib/mcrypt_compat
- Follow-up on whether we can use this (Steven)
- Check performance with new implementation, both with native Sodium and sodium_compat one.
- Create a task (Olga)
-
Design Document
- Discussion: Encryption with Libsodium
- Info
- ZenHub board
-
Weekly calls(on pause): - Slack: #feature-php-72