开发者

Where can i get AES encyrption for PHP and can AES encrytion be used for document storage?

开发者 https://www.devze.com 2023-02-27 08:39 出处:网络
Where can I get AES encyrption for PHP and can i use it for phpmyadmin?Any references?开发者_如何学编程

Where can I get AES encyrption for PHP and can i use it for phpmyadmin? Any references?开发者_如何学编程

I want to encrypt files that are stored in the db and other tables as well.


I'm going to assume you're using MySQL.

MySQL has AES encrypt/decrypt functions built in. So if you're encrypting data to be stored in the database, that would be handled in the SQL commands.

As far as I know, PHPMyAdmin doesn't offer a GUI for doing encrypted fields. You would need to type in the commands manually. Example:

CREATE TABLE `test` (
   `id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT, 
   `stuff` BLOB NOT NULL DEFAULT ""
);
# Encrypted fields have to be of the BLOB type (tiny/medium/large variants okay)

INSERT INTO test (stuff) VALUES (AES_ENCRYPT("My hovercraft is full of eels!", "password"));

SELECT AES_DECRYPT(stuff, "password") AS stuff FROM test;

Note that if you're encrypting stuff in your database, you should still use SSL on the connections (client to web server, and web server to database server) to protect the data while it's in transit.

Now, on the PHP side, there ARE AES encrypt/decrypt functions available if you need to do the encryption/decryption on the PHP end of things. If you wanted to integrate those into PHPMyAdmin it would mean modifying the source for the program and presumably submitting a patch. But I don't see the point really.


Here:

http://www.phpaes.com/

And yes, it is possible, check memory_limit in your php.ini to avoid problems.

However, if its for mysql storage, remember that you have cryptographic functions inside mysql:

http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号