加密的数据库查询 [英] Encrypted database query

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

问题描述

我刚刚发现了有关Stack Overflow的信息,我只是在检查项目中是否有一些约束的想法,尽管这更多是我一直以来的理论问题。

I've just found out about Stack Overflow and I'm just checking if there are ideas for a constraint I'm having with some friends in a project, though this is more of a theoretical question to which I've been trying to find an answer for some time.

我对密码学的了解并不多,但是如果我不清楚的话,我会尝试进行编辑/评论以弄清楚任何问题。

I'm not much given into cryptography but if I'm not clear enough I'll try to edit/comment to clarify any questions.

为了简短起见,环境是这样的:

Trying to be brief, the environment is something like this:


  • 该应用程序的前端仅用于访问加密/解密密钥,而后端仅用于存储和查询。

  • An application where the front-end as access to encrypt/decrypt keys and the back-end is just used for storage and queries.

例如,有一个您无法访问几个字段的数据库,让我们说地址,它通常是文本/ varchar。

Having a database to which you can't have access for a couple of fields for example let's say "address" which is text/varchar as usual.

您不能访问用于解密信息的密钥,并且所有信息到达已经加密的数据库。

You don't have access to the key for decrypting the information, and all information arrives to the database already encrypted.

主要问题是这样的由于要始终在数据库上进行查询,因此无法执行诸如'%F§YU/´〜#JKSks23%'之类的地址之类的操作。 (如果有人愿意回答这个问题,可以随时开枪。)

The main problem is something like this, how to consistently make queries on the database, it's impossible to do stuff like "where address like '%F§YU/´~#JKSks23%'". (IF there is anyone feeling with an answer for this feel free to shoot it).

但是在地址='±的地方做可以吗? !NNsj3〜^º-:'?还是会完全吞噬数据库?

But is it ok to do where address='±!NNsj3~^º-:'? Or would it also completely eat up the database?

另一个可能适用的限制是前端没有足够的处理能力,因此已经加密的信息开始将其推向极限。 (这样做只是为了避免诸如将表的连接导出到前端并在其中查询之类的答复。)

Another restrain that might apply is that the front end doesn't have much processing power available, so already encrypting/decrypting information starts to push it to its limits. (Saying this just to avoid replies like "Exporting a join of tables to the front end and query it there".)

有人可以指出我的方向继续思考吗?

Could someone point me in a direction to keep thinking about it?

谢谢您在凌晨4点这么快的回复,对于第一次使用我真的很感动与这个社区。 (或者也许我只是针对不同的时区)

Well thanks for so fast replies at 4 AM, for a first time usage I'm really feeling impressed with this community. (Or maybe I'm it's just for the different time zone)

只需提供一些信息:

主要问题在于部分匹配。在大多数数据库中,强制性要求是允许部分匹配。主要约束实际上是不允许数据库所有者查看数据库内部的信息。在最后10分钟内,我想出了一个可能的解决方案,该解决方案又扩展到可能的数据库问题,我将在此处添加:

The main problem is all around partial matching. As a mandatory requirement in most databases is to allow partial matches. The main constraint is actually the database owner would not be allowed to look inside the database for information. During the last 10 minutes I've come up with a possible solution which extends again to possible database problems, to which I'll add here:

可能的解决方案允许半部分匹配:

Possible solution to allow semi partial matching:


  • 密码和用户的几个公共字段实际上是加密密钥。对于身份验证,其想法是对静态值进行加密,然后在数据库中进行比较。

  • 创建一组新表,以解析的方式存储信息,例如:第四街 将变成2个加密的行( 4代表一个行, Street代表另一个行)。由于已经可以在单独的表上进行搜索,因此已经可以进行半部分匹配。

新问题:


  • 这可能会再次吞噬数据库服务器,还是有人认为这是解决部分匹配问题的可行解决方案?

Post Scriptum:我不接受Cade Roux的回答,只是为了进行进一步讨论,特别是对新问题的可能回答。

推荐答案

您可以按照描述的方式进行操作-有效地查询哈希,例如,但是没有多少系统满足此要求,因为那时安全要求正在干扰系统的其他可用要求-即没有部分匹配,因为加密排除了这种情况。压缩也有同样的问题。多年前,在非常小的环境中,我不得不先压缩数据,然后再将其放入数据格式。当然,这些字段不容易被搜索。

You can do it the way you describe - effectively querying the hash, say, but there's not many systems with that requirement, because at that point the security requirements are interfering with other requirements for the system to be usable - i.e. no partial matches, since the encryption rules that out. It's the same problem with compression. Years ago, in a very small environment, I had to compress the data before putting it in the data format. Of course, those fields could not easily be searched.

在一个更典型的应用程序中,最终,密钥将对链中的某人可用-可能是Web

In a more typical application, ultimately, the keys are going to be available to someone in the chain - probably the web server.

对于最终用户流量,SSL保护该管道。某些网络交换机可以在Web服务器和数据库之间保护它,并且可以在数据库中存储加密的数据,但是您不会像这样查询加密的数据。

For end user traffic SSL protects that pipe. Some network switches can protect it between web server and database, and storing encrypted data in the database is fine, but you're not going to query on encrypted data like that.

并且一旦数据显示出来,它就在计算机上,因此此时可以绕开任何通用计算设备,并且您的应用程序之外还具有外围防御功能。

And once the data is displayed, it's out there on the machine, so any general purpose computing device can be circumvented at that point, and you have perimeter defenses outside of your application which really come into play.

这篇关于加密的数据库查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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