当前位置: 首页>>代码示例>>C#>>正文


C# AsnEncodedData类代码示例

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


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


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