Exemplo n.º 1
0
        /// <summary>
        /// The is valid crypto request.
        /// </summary>
        /// <param name="certificate">
        /// The certificate.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        private static bool IsValidCryptoCertificate(X509Certificate certificate)
        {
            var certin = certificate as X509Certificate2;

            if (certin != null)
            {
                X509Certificate2 certOut = null;
                if (CertUtil.TryResolveCertificate(StoreName.CertificateAuthority, StoreLocation.LocalMachine, X509FindType.FindByThumbprint, certin.Thumbprint, out certOut))
                {
                    return(true);
                }

                // azure website only supports the current user store.
                if (CertUtil.TryResolveCertificate(StoreName.My, StoreLocation.CurrentUser, X509FindType.FindByThumbprint, certin.Thumbprint, out certOut))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 2
0
        private static bool IsValidCryptoCertificate(X509Certificate certificate)
        {
            var certin = certificate as X509Certificate2;

            if (certin != null)
            {
                X509Certificate2 certOut = null;
                if (CertUtil.TryResolveCertificate(StoreName.CertificateAuthority, StoreLocation.LocalMachine, X509FindType.FindByThumbprint, certin.Thumbprint, out certOut))
                {
                    return(true);
                }

                // TODO: this is a temporary fix to allow fiddler certificates to pass validation.
                if (CertUtil.TryResolveCertificate(StoreName.My, StoreLocation.CurrentUser, X509FindType.FindByThumbprint, certin.Thumbprint, out certOut))
                {
                    return(true);
                }
            }

            return(false);
        }