简体   繁体   English

如何修改加密的app.config文件的密钥和值?

[英]How to modify the keys and values of an encrypted app.config file?

I am very new on c#/Visual Studio and I'm having difficulty on running my test methods. 我在c#/ Visual Studio上还很新,在运行测试方法时遇到困难。 It requires us to connect to a database server resulting of getting always a failed result since we can't connect to the database. 它要求我们连接到数据库服务器,因为总是无法获得结果,因为我们无法连接到数据库。

We tried to modify the connection string to include our working credentials so that we can connect to the database server but the app.config file was encrypted. 我们试图修改连接字符串以包括我们的工作凭证,以便我们可以连接到数据库服务器,但是app.config文件已加密。

Please see below screenshot of example encrypted line. 请参见以下示例加密行的屏幕截图。 How can we modify that? 我们如何修改呢?

在此处输入图片说明

As I see it I think the connectionstring is encrypted outside the project and pasted here. 如我所见,我认为连接字符串在项目外部已加密并粘贴在此处。 I am saying this because IMO encrypting just the connection string value and keeping the key in plain text is not possible from within the project. 我之所以这样说是因为IMO无法从项目内部仅加密连接字符串value并将key保持为纯文本格式。 It is possible to encrypt the entire section within a config file. 可以对配置文件中的整个部分进行加密。

Check the method which is using this connectionstring. 检查使用此连接字符串的方法。 I believe The method might be using some form of decryption. 我相信该方法可能正在使用某种形式的解密。 Use that to decrypt the string, change the values as required, encrypt it again and paste it in the above location. 使用它来解密字符串,根据需要更改值,再次对其进行加密,然后将其粘贴到上述位置。

You can also edit your question to include the method which is using the connectionstring so that I can analyse it and give you a better solution. 您还可以编辑问题以包括使用连接字符串的方法,以便我可以对其进行分析并为您提供更好的解决方案。

Hope this helps. 希望这可以帮助。

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

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