• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Cryptography.AsnEncodedData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Security.Cryptography.AsnEncodedData的典型用法代码示例。如果您正苦于以下问题:C# AsnEncodedData类的具体用法?C# AsnEncodedData怎么用?C# AsnEncodedData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AsnEncodedData类属于System.Security.Cryptography命名空间,在下文中一共展示了AsnEncodedData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:7,代码来源:Pkcs9MessageDigestTest.cs


示例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);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:7,代码来源:Pkcs9MessageDigestTest.cs


示例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)");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:29,代码来源:CryptographicAttributeObjectCollectionTest.cs


示例4: Add

		// methods

		public int Add (AsnEncodedData asnEncodedData)
		{
			if (asnEncodedData == null)
				throw new ArgumentNullException ("asnEncodedData");

			return _list.Add (asnEncodedData);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:9,代码来源:CryptographicAttributeCollection.cs


示例5: Add

        public int Add(AsnEncodedData asnEncodedData)
        {
            if (asnEncodedData == null)
                throw new ArgumentNullException(nameof(asnEncodedData));

            return Add(new CryptographicAttributeObject(asnEncodedData.Oid, new AsnEncodedDataCollection(asnEncodedData)));
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:7,代码来源:CryptographicAttributeObjectCollection.cs


示例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;
		}
开发者ID:Profit0004,项目名称:mono,代码行数:8,代码来源:X509EnhancedKeyUsageExtensionTest.cs


示例7: Remove

 public void Remove(AsnEncodedData asnEncodedData)
 {
     if (asnEncodedData == null)
     {
         throw new ArgumentNullException("asnEncodedData");
     }
     this.m_list.Remove(asnEncodedData);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:AsnEncodedDataCollection.cs


示例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));
 }
开发者ID:ChuangYang,项目名称:corefx,代码行数:8,代码来源:Pkcs9AttributeTests.cs


示例9: CopyFrom

 public virtual void CopyFrom(AsnEncodedData asnEncodedData)
 {
     if (asnEncodedData == null)
     {
         throw new ArgumentNullException("asnEncodedData");
     }
     this.Reset(asnEncodedData.m_oid, asnEncodedData.m_rawData);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:AsnEncodedData.cs


示例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");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:AsnEncodedDataTest.cs


示例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);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:Pkcs9ContentTypeTest.cs


示例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");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:X509ExtensionCas.cs


示例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;
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:8,代码来源:X509SubjectKeyIdentifierExtensionTest.cs


示例15: AsnEncodedData

		public AsnEncodedData (AsnEncodedData asnEncodedData)
		{
			if (asnEncodedData == null)
				throw new ArgumentNullException ("asnEncodedData");

			Oid = new Oid (asnEncodedData._oid);
			RawData = asnEncodedData._raw;
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:8,代码来源:AsnEncodedData.cs


示例16: CopyFrom

 public override void CopyFrom (AsnEncodedData asnEncodedData) {
     if (asnEncodedData == null)
         throw new ArgumentNullException("asnEncodedData");
     Pkcs9AttributeObject att = asnEncodedData as Pkcs9AttributeObject;
     if (att == null)
         throw new ArgumentException(SecurityResources.GetResourceString("Cryptography_Pkcs9_AttributeMismatch"));
     base.CopyFrom(asnEncodedData);
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:8,代码来源:Pkcs9Attribute.cs


示例17: ConstructorAsnEncodedData_BadAsn

		public void ConstructorAsnEncodedData_BadAsn ()
		{
			AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[0]);
			X509KeyUsageExtension ku = new X509KeyUsageExtension (aed, true);
			Assert.AreEqual (String.Empty, ku.Format (true), "Format(true)");
			Assert.AreEqual (String.Empty, ku.Format (false), "Format(false)");
			X509KeyUsageFlags kuf = ku.KeyUsages;
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:8,代码来源:X509KeyUsageExtensionTest.cs


示例18: Pkcs9AttributeAsnEncodedDataCtorEmptyOidValue

        public static void Pkcs9AttributeAsnEncodedDataCtorEmptyOidValue()
        {
            Oid oid = new Oid(Oids.Aes128);
            oid.Value = string.Empty;

            AsnEncodedData a = new AsnEncodedData(oid, new byte[3]);
            object ign;
            Assert.Throws<ArgumentException>(() => ign = new Pkcs9AttributeObject(a));
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:9,代码来源:Pkcs9AttributeTests.cs


示例19: Add

        public int Add(AsnEncodedData asnEncodedData)
        {
            if (asnEncodedData == null)
                throw new ArgumentNullException(nameof(asnEncodedData));

            int indexOfNewItem = _list.Count;
            _list.Add(asnEncodedData);
            return indexOfNewItem;
        }
开发者ID:geoffkizer,项目名称:corefx,代码行数:9,代码来源:AsnEncodedDataCollection.cs


示例20: Pkcs9AttributeObject

 public Pkcs9AttributeObject (AsnEncodedData asnEncodedData) : base (asnEncodedData) {
     if (asnEncodedData.Oid == null)
         throw new ArgumentNullException("asnEncodedData.Oid");
     string szOid = base.Oid.Value;
     if (szOid == null)
         throw new ArgumentNullException("oid.Value");
     if (szOid.Length == 0)
         throw new ArgumentException(SecurityResources.GetResourceString("Arg_EmptyOrNullString"), "oid.Value");
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:9,代码来源:Pkcs9Attribute.cs



注:本文中的System.Security.Cryptography.AsnEncodedData类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Cryptography.AsymmetricAlgorithm类代码示例发布时间:2022-05-26
下一篇:
C# Cryptography.AesManaged类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap