From e5d84ee0143eddf7a78bea920ce647014ed8a43a Mon Sep 17 00:00:00 2001 From: stulzq Date: Tue, 9 Jul 2019 09:09:16 +0800 Subject: [PATCH] [Add] Rsa object Dispose --- XC.RSAUtil/RSAUtilBase.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/XC.RSAUtil/RSAUtilBase.cs b/XC.RSAUtil/RSAUtilBase.cs index 565875d..367d756 100644 --- a/XC.RSAUtil/RSAUtilBase.cs +++ b/XC.RSAUtil/RSAUtilBase.cs @@ -4,7 +4,7 @@ namespace XC.RSAUtil { - public abstract class RSAUtilBase + public abstract class RSAUtilBase:IDisposable { public RSA PrivateRsa; public RSA PublicRsa; @@ -96,5 +96,11 @@ public bool VerifyData(string data, string sign, HashAlgorithmName hashAlgorithm protected abstract RSAParameters CreateRsapFromPrivateKey(string privateKey); protected abstract RSAParameters CreateRsapFromPublicKey(string publicKey); - } + + public void Dispose() + { + PrivateRsa?.Dispose(); + PublicRsa?.Dispose(); + } + } } \ No newline at end of file