0

I know you can encrypt sections of Web.config and App.config but I have a .NET application from a vendor that uses a custom config file (ie, myApp.config) that has a similar structure to a .NET config file. Can you use the same methods with aspnet_regiis to encrpyt this file too?

2
  • 1
    "the same methods"... which "same methods"? Commented Oct 2, 2018 at 15:44
  • aspnet_regiis and RsaProtectedConfigurationProvider Commented Oct 2, 2018 at 19:24

3 Answers 3

1

aspnet_regiis is designed for .NET configuration files and your custom file would need to have the same structure as a web.config file, including a top-level configuration node. An alternative approach is to limit access using NTFS file permissions and Encrypting File System (EFS). The ApplicationPoolIdentity in IIS would need NTFS permissions in that case.

Sign up to request clarification or add additional context in comments.

Comments

0

Most of the articles I have found specifically mentioned encrypting asp.net configs but there are some articles that describe how to encrypt custom configs as well.

Here is one example with a thorough description of the entire process:

https://www.c-sharpcorner.com/article/encrypting-app-config-for-multiple-machines/

Hope that helps!!!

1 Comment

The link was quite useful to me. Thanks. It's true that you should add the key part about "...you need to rename your file Web.config and then the process is the same...etc." to your answer. It's not you; it really is for finding better answers on SO.
0

You cannot do this unless it follows the same structure as Web.config. First, as shown in the link Mark H provided, there is a hack of renaming your file to Web.config, doing the encryption, then renaming the file to the original name. Unfortunately, I do not have a configuration node, which leads to this error:

enter image description here

While I can add a configuration node, that will affect the original app so it will not work.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.