I am attempting to encrypt connection string values in the Web.Config file for an ASP.NET 2.0 web application, following the procedure described on MSDN. Using the RsaProtectedConfigurationProvider, I created and exported a machine-level key on my development machine (using the -pri flag), and imported the key and granted access on the web server. Prior to testing automatic decryption by ASP.NET, I wanted to try manually decrypting the Web.Config.
I am able to manually encrypt and decrypt the Web.Config on the same machine using the -pef and -pdf parameters respectively, but manually decrypting on the web server fails with a "Bad Data" error message.
The oddest thing is that the keyContainerName attribute in my Web.Config file seems to be ignored. If I try replacing the correct value with gibberish (no longer corresponding to any key container I have created) the encryption and decryption still work on my development machine. Any ideas?