0

I am trying to import an RSA Key. I open cmd prompt in Admin mode, go to C:\Windows\Microsoft.NET\Framework64\v4.0.30319 and my command is as follows: aspnet_regiis - pi "Key" "S:\RSAKeys\Key.xml" -pku

This is the exact same command that my coworker used and it worked perfectly for him. When I try it though, I get "Importing RSA Keys from file..Unable to find the specified file. Failed!"

What could be different between our machines?

I have also tried different things (removing the -pku, trying it not as admin, etc.) but in the end it doesn't fully work.

Trying it not as admin with -pku will say succeeded (but then when I try to use the service, it errors with "The RSA key container could not be opened"). Trying it not as admin without -pku will error with "Access is denied."

Edit 1: Looks like a read perms issue between S drive and C drive maybe. Putting the file on the C drive was able to succeed the import but still receiving an error from the service that uses the import saying the rsa key container could not be opened.

Final Edit: After some research, I discovered that I needed to change permissions. I used these documents to help: https://serverfault.com/questions/293416/the-rsa-key-container-could-not-be-opened-windows-server-2008-r2 http://austrianalex.com/rsaprotectedconfigurationprovider-not-recommended-for-children-under-5.html The RSA key container could not be opened

Unfortunately, none of them fixed the problem. Somehow, the RSA key was imported where even the Admin group didn't have the permissions it needed to change permissions. So I went and found the RSA key under the C:\Users\All Users\Microsoft\Crypto\RSA\MachineKeys folder. I had originally tried giving the Administrator group (which was only me anyways) full permissions but received a Safe Handle Error and had to remove that.

Finally, I added myself (not the administrator group) with full permissions and it worked. Thanks @Thymine for pointing me in the right direction!

sam
  • 1
  • 1
  • 1
    What happens if you do `dir S:\RSAKeys\ ` in the admin cmd prompt? – Thymine Jul 30 '18 at 13:52
  • 1
    So it says The system cannot find the path specified. That gives me the idea maybe it's some read perm issue between S drive and C drive so I tried copying and pasting the file into my C drive and tried again using that file. It says succeeded. Except, even though it says succeeded, I still get "The RSA key container could not be opened" when I run the service that uses the RSA key file. – sam Jul 30 '18 at 14:22
  • 1
    Yeah either permission or the drive might not be mapped for your admin user, can you even `cd S:` in the cmd prompt? – Thymine Jul 30 '18 at 14:27
  • Hah, no, I can't. System says it can't find the drive. – sam Jul 30 '18 at 14:28

0 Answers0