Writing C # code to use the aspnet_regiis encryption function

I am loading C # code that runs aspnet_regiis from the command line using the following code type:

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

Then I tried to see if I could do the same using regular .NET classes. I was able to use the .NET classes for encryption and decryption, which aspnet_regiis did with something like:

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

But I can not find .NET classes to perform other functions.

  //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" 

Does anyone know if this is possible? Or do I need to use aspnet_regiis?

+4
source share
1 answer

sorry, but there is no such class ... at least not in .net out of the box. You can build one, or maybe someone else built it.

0
source

Source: https://habr.com/ru/post/1340818/


All Articles