Get Authorize.net information from a Magento 1 database

Magento encrypts the sensitive information that it stores in the database.

That’s great for security, but it means if you need information that only exists as encrypted in the database, it can be hard to get to.

To get the data out of there, you need to have access to the file system that runs the magento store.

Step 1, get the data from the database.  It’s stored in core_config_data.  You can get to it through a MySQL CLI or phpmyadmin, Navicat, etc.  The below example is to get the authorize.net api login id and transaction key.  The same logic will work for any encrypted value in the database.

SELECT value FROM core_config_data WHERE path IN ("payment/authorizenet/login", "payment/authorizenet/trans_key");

Then take the values from that and put them into a file.  The easiest way is to create a file called decrypt.php and put it at the root of the web server.  Place this code in that file, load the page at: http://www.mystore.com/decrypt.php and read the values.  Then delete the file immediately.

<?php

require_once('app/Mage.php');
Mage::app();

echo 'API Login ID: ' . Mage::helper('core')->decrypt('login id from database');
echo '<br />';
echo 'API Transaction Key: ' . Mage::helper('core')->decrypt('transaction key from database');

Load the page and you’ll see the values.

Remember to delete the file after you’re done.

Leave a Reply

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