Exemplo n.º 1
0
 /// <summary>
 /// Adds the thumbprint to identify valid self signed certificates.
 /// </summary>
 /// <param name="thumbprint">The thumbprint.</param>
 public static void AddSelfSignedThumbprint(string thumbprint)
 {
     thumbprint = thumbprint.Replace(":", "");
     thumbprint = thumbprint.Replace(" ", "");
     thumbprint = thumbprint.ToUpperInvariant();
     if (SelfSignedThumbprints.Count == 0)
     {
         ServicePointManager.ServerCertificateValidationCallback += CertificateValidationCallback;
     }
     SelfSignedThumbprints.Add(thumbprint);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Removes thumbprint to identify valid self signed certificates.
        /// </summary>
        /// <param name="thumbprint">The thumbprint.</param>
        public static void RemoveSelfSignedThumbprint(string thumbprint)
        {
            thumbprint = thumbprint.Replace(":", "");
            thumbprint = thumbprint.Replace(" ", "");
            thumbprint = thumbprint.ToUpperInvariant();
            SelfSignedThumbprints.Remove(thumbprint);
            if (SelfSignedThumbprints.Count == 0)
            {
// ReSharper disable DelegateSubtraction
                ServicePointManager.ServerCertificateValidationCallback -= CertificateValidationCallback;
// ReSharper restore DelegateSubtraction
            }
        }