當前位置: 首頁>>代碼示例>>C#>>正文


C# Asn1.Asn1TaggedObject類代碼示例

本文整理匯總了C#中Org.BouncyCastle.Asn1.Asn1TaggedObject的典型用法代碼示例。如果您正苦於以下問題:C# Asn1TaggedObject類的具體用法?C# Asn1TaggedObject怎麽用?C# Asn1TaggedObject使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Asn1TaggedObject類屬於Org.BouncyCastle.Asn1命名空間,在下文中一共展示了Asn1TaggedObject類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetInstance

        /**
         * return an Integer from a tagged object.
         *
         * @param obj the tagged object holding the object we want
         * @param explicitly true if the object is meant to be explicitly
         *              tagged false otherwise.
         * @exception ArgumentException if the tagged object cannot
         *               be converted.
         */
        public static DerInteger GetInstance(
            Asn1TaggedObject	obj,
            bool				explicitly)
        {
            if (obj == null)
                throw new ArgumentNullException("obj");

			return GetInstance(obj.GetObject());
        }
開發者ID:nicecai,項目名稱:iTextSharp-4.1.6,代碼行數:18,代碼來源:DerInteger.cs

示例2: GetInstance

		static public Asn1TaggedObject GetInstance(
            Asn1TaggedObject	obj,
            bool				explicitly)
        {
            if (explicitly)
            {
                return (Asn1TaggedObject) obj.GetObject();
            }

            throw new ArgumentException("implicitly tagged tagged object");
        }
開發者ID:ktw,項目名稱:OutlookPrivacyPlugin,代碼行數:11,代碼來源:Asn1TaggedObject.cs

示例3: GetInstance

        /**
         * return a Videotex String from a tagged object.
         *
         * @param obj the tagged object holding the object we want
         * @param explicit true if the object is meant to be explicitly
         *              tagged false otherwise.
         * @exception IllegalArgumentException if the tagged object cannot
         *               be converted.
         * @return a DERVideotexString instance, or null.
         */
        public static DerVideotexString GetInstance(Asn1TaggedObject obj, bool isExplicit)
        {
			Asn1Object o = obj.GetObject();

            if (isExplicit || o is DerVideotexString)
			{
				return GetInstance(o);
			}

            return new DerVideotexString(((Asn1OctetString)o).GetOctets());
        }
開發者ID:KimikoMuffin,項目名稱:bc-csharp,代碼行數:21,代碼來源:DerVideotexString.cs

示例4: GetInstance

        /**
         * return an OriginatorIdentifierOrKey object from a tagged object.
         *
         * @param o the tagged object holding the object we want.
         * @param explicitly true if the object is meant to be explicitly
         *              tagged false otherwise.
         * @exception ArgumentException if the object held by the
         *          tagged object cannot be converted.
         */
        public static OriginatorIdentifierOrKey GetInstance(
            Asn1TaggedObject	o,
            bool				explicitly)
        {
            if (!explicitly)
            {
                throw new ArgumentException(
                        "Can't implicitly tag OriginatorIdentifierOrKey");
            }

			return GetInstance(o.GetObject());
        }
開發者ID:nicecai,項目名稱:iTextSharp-4.1.6,代碼行數:21,代碼來源:OriginatorIdentifierOrKey.cs

示例5: GetInstance

        /**
         * return a Boolean from a tagged object.
         *
         * @param obj the tagged object holding the object we want
         * @param explicitly true if the object is meant to be explicitly
         *              tagged false otherwise.
         * @exception ArgumentException if the tagged object cannot
         *               be converted.
         */
        public static DerBoolean GetInstance(
            Asn1TaggedObject	obj,
            bool				isExplicit)
        {
            Asn1Object o = obj.GetObject();

            if (isExplicit || o is DerBoolean)
            {
                return GetInstance(o);
            }

            return FromOctetString(((Asn1OctetString)o).GetOctets());
        }
開發者ID:ubberkid,項目名稱:PeerATT,代碼行數:22,代碼來源:DerBoolean.cs

