douguachan2879 2011-11-24 04:38
浏览 125
已采纳

PHP AES加密 - 无法解密存储在数据库中的某些值

I'm using http://www.phpaes.com/ to encrypt some values and store them in a MySQL database. The column type for the database is VARBINARY(512) which is the only one that seemed to work.

The values (plain text) are strings not longer than 128 chars but as this is my first take on something more serious than plain md5 or such I do think I'm doing something very bad here. First of all, the initialization vector is always the same, but this really isn't a concern for this project.

Problem is, when I decrypt the values, some values come out ok while other's not. Any idea what could the problem be here?

I'm using OFB cypher mode, 256 bit key and the values are email addresses and phone numbers.

Any help would be much appreciated.

Thanks

  • 写回答

1条回答 默认 最新

  • dou4064 2011-11-24 05:04
    关注

    I had a similar problem. You have to change the column type to BLOB. If that doesn't work, try trimming your strings or data or whatever.

    Also, MySQL comes with AES functionality. Did you consider that?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料