'Keyset as registered is invalid exception when Importing a RSA Key Container using aspnet_regiis

I have been trying to import a RSA key container from aspnet_regiis. Steps are as follows.

  1. Run the command prompt as administrator
  2. cd C:\windows\Microsoft.NET\Framework\v2.0.50727
  3. aspnet_regiis -pi myrsakey E:\keyfile.xml

When followed the above steps I get the error as follows

**

Importing RSA Keys from file.. Keyset as registered is invalid. <Exception from HRESULT: 0x8009001A> Failed!

**

For this "Keyset as registered is invalid" error almost every web result says to try renaming RSA file in the path C:\Users\myuser\AppData\Roaming\Microsoft\Crypto to RSA.old and reboot. If that does not work try renaming Crypto folder as Crypto.old. Eventhough I tried these steps it did not resolve the above issue. I am even running the cmd as administrator. So I was not sure what I am missing in here. Would you be help me to find a solution or a workaround for this issue.

Thanks in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source