Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
- //http://blog.absolutedisaster.co.uk/aes-256-decryption-with-php-mcrypt
- class Aes extends CI_Controller {
- private $encrypted,
- $key,
- $iv;
- public function index()
- {
- $this->config->load('aes');
- $this->key = $this->config->item('aes_secret');
- $this->iv = $this->config->item('aes_iv');
- $this->encrypted = $this->input->post('accesstoken');
- echo $this->aes256_decrypt();
- }
- private function aes256_decrypt()
- {
- return trim(
- mcrypt_decrypt(
- MCRYPT_RIJNDAEL_128,// AES 256 decryption is acheived with Rijndael 128
- // http://kix.in/2008/07/22/aes-256-using-php-mcrypt/
- $this->key,
- base64_decode($this->encrypted),
- MCRYPT_MODE_CBC,
- $this->iv
- )
- );
- }
- }
- /*End of file aes.php*/
- /*Location .application/controllers/aes.php*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement