用于存储个人详细信息的类,包括。银行账户信息,PHP (Mcrypt) 格式 - 这样可以吗?如何改进?
我的任务是编写一个加密函数,让我的老板可以轻松地加密各种数据以进入数据库。这将包括信用卡详细信息银行帐户信息。 我以前从未在 PHP 中使用过加密,所以有点担心。
以下是我迄今为止在 O'reilly 的 Essential PHP Security 的帮助下所做的工作: http://pastebin.com/7L2GxPNJ
IV实际上似乎没有做任何事情,这让我担心。这是为什么呢?
如果有人可以查看这段代码并检查一下,我将非常感激。我和一位朋友交谈过,他认为最好在 PHP 连接到的另一台服务器上编写为守护进程,但这还不能完成 - 我只是在关注订单。
目前来看,有什么可以改进的地方吗? IV号有什么关系?
谢谢。
I've been given the task of writing an encryption function that'll let my boss easily encrypt various bits of data to go into a database. This will include credit card details bank account information.
I've never used encryption within PHP before so am a touch worried.
Here's what I've done so far with the help of O'reilly's Essential PHP Security:
http://pastebin.com/7L2GxPNJ
The IV doesn't actually seem to do anything, which concerns me. Why's that?
Would appreciate it very much if someone could look through this code and check it out. I've spoken to a friend who reckons it'd be better off written as a daemon on another server that PHP would then connect to, however that can't be done yet - I'm just following orders.
For the moment, are there any improvements that could be made? What's the deal with the IV?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
初始化向量相当重要 - 特别是在加密大量小数据片段时。如果加密数据没有被 IV 修改,就会出现问题。如果您将加密密钥与加密数据存储在同一文件系统上,那么这只是隐蔽性的安全性。
An initialization vector is rather important - particularly when encrypting lots of small fragemnts of data. Somethnig is amiss if the encrypted data is not modified by the IV. And if you're storing the encryption key on the same filesystem as the encrypted data, it's just security by obscurity.