What is the role of crypt in env.php in magento 2. The file is located at app/etc/env.php

2 Answers 2


During the installation process, Magento 2 will generate a random encryption key, stored in app/etc/env.php. It is used to protect passwords and other sensitive data, using hash & salt method.

For a better understanding, you can take a look in vendor\magento\framework\Encryption\Encryptor.php class which implements EncryptorInterface.

Where is used ? For example in module-customer, module-sales, module-paypal (you can search by EncryptorInterface in vendor/magento to find all the modules that are using it.)


Found this: http://devdocs.magento.com/guides/v2.0/config-guide/config/config-php.html

Look for "Encryption key" on the page

And you might want to look at this: http://devdocs.magento.com/guides/v2.1/cloud/trouble/trouble-crypt-key-variable.html

Apparently the crypt key is Magento generated and used in cloud environments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.