Recover Authorize.net credentials from a Magento installation
·
Philip Jacob
Note to archeologists and readers: this was written a long time ago and is maintained simply for historical reasons.
In case you ever find yourself trying to recover an Authorize.net API login and transaction key from a Magento installation, you’re in the right place. What makes this slightly more difficult than reading a value from a config file is that Magento Enterprise encrypts the values. So this is how to decrypt them.
First off, find the login and trans_key in the database for your Magento installation:
SELECT value FROM core_config_data WHERE path IN ("payment/authorizenet/login", "payment/authorizenet/trans_key");
Next, use this code to decrypt the values (the values I’ve provided below are fake):
/* Substitute appropriate Mage path: */
require_once("/path/to/Mage.php");
Mage::app()->setCurrentStore(1);
$hlp = Mage::helper('core');
echo ($hlp->decrypt("0:2:31cd17ea0becc0:d67642b7da2fab==") . "\n");
echo ($hlp->decrypt("0:2:c4b2ee0255d1a5:abc06b1bcb3394==") . "\n");