src/_Libs/_Crypt.php
public static function _decryptAESPKCS7($str, $key = _CryptConfig::AES_KEY, $cipher = _CryptConfig::CIPHER, $mode = _CryptConfig::MODE) {
        $key = self::_chopKeyForAES($key);
        $ivLength = self::_getBase64IVLength($cipher, $mode);
        $iv = substr($str, 0, $ivLength - 1);
        $iv = base64_decode($iv);
        $str = substr($str, $ivLength - 1);
        $str = base64_decode($str);
        $str = mcrypt_decrypt($cipher, $key, $str, $mode, $iv);
        $block = mcrypt_get_block_size($cipher, $mode);
        $pad = ord($str[($len = strlen($str)) - 1]);
        return substr($str, 0, strlen($str) - $pad);
    }
public static function _decryptAESPKCS7($str, $key = _CryptConfig::AES_KEY, $cipher = _CryptConfig::CIPHER, $mode = _CryptConfig::MODE) {
        $key = self::_chopKeyForAES($key);
        $ivLength = self::_getBase64IVLength($cipher, $mode);
        $iv = substr($str, 0, $ivLength - 1);
        $iv = base64_decode($iv);
        $str = substr($str, $ivLength - 1);
        $str = base64_decode($str);
        $str = mcrypt_decrypt($cipher, $key, $str, $mode, $iv);
        $block = mcrypt_get_block_size($cipher, $mode);
        $pad = ord($str[($len = strlen($str)) - 1]);
        return substr($str, 0, strlen($str) - $pad);
    }
public static function _decryptAESPKCS7 ( $ str , $ key = _CryptConfig :: AES_KEY , $ cipher = _CryptConfig :: CIPHER , $ mode = _CryptConfig :: MODE ) { $ key = self :: _chopKeyForAES ( $ key ) ; $ ivLength = self :: _getBase64IVLength ( $ cipher , $ mode ) ; $ iv = substr ( $ str , 0 , $ ivLength - 1 ) ; $ iv = base64_decode ( $ iv ) ; $ str = substr ( $ str , $ ivLength - 1 ) ; $ str = base64_decode ( $ str ) ; $ str = mcrypt_decrypt ( $ cipher , $ key , $ str , $ mode , $ iv ) ; $ block = mcrypt_get_block_size ( $ cipher , $ mode ) ; $ pad = ord ( $ str [ ( $ len = strlen ( $ str ) ) - 1 ] ) ; return substr ( $ str , 0 , strlen ( $ str ) - $ pad ) ; }
Decrypts a string using AES encryption with PKCS7 padding.

Adapted from comments in PHP manual:
http://php.net/manual/en/function.mcrypt-encrypt.php

@param string $str The string to encrypt
@param string $key (optional) The private key to encrypt with (note: anything over 24 chars will be chopped off)
@param const $cipher (optional) One of the MCRYPT_RIJNDAEL_ ciphers
@param cont $mode (optional) One of the MCRYPT_MODE modes
@return string The encrypted string
Decrypts a string using AES encryption with PKCS7 padding .