加密的连接字符串 [英] Encrypted Connection String

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

问题描述

我需要在

web.config文件中存储加密的连接字符串。我在网上发现了几个例子,但没有具体说明如何完成任务。


提前谢谢,


Dave

解决方案

Dave,


您可以使用System.Security中的类.Cryptography命名空间

加密/解密文件。但是,你遇到另一个问题,你将把钥匙存放在哪里?
?如果你将它存储在程序集中,可以浏览程序集以查找密钥,然后其他人可以使用它来解密你的

数据。


希望这会有所帮助。

-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


" Dave Bailey" <一个******* @ discussions.microsoft.com>在留言中写道

news:0c **************************** @ phx.gbl ... < blockquote class =post_quotes>我需要在
web.config文件中存储加密的连接字符串。我在网上找到了几个例子,但没有具体说明如何完成任务。

提前致谢,

戴夫


Dave,


查看此工具: http://www.obviex.com/cipherlite/ 。但是,你必须知道它的漏洞。你想要的是一件安全的b / b $ b $时尚不容易的事情。阅读本文以获取更多信息(保护数据库连接

代码中的字符串和其他敏感设置):
http://msdn.microsoft.com/msdnmag/is...otectYourData/


Alek


" Dave Bailey" <一个******* @ discussions.microsoft.com>在留言中写道

news:0c **************************** @ phx.gbl ... < blockquote class =post_quotes>我需要在
web.config文件中存储加密的连接字符串。我在网上找到了几个例子,但没有具体说明如何完成任务。

提前致谢,

戴夫


Windows中的Data Protection API在这方面会有所帮助。我记得看过一篇关于如何在杂志中这样做的文章,但是不记得是哪一篇。


DPAPI需要p / invoke到Windows API。


" Nicholas Paldino [.NET / C#MVP]" < mv*@spam.guard.caspershouse.com>写在

消息新闻:ek ************** @ TK2MSFTNGP12.phx.gbl ...

Dave,

您可以使用System.Security.Cryptography命名空间
中的类来加密/解密文件。但是,你遇到了另一个问题,你将把钥匙存放在哪里?如果将它存储在组件中,可以浏览组件以找到密钥,然后其他人可以使用它来解密您的
数据。

希望这会有所帮助。

-
- Nicholas Paldino [.NET / C#MVP]
- mv * @ spam.guard.caspershouse.com

Dave Bailey <一个******* @ discussions.microsoft.com>在消息中写道
新闻:0c **************************** @ phx.gbl ...

我需要在
web.config文件中存储加密的连接字符串。我在网上找到了几个例子,但没有具体说明如何完成任务。

提前致谢,

戴夫



I need to store an encrypted connection string in the
web.config file. I have found several examples on the Net
but nothing specific as to how to accomplish task.

Thanks in advance,

Dave

解决方案

Dave,

You can use the classes in the System.Security.Cryptography namespace to
encrypt/decrypt a file. However, you run into another problem, where will
you store the key? If you store it in the assembly, the assembly can be
browsed to find the key and then someone else can use it to decrypt your
data.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Dave Bailey" <an*******@discussions.microsoft.com> wrote in message
news:0c****************************@phx.gbl...

I need to store an encrypted connection string in the
web.config file. I have found several examples on the Net
but nothing specific as to how to accomplish task.

Thanks in advance,

Dave



Dave,

Check out this tool: http://www.obviex.com/cipherlite/. You must be aware of
its vulnerabilities, though. What you want is not easy to do in a secure
fashion. Read this article for more info ("Safeguard Database Connection
Strings and Other Sensitive Settings in Your Code"):
http://msdn.microsoft.com/msdnmag/is...otectYourData/.

Alek

"Dave Bailey" <an*******@discussions.microsoft.com> wrote in message
news:0c****************************@phx.gbl...

I need to store an encrypted connection string in the
web.config file. I have found several examples on the Net
but nothing specific as to how to accomplish task.

Thanks in advance,

Dave



The Data Protection API in Windows would help here. I remember seeing an
article about how to do this in a magazine, but cannot remember which one.

The DPAPI, would require p/invoke to the Windows API.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ek**************@TK2MSFTNGP12.phx.gbl...

Dave,

You can use the classes in the System.Security.Cryptography namespace to encrypt/decrypt a file. However, you run into another problem, where will
you store the key? If you store it in the assembly, the assembly can be
browsed to find the key and then someone else can use it to decrypt your
data.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Dave Bailey" <an*******@discussions.microsoft.com> wrote in message
news:0c****************************@phx.gbl...

I need to store an encrypted connection string in the
web.config file. I have found several examples on the Net
but nothing specific as to how to accomplish task.

Thanks in advance,

Dave




这篇关于加密的连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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