I'm encrypting the web.config in our web sites using aspnet_regiis. However, I want the ability to export the encryption key so if we need to move from Machine A to Machine B, asp.net will be able to decrypt it.
When I run aspnetregiis -px "NetFrameworkConfigurationKey" c:\keys.xml -pri, I get the following : 'Key not valid for use in specified state'. I've seen all kinds of responses online but they don't seem to apply. It's not an invalid key because when I use aspnet_regiis to encrypt sections of the web.config, they encrypt fine.
Idea开发者_开发知识库s?
You need to specify the key set as exportable on creation, say Machine A is the machine it is created on
Run this command on Machine A:
aspnet_regiis -pc "NetFrameworkConfigurationKey" –exp
Then import the key on Machine B:
aspnet_regiis -pi "iListingKeys" "C:\New Folder\NetFrameworkConfigurationKey.xml"
More info: http://msdn.microsoft.com/library/yxw286t2.aspx
Maybe you trying export private key that marked as non-exportable.
精彩评论