Reading list Switch to dark mode

    Admin configuration password encryption and decryption in magento

    Updated 5 March 2018

    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.

    Admin configuration password encryption

    Searching for an experienced
    Magento Company ?
    Find out More

    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 🙂

    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    Be the first to comment.

    Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home