示例#1
0
 public void Dispose()
 {
     if (_rsa != null)
     {
         _rsa.Dispose();
         _rsa = null;
     }
     _parameter   = new RSAParameters();
     _KeyExponent = null;
     _KeyModulus  = null;
 }
示例#2
0
        public static RSA Create(int keySizeInBits)
        {
            RSA rsa = Create();

            try
            {
                rsa.KeySize = keySizeInBits;
                return(rsa);
            }
            catch
            {
                rsa.Dispose();
                throw;
            }
        }
示例#3
0
        public static RSA Create(RSAParameters parameters)
        {
            RSA rsa = Create();

            try
            {
                rsa.ImportParameters(parameters);
                return(rsa);
            }
            catch
            {
                rsa.Dispose();
                throw;
            }
        }
示例#4
0
 /// <summary>Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</summary>
 public void Dispose()
 {
     _rsa?.Dispose();
     _rsa = null;
 }