Org.BouncyCastle.Asn1.Asn1StreamParser.ReadImplicit C# (CSharp) Méthode

ReadImplicit() private méthode

private ReadImplicit ( bool constructed, int tag ) : IAsn1Convertible
constructed bool
tag int
Résultat IAsn1Convertible
		internal IAsn1Convertible ReadImplicit(bool constructed, int tag)
		{
			if (_in is IndefiniteLengthInputStream)
			{
				if (!constructed)
					throw new IOException("indefinite length primitive encoding encountered");

				return ReadIndef(tag);
			}

			if (constructed)
			{
				switch (tag)
				{
					case Asn1Tags.Set:
						return new DerSetParser(this);
					case Asn1Tags.Sequence:
						return new DerSequenceParser(this);
					case Asn1Tags.OctetString:
						return new BerOctetStringParser(this);
				}
			}
			else
			{
				switch (tag)
				{
					case Asn1Tags.Set:
						throw new Asn1Exception("sequences must use constructed encoding (see X.690 8.9.1/8.10.1)");
					case Asn1Tags.Sequence:
						throw new Asn1Exception("sets must use constructed encoding (see X.690 8.11.1/8.12.1)");
					case Asn1Tags.OctetString:
						return new DerOctetStringParser((DefiniteLengthInputStream)_in);
				}
			}

			throw new Asn1Exception("implicit tagging not implemented");
		}

Usage Example

 public IAsn1Convertible GetObjectParser(int tag, bool isExplicit)
 {
     if (isExplicit)
     {
         if (!_constructed)
         {
             throw new IOException("Explicit tags must be constructed (see X.690 8.14.2)");
         }
         return(_parser.ReadObject());
     }
     return(_parser.ReadImplicit(_constructed, tag));
 }
All Usage Examples Of Org.BouncyCastle.Asn1.Asn1StreamParser::ReadImplicit