public void Dispose() { if (_rsa != null) { _rsa.Dispose(); _rsa = null; } _parameter = new RSAParameters(); _KeyExponent = null; _KeyModulus = null; }
public static RSA Create(int keySizeInBits) { RSA rsa = Create(); try { rsa.KeySize = keySizeInBits; return(rsa); } catch { rsa.Dispose(); throw; } }
public static RSA Create(RSAParameters parameters) { RSA rsa = Create(); try { rsa.ImportParameters(parameters); return(rsa); } catch { rsa.Dispose(); throw; } }
/// <summary>Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</summary> public void Dispose() { _rsa?.Dispose(); _rsa = null; }