I have a load of C# code that runs aspnet_regiis from the command line using the following type of code:
ProcessStartInfo procStartInfo = new ProcessStartInfo(aspRegPath, arguments);
procStartInfo.CreateNoWindow = true;
Process proc = new Process();
proc.StartInfo = procStartInfo;
proc.Start();
....
Then I was trying see if I can do the same fnctionality using regular .NET classes. I was able to use .NET classes for the encryption and decryption stuff aspnet_regiis was doing using something like:
ConfigurationSection section = configuration.GetSection("connectionStrings");
section.SectionInformation.ProtectSection("RSAKey");
configuration.Save();
But i can’t find .NET classes to do the other functionality i.e.
//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"
Anyone know if this is possible? Or do I have to use aspnet_regiis?
sorry, but there is no such class…at least not in .net out of the box. You can build one or maybe someone else has built one.