简体   繁体   English

如何加密和解密连接字符串

[英]How to encrypt and decrypt connection string

I've read several posts but I've yet to find something that helps me.我已经阅读了几篇文章,但我还没有找到对我有帮助的东西。

I've got a simple C# winforms application that connects to a SQL DB.我有一个连接到 SQL DB 的简单 C# winforms 应用程序。 What I want to do is to encrpyt this string and decryt it on the fly.我想要做的是加密这个字符串并即时解密它。 I've found this thread which does what I want - Encrypting & Decrypting a String in C#我发现这个线程可以做我想要的 - Encrypting & Decrypting a String in C#

but .... where to I then store the key/saltkey?但是......然后我在哪里存储密钥/saltkey? Any help would be great!任何帮助都会很棒!

你必须把你的连接字符串放在 app.config 中,然后你应该加密你的配置文件,请参阅这篇文章以了解更多详细信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM