本文整理汇总了C#中System.Security.Cryptography.AsnEncodedData类的典型用法代码示例。如果您正苦于以下问题:C# AsnEncodedData类的具体用法?C# AsnEncodedData怎么用?C# AsnEncodedData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AsnEncodedData类属于System.Security.Cryptography命名空间,在下文中一共展示了AsnEncodedData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyFrom_BadData
public void CopyFrom_BadData ()
{
byte[] data = { 0x30, 0x18, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x03, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x01 };
AsnEncodedData aed = new AsnEncodedData (data);
Pkcs9MessageDigest md = new Pkcs9MessageDigest ();
md.CopyFrom (aed);
}
示例2: CopyFrom
public void CopyFrom ()
{
byte[] data = { 0x04, 0x10, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F };
AsnEncodedData aed = new AsnEncodedData (data);
Pkcs9MessageDigest md = new Pkcs9MessageDigest ();
md.CopyFrom (aed);
}
示例3: CommonStuff
private void CommonStuff (CryptographicAttributeObjectCollection coll)
{
Assert.IsFalse (coll.IsSynchronized, "IsSynchronized");
Assert.AreSame (coll, coll.SyncRoot, "SyncRoot");
Assert.IsNotNull (coll.GetEnumerator (), "GetEnumerator");
int i = coll.Count;
Oid o1 = new Oid ("1.2.840.113549.1.7.3");
AsnEncodedData aed = new AsnEncodedData (o1, new byte[] { 0x05, 0x00 });
Assert.AreEqual (i, coll.Add (aed), "Add(AsnEncodedData)");
Assert.IsTrue ((coll[i++] is CryptographicAttributeObject), "converted");
Oid o2 = new Oid ("1.2.840.113549.1.7.2");
CryptographicAttributeObject cao = new CryptographicAttributeObject (o2);
Assert.AreEqual (i, coll.Add (cao), "Add(CryptographicAttributeObject)");
CryptographicAttributeObject[] array = new CryptographicAttributeObject [coll.Count];
coll.CopyTo (array, 0);
Array a = (Array) new object [coll.Count];
ICollection c = (ICollection) coll;
c.CopyTo (a, 0);
IEnumerable e = (IEnumerable) coll;
Assert.IsNotNull (e.GetEnumerator (), "GetEnumerator");
coll.Remove (cao);
Assert.AreEqual (i, coll.Count, "Remove(CryptographicAttributeObject)");
}
示例4: Add
// methods
public int Add (AsnEncodedData asnEncodedData)
{
if (asnEncodedData == null)
throw new ArgumentNullException ("asnEncodedData");
return _list.Add (asnEncodedData);
}
示例5: Add
public int Add(AsnEncodedData asnEncodedData)
{
if (asnEncodedData == null)
throw new ArgumentNullException(nameof(asnEncodedData));
return Add(new CryptographicAttributeObject(asnEncodedData.Oid, new AsnEncodedDataCollection(asnEncodedData)));
}
示例6: ConstructorAsnEncodedData_BadAsn
public void ConstructorAsnEncodedData_BadAsn ()
{
AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[0]);
X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension (aed, true);
Assert.AreEqual (String.Empty, eku.Format (true), "Format(true)");
Assert.AreEqual (String.Empty, eku.Format (false), "Format(false)");
OidCollection oc = eku.EnhancedKeyUsages;
}
示例7: Remove
public void Remove(AsnEncodedData asnEncodedData)
{
if (asnEncodedData == null)
{
throw new ArgumentNullException("asnEncodedData");
}
this.m_list.Remove(asnEncodedData);
}
示例8: Pkcs9AttributeCopyFromAsnNotAPkcs9Attribute
public static void Pkcs9AttributeCopyFromAsnNotAPkcs9Attribute()
{
// Pkcs9AttributeObject.CopyFrom(AsnEncodedData) refuses to accept any AsnEncodedData that isn't a Pkcs9AttributeObject-derived class.
Pkcs9AttributeObject p = new Pkcs9AttributeObject();
byte[] rawData = "041e4d00790020004400650073006300720069007000740069006f006e000000".HexToByteArray();
AsnEncodedData a = new AsnEncodedData(Oids.DocumentName, rawData);
Assert.Throws<ArgumentException>(() => p.CopyFrom(a));
}
示例9: CopyFrom
public virtual void CopyFrom(AsnEncodedData asnEncodedData)
{
if (asnEncodedData == null)
{
throw new ArgumentNullException("asnEncodedData");
}
this.Reset(asnEncodedData.m_oid, asnEncodedData.m_rawData);
}
示例10: Constructor_StringData
public void Constructor_StringData ()
{
AsnEncodedData aed = new AsnEncodedData ("oid", asnNullBytes);
Assert.AreEqual ("oid", aed.Oid.Value, "Oid.Value");
Assert.IsNull (aed.Oid.FriendlyName, "Oid.FriendlyName");
Assert.AreEqual (BitConverter.ToString (asnNullBytes), BitConverter.ToString (aed.RawData), "RawData");
Assert.AreEqual (asnNullString, aed.Format (true), "Format");
}
示例11: Add
public int Add(AsnEncodedData asnEncodedData)
{
if (asnEncodedData == null)
{
throw new ArgumentNullException("asnEncodedData");
}
return this.Add(new CryptographicAttributeObject(asnEncodedData));
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:CryptographicAttributeObjectCollection.cs
示例12: CopyFrom
public void CopyFrom ()
{
/* byte[] data = ASN1Convert.FromOid ("1.2.840.113549.1.7.1").GetBytes (); */
byte[] data = { 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x01 };
AsnEncodedData aed = new AsnEncodedData (data);
Pkcs9ContentType ct = new Pkcs9ContentType ();
ct.CopyFrom (aed);
}
示例13: LinkDemand_Deny_Unrestricted
public void LinkDemand_Deny_Unrestricted ()
{
Type[] types = new Type[2] { typeof (AsnEncodedData), typeof (bool) };
ConstructorInfo ci = typeof (X509Extension).GetConstructor (types);
Assert.IsNotNull (ci, ".ctor(AsnEncodedData,bool)");
AsnEncodedData aed = new AsnEncodedData (new Oid ("2.5.29.37"), new byte[] { 0x30, 0x05, 0x06, 0x03, 0x2A, 0x03, 0x04 });
Assert.IsNotNull (ci.Invoke (new object [2] { aed, false }), "invoke");
}
示例14: ConstructorAsnEncodedData_BadAsn
public void ConstructorAsnEncodedData_BadAsn ()
{
AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[0]);
X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension (aed, true);
Assert.AreEqual (String.Empty, ski.Format (true), "Format(true)");
Assert.AreEqual (String.Empty, ski.Format (false), "Format(false)");
string s = ski.SubjectKeyIdentifier;
}
示例15: AsnEncodedData
public AsnEncodedData (AsnEncodedData asnEncodedData)
{
if (asnEncodedData == null)
throw new ArgumentNullException ("asnEncodedData");
Oid = new Oid (asnEncodedData._oid);
RawData = asnEncodedData._raw;
}