Ejemplo n.º 1
0
        static public bool CertificateCompare(X509Certificate cert1, X509Certificate cert2)
        {
            if( cert1 == null || cert2 == null )
            {
                Log.Comment("One of the certificates is null");
                return false;
            }

            byte [] cert1Bytes = cert1.GetRawCertData();
            byte [] cert2Bytes = cert2.GetRawCertData();

            return CertificateCompare(cert1Bytes, cert2Bytes);
        }
        public MFTestResults GetRawDataNewCert()
        {
            MFTestResults testResult = MFTestResults.Fail;

            Log.Comment("Get the raw data from the valid certificate");

            try
            {
                X509Certificate cert = new X509Certificate(CertificatesAndCAs.newCert);
                byte[] rawCert = cert.GetRawCertData();

                if (Tools.CertificateCompare(CertificatesAndCAs.newCert, rawCert))
                    testResult = MFTestResults.Pass;
            }
            catch (Exception e)
            {
                Log.Comment("Incorrectly threw exception calling GetRawCertData: " + e.ToString());
                testResult = MFTestResults.Fail;
            }

            return testResult;
        }