CryptographicException:访问被拒绝 OpenFlags.ReadWrite

问题描述 投票:0回答:1

尝试使用 OpenFlags.ReadWrite 打开本地证书存储时访问被拒绝。当我使用 OpenFlags.MaxAllowed 时它工作正常。我尝试授予文件夹 C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys 的读/写权限,但仍然没有成功。有什么想法我需要读/写访问哪些文件夹权限吗?

这是我的代码

private void Run()
{
    //grab the certs that are on the local machine
    X509Store store = new X509Store(StoreName.Root, StoreLocation.LocalMachine);

   
    store.Open(OpenFlags.ReadWrite);

                    
    store.Close();
}
.net windows file-permissions x509certificate2
1个回答
0
投票

应用程序必须在本地管理员帐户下执行,才能以写入模式打开本地计算机存储。

© www.soinside.com 2019 - 2024. All rights reserved.