php - how to decrypt magento dataencrypted -
i want decrypt magento data using data encrypted , config key show data plan test
i tried alotof ways no 1 has done me there way
i mean there way php script it
and thanks
i used code found here doesn't show anything
<?php class encryption { const cipher = mcrypt_rijndael_128; // rijndael-128 aes const mode = mcrypt_mode_cbc; /* cryptographic key of length 16, 24 or 32. not password! */ private $key; public function __construct($key) { $this->key = $key; } public function encrypt($plaintext) { $ivsize = mcrypt_get_iv_size(self::cipher, self::mode); $iv = mcrypt_create_iv($ivsize, mcrypt_dev_random); $ciphertext = mcrypt_encrypt(self::cipher, $this->key, $plaintext, self::mode, $iv); return base64_encode($iv.$ciphertext); } public function decrypt($ciphertext) { $ciphertext = base64_decode($ciphertext); $ivsize = mcrypt_get_iv_size(self::cipher, self::mode); if (strlen($ciphertext) < $ivsize) { throw new exception('missing initialization vector'); } $iv = substr($ciphertext, 0, $ivsize); $ciphertext = substr($ciphertext, $ivsize); $plaintext = mcrypt_decrypt(self::cipher, $this->key, $ciphertext, self::mode, $iv); return rtrim($plaintext, "\0"); } }
in simplest case, when use of standard magento settings:
- encryptor model core/encryption,
- key setting global/crypt/key
- using mcrypt
- with standard cipher mcrypt_blowfish , mode mcrypt_mode_ecb (all given magento 1.8.1)
$encrypted = 'r4vqyyn6jhs='; $key = '370ee4d319aebb395b982d72190588d2'; $cipher = mcrypt_blowfish; $mode = mcrypt_mode_ecb; $handler = mcrypt_module_open($cipher, '', $mode, ''); $initvector = mcrypt_create_iv (mcrypt_enc_get_iv_size($handler), mcrypt_rand); mcrypt_generic_init($handler, $key, $initvector); var_dump(str_replace("\x0", '', trim(mdecrypt_generic($handler, base64_decode($encrypted)))));
however, can't see point in using this, since can use magento, , call
magento::helper('core')->decrypt($encrypted);
Comments
Post a Comment