Hi,
I have some keys I am storing in the machine key store. Occasionally there is a need to dump the old key and create a new one. I have provided a web form for that purpose, however when I set the RSACryptoServiceProvider property PersistKeyInCspto false, in order to remove the old one, I get the exception:
The process does not possess the 'SeSecurityPrivilege' privilege which is required for this operation.
at System.Security.AccessControl.Privilege.ToggleState(Boolean enable)
at System.Security.Cryptography.Utils.GetKeySetSecurityInfo(SafeProvHandle hProv, AccessControlSections accessControlSections)
at System.Security.Cryptography.CspKeyContainerInfo.get_CryptoKeySecurity()
If I don't remove the old one the new one fails with an already exists error.
Is there anyway to raise/elevate/grant this privilege programmatically on .NET 4.5?
Thanks!