示例6: GetInstance

		/**
         * return a Generalized Time object from a tagged object.
         *
         * @param obj the tagged object holding the object we want
         * @param explicitly true if the object is meant to be explicitly
         *              tagged false otherwise.
         * @exception ArgumentException if the tagged object cannot
         *               be converted.
         */
        public static DerGeneralizedTime GetInstance(
            Asn1TaggedObject	obj,
            bool				isExplicit)
        {
			Asn1Object o = obj.GetObject();

			if (isExplicit || o is DerGeneralizedTime)
			{
				return GetInstance(o);
			}

			return new DerGeneralizedTime(((Asn1OctetString)o).GetOctets());
        }
開發者ID:NelsonSantos,項目名稱:fyiReporting-Android,代碼行數:22,代碼來源:DerGeneralizedTime.cs

示例7: GetInstance

		/**
         * return an Octet string from a tagged object.
         *
         * @param obj the tagged object holding the object we want.
         * @param explicitly true if the object is meant to be explicitly
         *              tagged false otherwise.
         * @exception ArgumentException if the tagged object cannot
         *              be converted.
         */
		public static Asn1OctetString GetInstance(
			Asn1TaggedObject	obj,
			bool				isExplicit)
		{
			Asn1Object o = obj.GetObject();

			if (isExplicit || o is Asn1OctetString)
			{
				return GetInstance(o);
			}

			return BerOctetString.FromSequence(Asn1Sequence.GetInstance(o));
		}
開發者ID:KimikoMuffin,項目名稱:bc-csharp,代碼行數:22,代碼來源:Asn1OctetString.cs

示例8: GetInstance

        /**
         * Return an ASN1 set from a tagged object. There is a special
         * case here, if an object appears to have been explicitly tagged on
         * reading but we were expecting it to be implicitly tagged in the
         * normal course of events it indicates that we lost the surrounding
         * set - so we need to add it back (this will happen if the tagged
         * object is a sequence that contains other sequences). If you are
         * dealing with implicitly tagged sets you really <b>should</b>
         * be using this method.
         *
         * @param obj the tagged object.
         * @param explicitly true if the object is meant to be explicitly tagged
         *          false otherwise.
         * @exception ArgumentException if the tagged object cannot
         *          be converted.
         */
        public static Asn1Set GetInstance(
            Asn1TaggedObject	obj,
            bool				explicitly)
        {
			Asn1Object inner = obj.GetObject();

			if (explicitly)
            {
                if (!obj.IsExplicit())
                    throw new ArgumentException("object implicit - explicit expected.");

				return (Asn1Set) inner;
            }

			//
            // constructed object which appears to be explicitly tagged
            // and it's really implicit means we have to add the
            // surrounding sequence.
            //
            if (obj.IsExplicit())
            {
                return new DerSet(inner);
            }

			if (inner is Asn1Set)
            {
                return (Asn1Set) inner;
            }

            //
            // in this case the parser returns a sequence, convert it
            // into a set.
            //
			if (inner is Asn1Sequence)
            {
				Asn1EncodableVector v = new Asn1EncodableVector();
				Asn1Sequence s = (Asn1Sequence) inner;

				foreach (Asn1Encodable ae in s)
				{
                    v.Add(ae);
                }

				// TODO Should be able to construct set directly from sequence?
				return new DerSet(v, false);
            }

			throw new ArgumentException("Unknown object in GetInstance: " + obj.GetType().FullName, "obj");
		}
開發者ID:,項目名稱:,代碼行數:65,代碼來源:

示例9: CertStatus

		public CertStatus(
            Asn1TaggedObject choice)
        {
            this.tagNo = choice.TagNo;

			switch (choice.TagNo)
            {
				case 1:
					value = RevokedInfo.GetInstance(choice, false);
					break;
				case 0:
				case 2:
					value = DerNull.Instance;
					break;
            }
        }
開發者ID:ktw,項目名稱:OutlookPrivacyPlugin,代碼行數:16,代碼來源:CertStatus.cs

