Decrypt an Encrypted Config value

Trying to get an encrypted system configuration value but you still get the encrypted value an not the one you added in configuration? Seems that you forgot to decrypted it. Let's see how you can do that.

Below we see a simple system.xml file where we have a field called password where its value is encrypted.

Now when you want to get this value and use it, we have to decrypted first. We can do n Magento 2 by using the function decrypt() of the EncryptorInterface class. In the helper below we see its usage.

Feel free to share this post and ask your questions in the comments below.

Till next time!

DigitalOcean Referral Badge