2011-02-22 55 views
4

我有一个命令行使用以下类型的代码ASPNET_REGIIS运行的C#代码的负载:编写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?

+0

你想要一个具有aspnet_iisreg功能的.net类,所以你不必打电话给外部命令?或者你是否想要加密的东西用于你的调用aspnet_iisreg?你的问题不是很清楚。 – 2011-02-22 16:37:08

回答

0

对不起,但没有这样的课......至少不是在.net开箱。你可以建立一个或者也许别人已经建立了一个。