这是加密用户数据的好方法吗? [英] Is this a good way to encrypt user data?

查看:52
本文介绍了这是加密用户数据的好方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对存储在服务器上的用户数据进行加密,以确保服务器受到威胁时是安全的.以下是执行此操作的好方法:

I'd like to encrypt the user data I store on my server so that it is safe if my server were to be compromised. Is the following a good way to do it:

每个用户的密码都是GPG密钥对的密码.在将所有用户数据保存到数据库之前,将使用公钥对其进行加密.密码将被丢弃,并且密钥对仅在会话期间保持不变,因此只有在提供密码后才能解密数据.

Each user's password is the passphrase to a GPG keypair. All the user's data is encrypted using the public key before being saved to the database. The password is discarded and the keypair is kept only for the duration of the session, so the data can only be decrypted when the password is supplied.

推荐答案

从有人破坏服务器的角度来看,确保数据安全的唯一方法就是用户必须提供数据时所采用的方法.每次解密的密钥.

From the point of view of someone compromising your server, the only way to ensure the data is safe is the way you are doing, when the user have to supply the key to decrypt every time.

任何其他技术都会留下一些可以利用的弱点.

Any other technique leaves some weakness that could be exploited.

但是您必须确保使用https以及防止会话攻击,交叉脚本等的另一种方式(我的意思是当用户提供密码时)也是安全的.

But you have to be sure the other way (I mean when user provides the password) is secure too, using https and preventions against session attacks, cross scripting and etc.

如果您没有特定的硬件来做额外的保护,例如当它们根据时间(如银行令牌)或类似的东西生成伪随机数时,最好的办法是将密钥保持在用户或使用具有更高安全性的第三方存储作为Azure或Amazon上的SQL.

If you do not have specific hardware to do an extra line of protection as when they are generated pseudo-random numbers based on time (as do the banks tokens) or something like that, the best idea is to keep the keys with the user or to use a third part storage with greater security as the SQL on Azure or Amazon.

在考虑了将加密密钥放置在什么地方以使数据变得晦涩时,即使服务器遭到破坏,我也使用了相同的方法.我发现的唯一安全方法是与用户一起使用".

I used the same approach after thought a lot about where to put my encrytion keys to make data obscure even if my server got compromised. The only secure way I found was "with the user".

这篇关于这是加密用户数据的好方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