I wrote a C# Window Application whose app.config file contains sensitive data. I want to encrypt a section of app.config using RsaProtectedConfigurationProvider. I know that for this I have to generate a pair of RSA keys and import them in every machine where this program is going to be run.
I do the key generation process with the following command.
aspnet_regiis -pc "SampleKeys"–exp
The process is done correctly and even when I look at "C:\Documents and Settings\All Users\Microsoft\Crypto\RSA\MachineKeys" address, the key file is made in it.
But when I run the following command to export the key..
aspnet_regiis -px "SampleKeys" "C:\keys.xml" -pri
I get this error message.
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -px "TestKey2" c:\keys.xml -pri
Microsoft (R) ASP.NET RegIIS version 4.0.30319.0
Administration utility to install and uninstall ASP.NET on the local machine.
Copyright (C) Microsoft Corporation. All rights reserved.
Exporting RSA Keys to file...
The RSA key container was not found.
Failed!
Thank you for guiding me in this regard.