Ejemplo n.º 1
0
        public void WrongAsnEncodedData()
        {
            AsnEncodedData aed = new AsnEncodedData(new byte[0]);
            X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension(new OidCollection(), true);

            eku.CopyFrom(aed);              // note: not the same behaviour than using the constructor!
        }
Ejemplo n.º 2
0
        public void WrongExtension_X509EnhancedKeyUsageExtension()
        {
            X509KeyUsageExtension         ku  = new X509KeyUsageExtension();
            X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension();

            eku.CopyFrom(ku);
        }
Ejemplo n.º 3
0
        public void WrongExtension_X509Extension_KeyUsages()
        {
            X509Extension ex = new X509Extension("1.2.3", new byte[0], true);
            X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension();

            eku.CopyFrom(ex);
            Assert.AreEqual(0, eku.EnhancedKeyUsages.Count, "EnhancedKeyUsages");
        }
Ejemplo n.º 4
0
        public void WrongExtension_X509Extension()
        {
            X509Extension ex = new X509Extension("1.2.3", new byte[0], true);
            OidCollection oc = new OidCollection();

            oc.Add(new Oid("1.2.3.4"));
            X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension(oc, false);

            Assert.AreEqual(1, eku.EnhancedKeyUsages.Count, "EnhancedKeyUsages");
            Assert.IsFalse(eku.Critical, "Critical");
            eku.CopyFrom(ex);
            Assert.IsTrue(eku.Critical, "Critical");
            Assert.AreEqual(String.Empty, BitConverter.ToString(eku.RawData), "RawData");
            Assert.AreEqual("1.2.3", eku.Oid.Value, "Oid.Value");
            Assert.IsNull(eku.Oid.FriendlyName, "Oid.FriendlyName");
        }
Ejemplo n.º 5
0
        public void CopyFrom_Null()
        {
            X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension();

            eku.CopyFrom(null);
        }