Exemple #1
0
        private void VerifyFromTma(Stream output)
        {
            IDataVerifier verifier;

            if (!level.HasValue || level.Value == Level.B_Level || !useTmaInsteadOfTsa)
            {
                verifier = DataVerifierFactory.Create(level);
            }
            else
            {
                verifier = DataVerifierFactory.CreateFromTimemarkAuthority(level.Value, new CurrentTimemarkProvider());
            }

            SignatureSecurityInformation result = verifier.Verify(output);

            Console.WriteLine(result.ToString());


            Assert.AreEqual(validationStatus, result.ValidationStatus);
            Assert.AreEqual(trustStatus, result.TrustStatus);
            Assert.AreEqual(subject, result.Signer.Subject);
            Assert.IsNull(result.TimestampRenewalTime);
            Assert.IsNotNull(result.SignatureValue);
            Assert.IsTrue((DateTime.UtcNow - result.SigningTime) < new TimeSpan(0, 1, 0));
            Assert.IsFalse(result.IsNonRepudiatable); //outer is never repudiatable
        }
Exemple #2
0
        //todo make it green
        private void Verify(Stream output)
        {
            IDataVerifier verifier = DataVerifierFactory.Create(level);

            SignatureSecurityInformation result = verifier.Verify(output);

            Console.WriteLine(result.ToString());

            Assert.AreEqual(validationStatus, result.ValidationStatus);
            Assert.AreEqual(trustStatus, result.TrustStatus);
            Assert.IsNull(result.Signer);
            Assert.IsNotNull(result.SignerId);
            Assert.AreEqual((level & Level.T_Level) == Level.T_Level, result.TimestampRenewalTime > DateTime.UtcNow);
            Assert.IsNotNull(result.SignatureValue);
            Assert.IsTrue((DateTime.UtcNow - result.SigningTime) < new TimeSpan(0, 1, 0));
            Assert.IsFalse(result.IsNonRepudiatable); //outer is never repudiatable
        }