dqtdz08206 2011-04-19 23:19
浏览 74
已采纳

我在哪里可以获得PHP的AES加密,并且AES加密可以用于文档存储吗?

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.

  • 写回答

2条回答 默认 最新

  • dtjzpg5313 2011-04-19 23:31
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误