Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Delete RSA key from machine key store from Web Forms

$
0
0

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!


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>