Esempio n. 1
0
        public void EntityToLogInfoTest()
        {
            LogInfo converted = mapper.ToLogInfo(entity);

            Assert.AreEqual(entity.Id, converted.Id);
            Assert.AreEqual(entity.Messagge, converted.Message);
            Assert.AreEqual(entity.LogType, converted.LogType);
            Assert.AreEqual(entity.Username, converted.Username);
            Assert.AreEqual(entity.Date, converted.Date);
            Assert.IsFalse(converted.Equals(null));
            Assert.IsFalse(converted.Equals(new object()));
        }
Esempio n. 2
0
        /**
         * Verifies the CT Log's signature over the SCT and leaf certificate.
         *
         * @param sct SignedCertificateTimestamp received from the log.
         * @param leafCert leaf certificate sent to the log.
         * @return true if the log's signature over this SCT can be verified, false otherwise.
         */
        bool verifySignature(SignedCertificateTimestamp sct, Certificate leafCert)
        {
            if (!logInfo.Equals(sct.Id))
            {
                throw new CertificateTransparencyException(
                          string.Format(
                              "Log ID of SCT () does not match this log's ID."));
            }
            byte[] toVerify = serializeSignedSCTData(leafCert, sct);

            return(verifySCTSignatureOverBytes(sct, toVerify));
        }