コード例 #1
0
        private bool IsInstallerValid(string path)
        {
            X509Certificate2 cert = CertificateUtility.CreateCertificateFromFile(path);

            //
            // Only use Microsoft signed MSI
            if (cert.Subject.Contains("O=Microsoft Corporation,"))
            {
                var chain = new X509Chain();

                chain.ChainPolicy.RevocationFlag     = X509RevocationFlag.EntireChain;
                chain.ChainPolicy.VerificationFlags |= X509VerificationFlags.IgnoreNotTimeValid;

                return(chain.Build(cert));
            }

            return(false);
        }