gpt4 book ai didi

c# - 编写 C# 代码以使用来自加密的 aspnet_regiis 功能

转载 作者:行者123 更新时间:2023-11-30 13:05:24 28 4
gpt4 key购买 nike

我有一大堆 C# 代码使用以下类型的代码从命令行运行 aspnet_regiis:

        ProcessStartInfo procStartInfo = new ProcessStartInfo(aspRegPath, arguments);
procStartInfo.CreateNoWindow = true;
Process proc = new Process();
proc.StartInfo = procStartInfo;
proc.Start();
....

然后我尝试看看是否可以使用常规 .NET 类实现相同的功能。我能够将 .NET 类用于 aspnet_regiis 正在使用的加密和解密内容,例如:

        ConfigurationSection section = configuration.GetSection("connectionStrings");
section.SectionInformation.ProtectSection("RSAKey");
configuration.Save();

但我找不到 .NET 类来执行其他功能,即

        //Delete container
aspnet_regiis -pz RSAKey

//Create the container
aspnet_regiis -pc RSAKey-exp

//Install the key into a machine-level RSA key provider called DealAxisRSAKey
aspnet_regiis -pi RSAKey pathToKeyFile

//Grant access to the contrainer
aspnet_regiis -pa RSAKey "NT Authority\Network service"

有人知道这是否可行吗?还是我必须使用 aspnet_regiis?

最佳答案

抱歉,没有这样的类……至少在开箱即用的 .net 中没有。您可以构建一个,或者也许其他人已经构建了一个。

关于c# - 编写 C# 代码以使用来自加密的 aspnet_regiis 功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5080971/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com