Пример #1
0
        // Load an existing extension
        internal void edit(keyUsage ku)
        {
            keyUsage     = ku;
            enableEvents = false;

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

            enableEvents = true;
        }
Пример #2
0
        public void keyUsageConstructorTest1()
        {
            bool     Critical = true;
            keyUsage target   = new keyUsage(Critical);

            Assert.IsTrue(target.Critical);
        }
Пример #3
0
        public void KusageTest()
        {
            keyUsage      target = new keyUsage(testData1);
            List <string> actual;

            actual = target.Kusage;
            Assert.AreEqual("CRLSign", actual[1]);
        }
Пример #4
0
        public void RemoveTest()
        {
            keyUsage target = new keyUsage(testData1);
            string   usage  = "KeyCertSign";

            target.Remove(usage);
            Assert.AreEqual(1, target.Kusage.Count);
        }
Пример #5
0
        public void ToXmlTest()
        {
            keyUsage target   = new keyUsage(testData1);
            XNode    expected = testData1;
            XNode    actual   = target.ToXml();

            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
Пример #6
0
        public void KeyUsageTest()
        {
            keyUsage target = new keyUsage(testData1);
            KeyUsage actual;

            actual = target.KeyUsage;
            Assert.AreEqual(extValue1, actual.ToString());
        }
Пример #7
0
        public void AddTest()
        {
            keyUsage target = new keyUsage();
            string   usage  = "KeyAgreement";

            target.Add(usage);
            Assert.IsTrue(target.Kusage.Count == 1);
            Assert.AreEqual("KeyAgreement", target.Kusage[0]);
        }
Пример #8
0
        public void keyUsageConstructorTest2()
        {
            XElement xml    = testData1;
            keyUsage target = new keyUsage(xml);

            Assert.AreEqual("KeyUsage", target.Name);
            Assert.AreEqual("Key Usage", target.DisplayName);
            Assert.IsTrue(target.Critical);
            Assert.IsTrue(target.Kusage.Count == 2);
        }
Пример #9
0
        public KeyUsage(keyUsage ku)
        {
            InitializeComponent();
            cblist = new CheckBox[] {
                cbDigitalSignature,
                cbNonRepudiation,
                cbKeyCertSign,
                cbDataEncipherment,
                cbCRLSign,
                cbDecipherOnly,
                cbEncipherOnly,
                cbKeyAgreement,
                cbKeyEncipherment
            };

            if (ku == null)
            {
                create();
            }
            else
            {
                edit(ku);
            }
        }
Пример #10
0
        public void keyUsageConstructorTest()
        {
            keyUsage target = new keyUsage();

            Assert.AreEqual("KeyUsage", target.Name);
        }
Пример #11
0
 // Create a new extension
 internal void create()
 {
     keyUsage     = new keyUsage();
     enableEvents = true;
 }