How do I manually Dispose RSACryptoServiceProvider?
Posted
by phq
on Stack Overflow
See other posts from Stack Overflow
or by phq
Published on 2010-03-19T21:06:37Z
Indexed on
2010/03/19
21:11 UTC
Read the original article
Hit count: 456
I have read on MSDN(see Important note) that RSACryptoServiceProvider must be disposed. They give the example:
using (RSACryptoServiceProvider RSA = new RSACryptoServiceProvider())
Now I'm trying to include RSACryptoServiceProvider into MyClass making use of it in several Methods. With this setup I cannot use the using statement.
Instead I try to call the .Dispose() Method of the RSACryptoServiceProvider object at a suitable time but then I get the compile error message:
`System.Security.Cryptography.AsymmetricAlgorithm.Dispose(bool)' is inaccessible due to its protection level
Is RSACryptoServiceProvider not supposed to be used longer than one function call(using the using statement)?
How can I fix this, is not making the Dispose call an option?
© Stack Overflow or respective owner