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

问题描述

我需要将数据库密码存储在配置文件中。出于明显的原因,我想加密它们(最好用AES加密)。有没有人知道一个Delphi实现,很容易引入到现有的项目中,具有超过10,000行的历史成长(URGH!)源代码?

I need to store database passwords in a config file. For obvious reasons, I want to encrypt them (preferably with AES). Does anyone know a Delphi implementation that is easy to introduce into an existing project with > 10,000 lines of historically grown (URGH!) source code?

澄清:简单的意思是添加单位到项目,增加最大5行代码,其中配置文件被读取并完成。不应该超过15分钟。

Clarification: Easy means adding the unit to the project, adding max. 5 lines of code where the config file is read and be done with it. Should not take more than 15 minutes.

另一个说明:为了创建与数据库的连接,需要密码,不支持应用程序的用户管理方案。所以使用散列没有帮助。数据库引擎检查密码是否有效,而不是应用程序。

Another clarification: The password is needed in order to create a connection to the db, not to support a user management scheme for the application. So using hashes does not help. The db engine checks if the password is valid, not the app.

推荐答案

我再次建议David Barton的。我在几个项目中成功使用它,在阅读使用示例之后不会超过15分钟。它使用麻省理工学院的许可证,所以你可以在商业项目中自由使用,否则。 DCPCrypt实现了许多算法,包括Rijndael,这是AES。

I second the recommendation for David Barton's DCPCrypt library. I've used it successfuly in several projects, and it won't take more than 15 minutes after you've read the usage examples. It uses MIT license, so you can use it freely in commercial projects and otherwise. DCPCrypt implements a number of algorithms, including Rijndael, which is AES.

还有许多可移植的单机(单个单元)实现 - 问题是哪一个信任,除非您准备自己验证某个图书馆的校正。

There are many googlable stand-alone (single-unit) implementations too - the question is which one you trust, unless you are prepared to verify the correctedness of a particular library yourself.

这篇关于Delphi中的密码加密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 03:58