In my .Net Application I want to encrypt the Connection String Configuration Section .
I have created the batch files which include the commands for encryption and decryption . But now business decided to build a small Windows Forms Application which would rather simplify the tasks for the admin . When the admin clicks on the encrypt button , the application should encrypt the file and when he wants to decrypt back , he will hit the decrypt back button alternatively.
But those commands need to be run with administrative privileges . How would I convert the commands stated below to .Net code and also make sure that they run with administrative privileges?
cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319
aspnet_regiis.exe -pc "CustomEncryptKeys" -exp
aspnet_regiis.exe -pa "CustomEncryptKeys" "NT AUTHORITY\NETWORK SERVICE"
aspnet_regiis -pef "connectionStrings" "C:\inetpub\wwwroot\ABC" -prov "CustomEncryptProvider"
Thanks in advance .