How to use AES in ci? |
[eluser]Turn_right[/eluser]
I want to use AES encryption,But always run some error. I downloaded the AES free version opensorce code in phpAES In general,I used in following way: Code: $z=md5($key); $z is the key of AES. ========== Use in CI: I put the AES.php to library/ and go to system_model to use. Code: $z=md5($key); $this->load->library('AESclass',$z); But run some error like: Quote:A PHP Error was encountered Quote:A PHP Error was encountered I don't know how to put the key .... hut:
[eluser]ηυмвєяσηє[/eluser]
dunno about aes class but the usage of libraries in codeigniter is like Code: $this->load->library('AESclass','aes'); u may need to modify the library.
[eluser]Turn_right[/eluser]
But in AES.php Code: public function __construct($z) { $z is the key ,isn't? When I put key , I can use like Code: $aes = New AES($z); $item is something that I want to encrypt. in Manual: Code: $params = array('type' => 'large', 'color' => 'red'); Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); as you say Code: $this->load->library('AES','aes'); is aes the key? I mess up .... :down:
[eluser]ηυмвєяσηє[/eluser]
try this. Code: $this->load->library('AESclass');
[eluser]Turn_right[/eluser]
Ah.... Is my explain unclear?, or.... AES is a symmetric-key encryption standard adopted. You have to give a key to encrypt the item you want to be a secret. in general,use that class. Only if you give a key ,you can use function including encrypt or decrypt. as you say Code: $aeskey = $this->aesclass->encrypt($keyvalue); Would you explain why are you use that way? Maybe is my fault.... :blank:
[eluser]InsiteFX[/eluser]
Code: class Aes { InsiteFX
[eluser]Turn_right[/eluser]
I just want to load the AES.php to my model Should i modify the AES.php?
[eluser]Turn_right[/eluser]
Thanks finally , I solved the problem to modify the AES.php .
[eluser]InsiteFX[/eluser]
If you are using AES for encrypting to the database, AES is a MySQL Command! No need for a library, read the MySQL documentation! InsiteFX
[eluser]Turn_right[/eluser]
gooooooood!!!!!!! Thanks for your suggestion!! :bug: |
Welcome Guest, Not a member yet? Register Sign In |