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! }
public void WrongExtension_X509EnhancedKeyUsageExtension() { X509KeyUsageExtension ku = new X509KeyUsageExtension(); X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension(); eku.CopyFrom(ku); }
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"); }
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"); }
public void CopyFrom_Null() { X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension(); eku.CopyFrom(null); }