Quantcast
Channel: Webkul Blog
Viewing all articles
Browse latest Browse all 5537

Admin configuration password encryption and decryption in magento

$
0
0

In this article you will see Admin configuration password encryption and decryption in magento.

Encryption

Encryption can be done either by ‘password‘ or ‘obscure‘. In password the text will simply be encrypted and in inspect element of browser its value can be seen. But by using obscure only encrypted value can be seen.

Use the following code to encrypt –

<systemconfig translate="label">
    <label>Encrypt with obscure</label>
    <frontend_type>obscure</frontend_type>
    <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
    <sort_order>1</sort_order>
</systemconfig>

Now input value in the text box and saving will encrypt the value.

To use obscure in magento 2, click here

Decryption

decrypt() to read the encrypted value.

$encrypted_value = Mage::getStoreConfig('section/tab/systemconfig');
echo decrypt($encrypted_value);

section and tab are section name and tab name respectively.

This displays the decrypted value.

Happy coding 🙂


Viewing all articles
Browse latest Browse all 5537

Trending Articles