Esempio n. 1
0
 /// <summary>
 /// Dispose RSA object only if not running on Mono runtime.
 /// Workaround due to a Mono bug in the X509Certificate2 implementation of RSA.
 /// see also: https://github.com/mono/mono/issues/6306
 /// On Mono GetRSAPrivateKey/GetRSAPublickey returns a reference instead of a disposable object.
 /// Calling Dispose on RSA makes the X509Certificate2 keys unusable on Mono.
 /// Only call dispose when using .Net and .Net Core runtimes.
 /// </summary>
 /// <param name="rsa">RSA object returned by GetRSAPublicKey/GetRSAPrivateKey</param>
 internal static void RSADispose(RSA rsa)
 {
     if (rsa != null &&
         !Utils.IsRunningOnMono())
     {
         rsa.Dispose();
     }
 }