コード例 #1
1
        public void kgss()
        {
            EncryptionToken receiver = new EncryptionToken(Utils.ReadFully("../../etk/kgss.etk"));
            CertificateSecurityInformation info = receiver.Verify();
            Console.WriteLine(info.ToString());

            Assert.IsNotNull(info.ToString());
            Assert.AreEqual(ETEE::Status.TrustStatus.Full, info.TrustStatus);
            Assert.AreEqual(ValidationStatus.Valid, info.ValidationStatus);
        }
コード例 #2
0
        public void Bob2()
        {
            EncryptionToken receiver = new EncryptionToken(Utils.ReadFully("../../etk/Bob2_public_key.etk"));
            CertificateSecurityInformation info = receiver.Verify();
            Console.WriteLine(info.ToString());

            Assert.IsNotNull(info.ToString());
            Assert.AreEqual(ETEE::Status.TrustStatus.Unsure, info.TrustStatus);
            Assert.AreEqual(ValidationStatus.Valid, info.ValidationStatus);

            Assert.IsTrue(info.SecurityViolations.Contains(CertSecurityViolation.IssuerTrustUnknown));
            Assert.IsTrue(info.IssuerInfo.SecurityViolations.Contains(CertSecurityViolation.RevocationStatusUnknown));
        }
コード例 #3
0
        public void ValidButScrambledDN()
        {
            EncryptionToken receiver = new EncryptionToken(Utils.ReadFully("../../etk/valid_but_scrambledDN.etk"));
            CertificateSecurityInformation info = receiver.Verify();
            Console.WriteLine(info.ToString());

            Assert.IsNotNull(info.ToString());
            Assert.AreEqual(ETEE::Status.TrustStatus.None, info.TrustStatus);
            Assert.AreEqual(ValidationStatus.Valid, info.ValidationStatus);

            Assert.IsTrue(info.SecurityViolations.Contains(CertSecurityViolation.UntrustedIssuer));
            Assert.IsTrue(info.IssuerInfo.SecurityViolations.Contains(CertSecurityViolation.NotValidForUsage));
        }
コード例 #4
0
        public void NotYetAuth()
        {
            EncryptionToken receiver = new EncryptionToken(Utils.ReadFully("../../etk/not_yet_auth.etk"));
            CertificateSecurityInformation info = receiver.Verify();
            Console.WriteLine(info.ToString());

            Assert.IsNotNull(info.ToString());
            Assert.AreEqual(ETEE::Status.TrustStatus.None, info.TrustStatus);
            Assert.AreEqual(ValidationStatus.Valid, info.ValidationStatus);

            Assert.IsTrue(info.SecurityViolations.Contains(CertSecurityViolation.UntrustedIssuer));
            Assert.IsTrue(info.IssuerInfo.SecurityViolations.Contains(CertSecurityViolation.NotTimeValid));
        }
コード例 #5
0
        public void MixedKeyAlgorithm()
        {
            EncryptionToken receiver = new EncryptionToken(Utils.ReadFully("../../etk/invalid_key_algorithm.etk"));
            CertificateSecurityInformation info = receiver.Verify();
            Console.WriteLine(info.ToString());

            Assert.IsNotNull(info.ToString());
            Assert.AreEqual(ETEE::Status.TrustStatus.None, info.TrustStatus);
            Assert.AreEqual(ValidationStatus.Valid, info.ValidationStatus);

            Assert.IsTrue(info.SecurityViolations.Contains(CertSecurityViolation.UntrustedIssuer));
            Assert.IsTrue(info.IssuerInfo.SecurityViolations.Contains(CertSecurityViolation.NotValidKeyType)); //this is why it is invailid, not because of the key type
        }
コード例 #6
0
        public void InvalidKeySize()
        {
            EncryptionToken receiver = new EncryptionToken(Utils.ReadFully("../../etk/invalid_key_size.etk"));
            CertificateSecurityInformation info = receiver.Verify();
            Console.WriteLine(info.ToString());

            Assert.IsNotNull(info.ToString());
            Assert.AreEqual(ETEE::Status.TrustStatus.None, info.TrustStatus);
            Assert.AreEqual(ValidationStatus.Invalid, info.ValidationStatus);

            Assert.IsTrue(info.SecurityViolations.Contains(CertSecurityViolation.NotValidKeySize));
            //This is no longer the case because we allow eID with 1024 bit keys.
            //Assert.IsTrue(info.IssuerInfo.SecurityViolations.Contains(CertSecurityViolation.NotValidKeySize));
        }
コード例 #7
0
        public void InvalidEncKeyUsage()
        {
            EncryptionToken receiver = new EncryptionToken(Utils.ReadFully("../../etk/invalid_encrkey_usage.etk"));
            CertificateSecurityInformation info = receiver.Verify();
            Console.WriteLine(info.ToString());

            Assert.IsNotNull(info.ToString());
            Assert.AreEqual(ETEE::Status.TrustStatus.None, info.TrustStatus);
            Assert.AreEqual(ValidationStatus.Invalid, info.ValidationStatus);

            Assert.IsTrue(info.SecurityViolations.Contains(CertSecurityViolation.NotValidForUsage));
        }
コード例 #8
0
        public void ExpiredEnc()
        {
            EncryptionToken receiver = new EncryptionToken(Utils.ReadFully("../../etk/expired_encr.etk"));
            CertificateSecurityInformation info = receiver.Verify();
            Console.WriteLine(info.ToString());

            Assert.IsNotNull(info.ToString());
            Assert.AreEqual(ETEE::Status.TrustStatus.Unsure, info.TrustStatus);
            Assert.AreEqual(ValidationStatus.Invalid, info.ValidationStatus);

            Assert.IsTrue(info.SecurityViolations.Contains(CertSecurityViolation.NotTimeValid));
        }
コード例 #9
0
        public void DifferentDN()
        {
            EncryptionToken receiver = new EncryptionToken(Utils.ReadFully("../../etk/auth_and_encr_not_same_DN.etk"));
            CertificateSecurityInformation info = receiver.Verify();
            Console.WriteLine(info.ToString());

            Assert.IsNotNull(info.ToString());
            Assert.AreEqual(ETEE::Status.TrustStatus.None, info.TrustStatus);
            Assert.AreEqual(ValidationStatus.Invalid, info.ValidationStatus);

            Assert.IsTrue(info.SecurityViolations.Contains(CertSecurityViolation.HasNotPermittedNameConstraint));
        }