示例10: GetInstance

        /**
         * return an Integer from a tagged object.
         *
         * @param obj the tagged object holding the object we want
         * @param isExplicit true if the object is meant to be explicitly
         *              tagged false otherwise.
         * @exception ArgumentException if the tagged object cannot
         *               be converted.
         */
        public static DerInteger GetInstance(
            Asn1TaggedObject	obj,
            bool				isExplicit)
        {
            if (obj == null)
                throw new ArgumentNullException("obj");

			Asn1Object o = obj.GetObject();

			if (isExplicit || o is DerInteger)
			{
				return GetInstance(o);
			}

			return new DerInteger(Asn1OctetString.GetInstance(o).GetOctets());
        }
開發者ID:JohnMalmsteen,項目名稱:mobile-apps-tower-defense,代碼行數:25,代碼來源:DerInteger.cs

示例11: GetInstance

		/**
         * Return an ASN1 sequence from a tagged object. There is a special
         * case here, if an object appears to have been explicitly tagged on
         * reading but we were expecting it to be implicitly tagged in the
         * normal course of events it indicates that we lost the surrounding
         * sequence - so we need to add it back (this will happen if the tagged
         * object is a sequence that contains other sequences). If you are
         * dealing with implicitly tagged sequences you really <b>should</b>
         * be using this method.
         *
         * @param obj the tagged object.
         * @param explicitly true if the object is meant to be explicitly tagged,
         *          false otherwise.
         * @exception ArgumentException if the tagged object cannot
         *          be converted.
         */
        public static Asn1Sequence GetInstance(
            Asn1TaggedObject	obj,
            bool				explicitly)
        {
			Asn1Object inner = obj.GetObject();

			if (explicitly)
            {
                if (!obj.IsExplicit())
                    throw new ArgumentException("object implicit - explicit expected.");

				return (Asn1Sequence) inner;
            }

			//
            // constructed object which appears to be explicitly tagged
            // when it should be implicit means we have to add the
            // surrounding sequence.
            //
            if (obj.IsExplicit())
            {
                if (obj is BerTaggedObject)
                {
                    return new BerSequence(inner);
                }

				return new DerSequence(inner);
            }

			if (inner is Asn1Sequence)
            {
                return (Asn1Sequence) inner;
            }

			throw new ArgumentException("Unknown object in GetInstance: " + obj.GetType().FullName, "obj");
		}
開發者ID:ktw,項目名稱:OutlookPrivacyPlugin,代碼行數:52,代碼來源:Asn1Sequence.cs

示例12: GetInstance

        /**
         * return a RecipientKeyIdentifier object from a tagged object.
         *
         * @param _ato the tagged object holding the object we want.
         * @param _explicit true if the object is meant to be explicitly
         *              tagged false otherwise.
         * @exception ArgumentException if the object held by the
         *          tagged object cannot be converted.
         */
        public static RecipientKeyIdentifier GetInstance(
			Asn1TaggedObject	ato,
			bool				explicitly)
        {
            return GetInstance(Asn1Sequence.GetInstance(ato, explicitly));
        }
開發者ID:karino2,項目名稱:wikipediaconv,代碼行數:15,代碼來源:RecipientKeyIdentifier.cs

示例13: GetInstance

		public static CertificateList GetInstance(
            Asn1TaggedObject	obj,
            bool				explicitly)
        {
            return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
        }
開發者ID:ktw,項目名稱:OutlookPrivacyPlugin,代碼行數:6,代碼來源:CertificateList.cs

示例14: GetInstance

		public static RevokedInfo GetInstance(
			Asn1TaggedObject	obj,
			bool				explicitly)
		{
			return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
		}
開發者ID:ktw,項目名稱:OutlookPrivacyPlugin,代碼行數:6,代碼來源:RevokedInfo.cs

示例15: GetInstance

		public static RsaPublicKeyStructure GetInstance(
            Asn1TaggedObject	obj,
            bool				explicitly)
        {
            return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
        }
開發者ID:htlp,項目名稱:itextsharp,代碼行數:6,代碼來源:RSAPublicKeyStructure.cs


注:本文中的Org.BouncyCastle.Asn1.Asn1TaggedObject類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。