使用 aspnet_regiis 从文件导入 RSA 密钥

Ron*_*nyK 2 aspnet-regiis.exe

尝试导入文件失败,说它已经存在:

C:\Windows\system32>C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis
   -pi "MyRsaKey" c:\key.xml
   Microsoft (R) ASP.NET RegIIS version 4.0.30319.17929
   Administration utility to install and uninstall ASP.NET on the local machine.
   Copyright (C) Microsoft Corporation.  All rights reserved.
   Importing RSA Keys from file..
   Object already exists.
   Failed!
Run Code Online (Sandbox Code Playgroud)

但是删除失败,说找不到:

C:\Windows\system32>C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis
   -pz "MyRsaKey"
   Microsoft (R) ASP.NET RegIIS version 4.0.30319.17929
   Administration utility to install and uninstall ASP.NET on the local machine.
   Copyright (C) Microsoft Corporation.  All rights reserved.
   Deleting RSA Key container...
   The RSA key container was not found.
   Failed!
Run Code Online (Sandbox Code Playgroud)

Ron*_*nyK 5

结果证明该问题与“C:\Users\All Users\Microsoft\Crypto\RSA\MachineKeys”文件夹的权限有关。

确保使用属于机器上管理员组的用户执行命令,并且管理员组是该文件夹的所有者,使这些命令能够成功执行。