Class ASN1TaggedObject
java.lang.Object
org.gudy.bouncycastle.asn1.ASN1Encodable
org.gudy.bouncycastle.asn1.DERObject
org.gudy.bouncycastle.asn1.ASN1Object
org.gudy.bouncycastle.asn1.ASN1TaggedObject
- All Implemented Interfaces:
ASN1TaggedObjectParser, DEREncodable, DERTags
- Direct Known Subclasses:
DERTaggedObject
ASN.1 TaggedObject - in ASN.1 nottation this is any object proceeded by
a [n] where n is some number - these are assume to follow the construction
rules (as with sequences).
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) boolean(package private) boolean(package private) DEREncodable(package private) intFields inherited from class ASN1Encodable
BER, DERFields inherited from interface DERTags
APPLICATION, BIT_STRING, BMP_STRING, BOOLEAN, CONSTRUCTED, ENUMERATED, EXTERNAL, GENERAL_STRING, GENERALIZED_TIME, GRAPHIC_STRING, IA5_STRING, INTEGER, NULL, NUMERIC_STRING, OBJECT_IDENTIFIER, OCTET_STRING, PRINTABLE_STRING, SEQUENCE, SEQUENCE_OF, SET, SET_OF, T61_STRING, TAGGED, UNIVERSAL_STRING, UTC_TIME, UTF8_STRING, VIDEOTEX_STRING, VISIBLE_STRING -
Constructor Summary
ConstructorsConstructorDescriptionASN1TaggedObject(boolean explicit, int tagNo, DEREncodable obj) Create a tagged object with the style given by the value of explicit.ASN1TaggedObject(int tagNo, DEREncodable obj) Create a tagged object in the explicit style. -
Method Summary
Modifier and TypeMethodDescription(package private) boolean(package private) abstract voidencode(DEROutputStream out) static ASN1TaggedObjectgetInstance(Object obj) static ASN1TaggedObjectgetInstance(ASN1TaggedObject obj, boolean explicit) 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.intgetTagNo()inthashCode()booleanisEmpty()booleanreturn whether or not the object may be explicitly tagged.toString()Methods inherited from class ASN1Object
equals, fromByteArrayMethods inherited from class DERObject
toASN1ObjectMethods inherited from class ASN1Encodable
getDEREncoded, getDERObject, getEncoded, getEncodedMethods inherited from interface DEREncodable
getDERObject
-
Field Details
-
tagNo
int tagNo -
empty
boolean empty -
explicit
boolean explicit -
obj
DEREncodable obj
-
-
Constructor Details
-
ASN1TaggedObject
Create a tagged object in the explicit style.- Parameters:
tagNo- the tag number for this object.obj- the tagged object.
-
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
-
asn1Equals
- Specified by:
asn1Equalsin classASN1Object
-
hashCode
public int hashCode()- Specified by:
hashCodein classASN1Object
-
getTagNo
public int getTagNo()- Specified by:
getTagNoin 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.
-
isEmpty
public boolean isEmpty() -
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:
getObjectParserin interfaceASN1TaggedObjectParser
-
encode
- Specified by:
encodein classASN1Object- Throws:
IOException
-
toString
-