コード例 #1
0
        public void extendedKeyUsageConstructorTest1()
        {
            bool             Critical = true;
            extendedKeyUsage target   = new extendedKeyUsage(Critical);

            Assert.IsTrue(target.Critical);
        }
コード例 #2
0
        public void extendedKeyUsageConstructorTest()
        {
            XElement         xml    = testData1;
            extendedKeyUsage target = new extendedKeyUsage(xml);

            Assert.AreEqual(target.ToXml().ToString(), testData1.ToString());
        }
コード例 #3
0
        // Load an existing extension
        internal void edit(extendedKeyUsage eku)
        {
            extKeyUsage  = eku;
            enableEvents = false;

            // Setup the checkboxes
            foreach (string _eku in extKeyUsage.ExtKUsage)
            {
                foreach (CheckBox cb in cblist)
                {
                    if ((string)cb.Tag == _eku)
                    {
                        cb.Checked = true;
                    }
                }
            }
            // critical setting
            if (extKeyUsage.Critical)
            {
                cbCritical.Checked = true;
            }
            else
            {
                cbCritical.Checked = false;
            }

            enableEvents = true;
        }
コード例 #4
0
        public ExtendedKeyUsage(extendedKeyUsage eku)
        {
            InitializeComponent();
            cblist = new CheckBox[] {
                cbAnyExtendedKeyUsage,
                cbServerAuth,
                cbClientAuth,
                cbCodeSigning,
                cbEmailProtection,
                cbIpsecEndSystem,
                cbIpsecTunnel,
                cbIpsecUser,
                cbTimeStamping,
                cbOcspSigning,
                cbSmartCardLogon
            };

            if (eku == null)
            {
                create();
            }
            else
            {
                edit(eku);
            }
        }
コード例 #5
0
        public void RemoveTest()
        {
            extendedKeyUsage target = new extendedKeyUsage(testData1);
            string           value  = "ServerAuth";

            target.Remove(value);
            Assert.AreEqual(1, target.ExtKUsage.Count);
        }
コード例 #6
0
        public void ExtendedKeyUsageTest()
        {
            extendedKeyUsage target = new extendedKeyUsage(testData1);
            ExtendedKeyUsage actual;

            actual = target.ExtendedKeyUsage;
            Assert.IsInstanceOfType(actual, typeof(ExtendedKeyUsage));
            Assert.AreEqual(2, actual.Count);
        }
コード例 #7
0
        public void ToXmlTest()
        {
            extendedKeyUsage target   = new extendedKeyUsage(testData1);
            XNode            expected = testData1;
            XNode            actual;

            actual = target.ToXml();
            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
コード例 #8
0
        public void AddTest()
        {
            extendedKeyUsage target = new extendedKeyUsage();
            string           value  = "CodeSigning";

            target.Add(value);
            Assert.AreEqual(1, target.ExtKUsage.Count);
            Assert.AreEqual("CodeSigning", target.ExtKUsage[0]);
        }
コード例 #9
0
        public void extendedKeyUsageConstructorTest3()
        {
            // Build an extension
            BcV3CertGen      gen     = new BcV3CertGen();
            extendedKeyUsage testExt = new extendedKeyUsage(testData1);

            gen.AddExtension(testExt.OID, testExt.Critical, testExt.DerEncoding);
            X509Certificate cert = CertTestHarness.RunCertGenerator(gen);
            X509Extension   ext  = CertTestHarness.ExtractExtension(cert, X509Extensions.ExtendedKeyUsage);

            // Test code
            extendedKeyUsage target = new extendedKeyUsage(ext);
            List <string>    list   = target.ExtKUsage;

            Assert.IsFalse(target.Critical);
            Assert.AreEqual(2, list.Count);
            Assert.AreEqual("ClientAuth", list[0]);
            Assert.AreEqual("ServerAuth", list[1]);
        }
コード例 #10
0
        public void extendedKeyUsageConstructorTest2()
        {
            extendedKeyUsage target = new extendedKeyUsage();

            Assert.IsFalse(target.Critical);
        }
コード例 #11
0
 // Create a new extension
 internal void create()
 {
     extKeyUsage  = new extendedKeyUsage();
     enableEvents = true;
 }