Package org.bouncycastle.asn1
Class ASN1TaggedObject
java.lang.Object
org.bouncycastle.asn1.ASN1Object
org.bouncycastle.asn1.ASN1Primitive
org.bouncycastle.asn1.ASN1TaggedObject
- All Implemented Interfaces:
ASN1Encodable,ASN1TaggedObjectParser,InMemoryRepresentable,Encodable
- Direct Known Subclasses:
BERTaggedObject,DERTaggedObject,DLTaggedObject
ASN.1 TaggedObject - in ASN.1 notation this is any object preceded by
a [n] where n is some number - these are assumed to follow the construction
rules (as with sequences).
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedASN1TaggedObject(boolean explicit, int tagClass, int tagNo, ASN1Encodable obj) protectedASN1TaggedObject(boolean explicit, int tagNo, ASN1Encodable obj) Create a tagged object with the style given by the value of explicit. -
Method Summary
Modifier and TypeMethodDescriptionNeeded for open types, until we have better type-guided parsing support.getBaseUniversal(boolean declaredExplicit, int tagNo) Note: tagged objects are generally context dependent.Needed for open types, until we have better type-guided parsing support.getImplicitBaseTagged(int baseTagClass, int baseTagNo) static ASN1TaggedObjectgetInstance(Object obj) static ASN1TaggedObjectgetInstance(Object obj, int tagClass) static ASN1TaggedObjectgetInstance(Object obj, int tagClass, int tagNo) static ASN1TaggedObjectgetInstance(ASN1TaggedObject taggedObject, boolean declaredExplicit) static ASN1TaggedObjectgetInstance(ASN1TaggedObject taggedObject, int tagClass, boolean declaredExplicit) static ASN1TaggedObjectgetInstance(ASN1TaggedObject taggedObject, int tagClass, int tagNo, boolean declaredExplicit) final ASN1PrimitiveGet the in-memory representation of the ASN.1 object.static ASN1TaggedObjectgetOptional(ASN1Object element) static ASN1TaggedObjectgetOptional(ASN1Object element, int tagClass) static ASN1TaggedObjectgetOptional(ASN1Object element, int tagClass, int tagNo) intReturn the tag class associated with this object.intgetTagNo()Return the tag number associated with this object.booleanbooleanhasContextTag(int tagNo) inthashCode()booleanhasTag(int tagClass, int tagNo) booleanhasTagClass(int tagClass) booleanreturn whether or not the object may be explicitly tagged.parseBaseUniversal(boolean declaredExplicit, int baseTagNo) Needed for open types, until we have better type-guided parsing support.parseImplicitBaseTagged(int baseTagClass, int baseTagNo) toString()Methods inherited from class org.bouncycastle.asn1.ASN1Primitive
encodeTo, encodeTo, equals, equals, equals, fromByteArray, toASN1PrimitiveMethods inherited from class org.bouncycastle.asn1.ASN1Object
getEncoded, getEncoded, hasEncodedTagValueMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.bouncycastle.asn1.ASN1Encodable
toASN1Primitive
-
Constructor Details
-
ASN1TaggedObject
Create a tagged object with the style given by the value of explicit.If the object implements ASN1Choice the tag style will always be changed to explicit in accordance with the ASN.1 encoding rules.
- Parameters:
explicit- true if the object is explicitly tagged.tagNo- the tag number for this object.obj- the tagged object.
-
ASN1TaggedObject
-
-
Method Details
-
getInstance
-
getInstance
-
getInstance
-
getInstance
-
getInstance
public static ASN1TaggedObject getInstance(ASN1TaggedObject taggedObject, int tagClass, boolean declaredExplicit) -
getInstance
public static ASN1TaggedObject getInstance(ASN1TaggedObject taggedObject, int tagClass, int tagNo, boolean declaredExplicit) -
getOptional
-
getOptional
-
getOptional
-
hashCode
public int hashCode()- Specified by:
hashCodein classASN1Primitive
-
getTagClass
public int getTagClass()Description copied from interface:ASN1TaggedObjectParserReturn the tag class associated with this object.- Specified by:
getTagClassin interfaceASN1TaggedObjectParser- Returns:
- the tag class.
-
getTagNo
public int getTagNo()Return the tag number associated with this object.- Specified by:
getTagNoin interfaceASN1TaggedObjectParser- Returns:
- the tag number.
-
hasContextTag
public boolean hasContextTag()- Specified by:
hasContextTagin interfaceASN1TaggedObjectParser
-
hasContextTag
public boolean hasContextTag(int tagNo) - Specified by:
hasContextTagin interfaceASN1TaggedObjectParser
-
hasTag
public boolean hasTag(int tagClass, int tagNo) - Specified by:
hasTagin interfaceASN1TaggedObjectParser
-
hasTagClass
public boolean hasTagClass(int tagClass) - Specified by:
hasTagClassin interfaceASN1TaggedObjectParser
-
isExplicit
public boolean isExplicit()return whether or not the object may be explicitly tagged.Note: if the object has been read from an input stream, the only time you can be sure if isExplicit is returning the true state of affairs is if it returns false. An implicitly tagged object may appear to be explicitly tagged, so you need to understand the context under which the reading was done as well, see getObject below.
-
getBaseObject
Needed for open types, until we have better type-guided parsing support. Use sparingly for other purposes, and prefergetExplicitBaseTagged(),getImplicitBaseTagged(int, int)orgetBaseUniversal(boolean, int)where possible. Before using, check for matching tagclassandnumber. -
getExplicitBaseObject
Needed for open types, until we have better type-guided parsing support. Use sparingly for other purposes, and prefergetExplicitBaseTagged()orgetBaseUniversal(boolean, int)where possible. Before using, check for matching tagclassandnumber. -
getExplicitBaseTagged
-
getImplicitBaseTagged
-
getBaseUniversal
Note: tagged objects are generally context dependent. Before trying to extract a tagged object this way, make sure you have checked that both thetag classandtag numbermatch what you are looking for.- Parameters:
declaredExplicit- Whether the tagged type for this object was declared EXPLICIT.tagNo- The universaltag numberof the expected base object.
-
parseBaseUniversal
- Specified by:
parseBaseUniversalin interfaceASN1TaggedObjectParser- Throws:
IOException
-
parseExplicitBaseObject
Description copied from interface:ASN1TaggedObjectParserNeeded for open types, until we have better type-guided parsing support. Use sparingly for other purposes, and preferASN1TaggedObjectParser.parseExplicitBaseTagged()orASN1TaggedObjectParser.parseBaseUniversal(boolean, int)where possible. Before using, check for matching tagclassandnumber.- Specified by:
parseExplicitBaseObjectin interfaceASN1TaggedObjectParser- Throws:
IOException
-
parseExplicitBaseTagged
- Specified by:
parseExplicitBaseTaggedin interfaceASN1TaggedObjectParser- Throws:
IOException
-
parseImplicitBaseTagged
public ASN1TaggedObjectParser parseImplicitBaseTagged(int baseTagClass, int baseTagNo) throws IOException - Specified by:
parseImplicitBaseTaggedin interfaceASN1TaggedObjectParser- Throws:
IOException
-
getLoadedObject
Description copied from interface:InMemoryRepresentableGet the in-memory representation of the ASN.1 object.- Specified by:
getLoadedObjectin interfaceInMemoryRepresentable- Returns:
- an ASN1Primitive representing the loaded object.
-
toString
-