I was trying to use Enterprise Library to encrypt my connection string stored in App.config file. In the beginning everything works fine. What I did was
1. Open Enterprise Library Configuration
2. Locate App.config file.
3. Select Data Access Application Block
4. Select Protection to be DataProtectedConfigurationProvider
Then I noticed that the connection string is now being encrypted, and I can still run the program.
However, after a while when I want to remove the encryption, I simple replace the encrypted app.config back with unencrypted app.config. When I run my program again, I get the following error:
A first chance exception of type 'System.Security.Cryptography.CryptographicException' occurred in mscorlib.dll
A first chance exception of type 'System.TypeInitializationException' occurred in XXXX.exe
After that, I tried to replace it back with Encrypted App.config, Change Protection Provider, and anything I can think of, I still get this error. I believe the inner error for the exception is "Bad Data".
Can anyone help me with this?