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
ConstructorsConstructorDescriptionASN1TaggedObject
(boolean explicit, int tagNo, ASN1Encodable obj) Create a tagged object with the style given by the value of explicit. -
Method Summary
Modifier and TypeMethodDescriptionstatic ASN1TaggedObject
getInstance
(Object obj) static ASN1TaggedObject
getInstance
(ASN1TaggedObject obj, boolean explicit) Get the in-memory representation of the ASN.1 object.Return whatever was following the tag.getObjectParser
(int tag, boolean isExplicit) Return the object held in this tagged object as a parser assuming it has the type of the passed in tag.int
getTagNo()
Return the tag number associated with this object.int
hashCode()
boolean
isEmpty()
Deprecated.Will be removed (always returns false).boolean
return whether or not the object may be explicitly tagged.toString()
Methods inherited from class org.bouncycastle.asn1.ASN1Primitive
encodeTo, encodeTo, equals, equals, equals, fromByteArray, toASN1Primitive
Methods inherited from class org.bouncycastle.asn1.ASN1Object
getEncoded, getEncoded, hasEncodedTagValue
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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.
-
-
Method Details
-
getInstance
-
getInstance
-
hashCode
public int hashCode()- Specified by:
hashCode
in classASN1Primitive
-
getTagNo
public int getTagNo()Return the tag number associated with this object.- Specified by:
getTagNo
in interfaceASN1TaggedObjectParser
- Returns:
- the tag number.
-
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.
-
isEmpty
public boolean isEmpty()Deprecated.Will be removed (always returns false). -
getObject
Return whatever was following the tag.Note: tagged objects are generally context dependent if you're trying to extract a tagged object you should be going via the appropriate getInstance method.
-
getObjectParser
Return the object held in this tagged object as a parser assuming it has the type of the passed in tag. If the object doesn't have a parser associated with it, the base object is returned.- Specified by:
getObjectParser
in interfaceASN1TaggedObjectParser
- Parameters:
tag
- the primitive tag value for the object tagged originally.isExplicit
- true if the tagging was done explicitly.- Returns:
- a parser for the tagged object.
- Throws:
IOException
- if a parser cannot be constructed.
-
getLoadedObject
Description copied from interface:InMemoryRepresentable
Get the in-memory representation of the ASN.1 object.- Specified by:
getLoadedObject
in interfaceInMemoryRepresentable
- Returns:
- an ASN1Primitive representing the loaded object.
-
toString
-