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

C# AsnEncodedData类代码示例

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

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



AsnEncodedData类属于命名空间,在下文中一共展示了AsnEncodedData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CopyFrom

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

			throw new ArgumentException ("Cannot convert the PKCS#9 attribute.");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:Pkcs9Attribute.cs


示例2: PublicKey

 public PublicKey(Oid oid, AsnEncodedData parameters, AsnEncodedData keyValue)
 {
     _oid = new Oid(oid);
     EncodedParameters = new AsnEncodedData(parameters);
     EncodedKeyValue = new AsnEncodedData(keyValue);
     return;
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:7,代码来源:PublicKey.cs


示例3: X509ExtensionCollection

		internal X509ExtensionCollection (MX.X509Certificate cert)
		{
			_list = new ArrayList (cert.Extensions.Count);
			if (cert.Extensions.Count == 0)
				return;

			object[] parameters = new object [2];
			foreach (MX.X509Extension ext in cert.Extensions) {
				bool critical = ext.Critical;
				string oid = ext.Oid;
				byte[] raw_data = null;
				// extension data is embedded in an octet stream (4)
				ASN1 value = ext.Value;
				if ((value.Tag == 0x04) && (value.Count > 0))
					raw_data = value [0].GetBytes ();

				parameters [0] = new AsnEncodedData (oid, raw_data);
				parameters [1] = critical;
				X509Extension newt = (X509Extension) CryptoConfig.CreateFromName (oid, parameters);
				if (newt == null) {
					// not registred in CryptoConfig, using default
					newt = new X509Extension (oid, raw_data, critical);
				}
				_list.Add (newt);
			}
		}
开发者ID:runefs,项目名称:Marvin,代码行数:26,代码来源:X509ExtensionCollection.cs


示例4: TestSubjectAlternativeName

        public static void TestSubjectAlternativeName()
        {
            byte[] sanExtension =
            {
                0x30, 0x31, 0x82, 0x0B, 0x65, 0x78, 0x61, 0x6D,
                0x70, 0x6C, 0x65, 0x2E, 0x6F, 0x72, 0x67, 0x82,
                0x0F, 0x73, 0x75, 0x62, 0x2E, 0x65, 0x78, 0x61,
                0x6D, 0x70, 0x6C, 0x65, 0x2E, 0x6F, 0x72, 0x67,
                0x82, 0x11, 0x2A, 0x2E, 0x73, 0x75, 0x62, 0x2E,
                0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2E,
                0x6F, 0x72, 0x67,
            };

            AsnEncodedData asnData = new AsnEncodedData(
                new Oid("2.5.29.17"),
                sanExtension);

            string s = asnData.Format(false);
            // Windows says: "DNS Name=example.org, DNS Name=sub.example.org, DNS Name=*.sub.example.org"
            // X-Plat (OpenSSL) says: "DNS:example.org, DNS:sub.example.org, DNS:*.sub.example.org".
            // This keeps the parsing generalized until we can get them to converge
            string[] parts = s.Split(new[] { ':', '=', ',' }, StringSplitOptions.RemoveEmptyEntries);
            // Parts is now { header, data, header, data, header, data }.
            string[] output = new string[parts.Length / 2];

            for (int i = 0; i < output.Length; i++)
            {
                output[i] = parts[2 * i + 1];
            }

            Assert.Equal(new[] { "example.org", "sub.example.org", "*.sub.example.org" }, output);
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:32,代码来源:AsnEncodedData.cs


示例5: X509EnhancedKeyUsageExtension

		public X509EnhancedKeyUsageExtension (AsnEncodedData encodedEnhancedKeyUsages, bool critical)
		{
			// ignore the Oid provided by encodedKeyUsage (our rules!)
			_oid = new Oid (oid, friendlyName);
			_raw = encodedEnhancedKeyUsages.RawData;
			base.Critical = critical;
			_status = Decode (this.RawData);
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:8,代码来源:X509EnhancedKeyUsageExtension.cs


示例6: X509SubjectKeyIdentifierExtension

		public X509SubjectKeyIdentifierExtension (AsnEncodedData encodedSubjectKeyIdentifier, bool critical)
		{
			// ignore the Oid provided by encodedKeyUsage (our rules!)
			_oid = new Oid (oid, friendlyName);
			_raw = encodedSubjectKeyIdentifier.RawData;
			base.Critical = critical;
			_status = Decode (this.RawData);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:X509SubjectKeyIdentifierExtension.cs


示例7: FormatUnknownData

 public static void FormatUnknownData()
 {
     byte[] rawData = { 0x41, 0x42, 0x43 };
     AsnEncodedData a = new AsnEncodedData(rawData);
     a.Oid = null;
     String s = a.Format(true);
     Assert.Equal("41 42 43", s);
     return;
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:9,代码来源:AsnEncodedData.cs


示例8: CopyFrom

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

			Decode (asnEncodedData.RawData);
			Oid = asnEncodedData.Oid;
			RawData = asnEncodedData.RawData;
		}
开发者ID:Profit0004,项目名称:mono,代码行数:9,代码来源:Pkcs9SigningTime.cs


示例9: CopyFrom

        public override void CopyFrom(AsnEncodedData asnEncodedData)
        {
            if (asnEncodedData == null)
                throw new ArgumentNullException(nameof(asnEncodedData));
            if (!(asnEncodedData is Pkcs9AttributeObject))
                throw new ArgumentException(SR.Cryptography_Pkcs9_AttributeMismatch);

            base.CopyFrom(asnEncodedData);
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:9,代码来源:Pkcs9AttributeObject.cs


示例10: FormatInvalidTypedData

 public static void FormatInvalidTypedData()
 {
     // This passes in data in an illegal format. AsnEncodedData.Format() swallows the error and falls back to a simple hex-encoding scheme.
     byte[] rawData = { 0x41, 0x42, 0x43 };
     AsnEncodedData a = new AsnEncodedData(rawData);
     a.Oid = new Oid("1.3.6.1.4.1.311.2.1.27");  //SPC_FINANCIAL_CRITERIA_OBJID
     String s = a.Format(true);
     Assert.Equal("414243", s);
     return;
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:10,代码来源:AsnEncodedData.cs


示例11: X509Extension

		public X509Extension (AsnEncodedData encodedExtension, bool critical)
		{
// Match MS		if (encodedExtension == null)
//				throw new ArgumentNullException ("encodedExtension");
			if (encodedExtension.Oid == null)
				throw new ArgumentNullException ("encodedExtension.Oid");

			Oid = encodedExtension.Oid;
			RawData = encodedExtension.RawData;
			_critical = critical;
		}
开发者ID:runefs,项目名称:Marvin,代码行数:11,代码来源:X509Extension.cs


示例12: CopyFrom

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

            X509Extension extension = asnEncodedData as X509Extension;
            if (extension == null)
                throw new ArgumentException(SR.Cryptography_X509_ExtensionMismatch);
            base.CopyFrom(asnEncodedData);
            Critical = extension.Critical;
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:11,代码来源:X509Extension.cs


示例13: Pkcs9AttributeObject

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


示例14: X500DistinguishedName

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

			RawData = encodedDistinguishedName.RawData;
			if (RawData.Length > 0)
				DecodeRawData ();
			else
				name = String.Empty;
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:11,代码来源:X500DistinguishedName.cs


示例15: PublicKey

		internal PublicKey (Mono.Security.X509.X509Certificate certificate)
		{
			if (certificate.KeyAlgorithm == "1.2.840.113549.1.1.1") {
				_key = certificate.RSA;
			}
			else {
				_key = certificate.DSA;
			}

			_oid = new Oid (certificate.KeyAlgorithm);
			_keyValue = new AsnEncodedData (_oid, certificate.PublicKey);
			_params = new AsnEncodedData (_oid, certificate.KeyAlgorithmParameters);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:13,代码来源:PublicKey.cs


示例16: CopyFrom

		// methods

		public override void CopyFrom (AsnEncodedData asnEncodedData) 
		{
			if (asnEncodedData == null)
				throw new ArgumentNullException ("encodedData");

			X509Extension ex = (asnEncodedData as X509Extension);
			if (ex == null)
				throw new ArgumentException (Locale.GetText ("Expected a X509Extension instance."));

			base.CopyFrom (asnEncodedData);
			// and we deal with critical
			_critical = ex.Critical;
		}
开发者ID:runefs,项目名称:Marvin,代码行数:15,代码来源:X509Extension.cs


示例17: PublicKey

		public PublicKey (Oid oid, AsnEncodedData parameters, AsnEncodedData keyValue)
		{
			if (oid == null)
				throw new ArgumentNullException ("oid");
			if (parameters == null)
				throw new ArgumentNullException ("parameters");
			if (keyValue == null)
				throw new ArgumentNullException ("keyValue");

			_oid = new Oid (oid);
			_params = new AsnEncodedData (parameters);
			_keyValue = new AsnEncodedData (keyValue);
		}
开发者ID:GirlD,项目名称:mono,代码行数:13,代码来源:PublicKey.cs


示例18: Add

        public static void Add()
        {
            AsnEncodedData a0 = new AsnEncodedData("1.0", Array.Empty<byte>());
            AsnEncodedData a1 = new AsnEncodedData("1.1", Array.Empty<byte>());
            AsnEncodedData a2 = new AsnEncodedData("1.2", Array.Empty<byte>());

            AsnEncodedDataCollection c = new AsnEncodedDataCollection();
            int index;
            index = c.Add(a0);
            Assert.Equal(0, index);
            index = c.Add(a1);
            Assert.Equal(1, index);
            index = c.Add(a2);
            Assert.Equal(2, index);

            AssertEquals(c, new AsnEncodedData[] { a0, a1, a2 });
        }
开发者ID:SGuyGe,项目名称:corefx,代码行数:17,代码来源:AsnEncodedDataCollectionTests.cs


示例19: X509ExtensionCollection

		internal X509ExtensionCollection (MX.X509Certificate cert)
		{
			_list = new ArrayList (cert.Extensions.Count);
			if (cert.Extensions.Count == 0)
				return;

			object[] parameters = new object [2];
			foreach (MX.X509Extension ext in cert.Extensions) {
				bool critical = ext.Critical;
				string oid = ext.Oid;
				byte[] raw_data = null;
				// extension data is embedded in an octet stream (4)
				ASN1 value = ext.Value;
				if ((value.Tag == 0x04) && (value.Count > 0))
					raw_data = value [0].GetBytes ();

				X509Extension newt = null;
#if FULL_AOT_RUNTIME
				// non-extensible
				switch (oid) {
				case "2.5.29.14":
					newt = new X509SubjectKeyIdentifierExtension (new AsnEncodedData (oid, raw_data), critical);
					break;
				case "2.5.29.15":
					newt = new X509KeyUsageExtension (new AsnEncodedData (oid, raw_data), critical);
					break;
				case "2.5.29.19":
					newt = new X509BasicConstraintsExtension (new AsnEncodedData (oid, raw_data), critical);
					break;
				case "2.5.29.37":
					newt = new X509EnhancedKeyUsageExtension (new AsnEncodedData (oid, raw_data), critical);
					break;
				}
#else
				parameters [0] = new AsnEncodedData (oid, raw_data ?? Empty);
				parameters [1] = critical;
				newt = (X509Extension) CryptoConfig.CreateFromName (oid, parameters);
#endif
				if (newt == null) {
					// not registred in CryptoConfig, using default
					newt = new X509Extension (oid, raw_data ?? Empty, critical);
				}
				_list.Add (newt);
			}
		}
开发者ID:ramonsmits,项目名称:mono,代码行数:45,代码来源:X509ExtensionCollection.cs


示例20: AsnEncodedDataCollection

	public AsnEncodedDataCollection(AsnEncodedData asnEncodedData) {}
开发者ID:Pengfei-Gao,项目名称:source-Insight-3-for-centos7,代码行数:1,代码来源:AsnEncodedDataCollection.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# AsnType类代码示例发布时间:2022-05-24
下一篇:
C# Asn1TaggedObject类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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