0

Please share your thoughts if there is any way to encrypt app.config section with out changing code? I know that we can use aspnet_regiis.exe to encrypt the web.config file.

I came across some blogs to rename app.config to web.config and run aspnet_regiis -pef command. I am able to create an encrypted version of app.config file but application failed to read the keys from encrypted app.config. so this approach didnt work for me.

Many thanks

swork
  • 1
  • 1
  • 1
    the app.config file is for a class library project? How does that work? – BrokenGlass Jan 05 '11 at 16:12
  • We have a class library for data accessing and app.config with connection string and stored procedure names. Class library is being referenced in the webapplication. App.config is being copied in to the web application bin folder as assemblyname.dll.config! – swork Jan 05 '11 at 16:21

1 Answers1

2

What about this way? Are you able to do that?

  1. Encrypt your connection strings and stored procedure names in app.config. (Use like tripleDes)

  2. Store your encrypted values in app.config.(like: ConnectionString="asdasfasfasfdsdgsdfa")

  3. After reading value from app.config, decrypt it with your service and use.

by the way I found my old answer about ready to use Crypto Class :)

.NET: what are my options for decrypting a password in my project .setting file

Community
  • 1
  • 1
Serkan Hekimoglu
  • 4,234
  • 5
  • 40
  • 64
  • I dont think this will work since swork does not want to change his code. And having an encrypted CS will require the application to decrypt it. – Henri Jan 05 '11 at 20:04
  • In my opinion, this is the best way. Just create new class library, and copy/paste my codes. Required decryption function is included in my codes. You have whatever you need with these codes. – Serkan Hekimoglu Jan 06 '11 at 07:17
  • thanks for giving me ready to use crypto class. I'm curious to know if its possible to achieve with out any changes to the code. (in other words may be in the similar way as web.config encryption) – swork Jan 06 '11 at 09:19