Top Description Fields Constructors Methods
org.bouncycastle.asn1

public abstract Class ASN1TaggedObject

extends ASN1Primitive
implements ASN1TaggedObjectParser
Class Inheritance
All Implemented Interfaces
org.bouncycastle.asn1.ASN1TaggedObjectParser, org.bouncycastle.asn1.InMemoryRepresentable, org.bouncycastle.asn1.ASN1Encodable
Known Direct Subclasses
org.bouncycastle.asn1.DERTaggedObject, org.bouncycastle.asn1.DLTaggedObject, org.bouncycastle.asn1.BERTaggedObject
Imports
java.io.IOException

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).

Field Summary

Modifier and TypeField and Description
pack-priv boolean
pack-priv boolean
pack-priv ASN1Encodable
pack-priv int

Constructor Summary

AccessConstructor and Description
public
ASN1TaggedObject(boolean
true if the object is explicitly tagged.
explicit
,
int
the tag number for this object.
tagNo
,
ASN1Encodable
the tagged object.
obj
)

Create a tagged object with the style given by the value of explicit.

Method Summary

Modifier and TypeMethod and Description
pack-priv boolean
asn1Equals(ASN1Primitive o)

Implements abstract org.bouncycastle.asn1.ASN1Primitive.asn1Equals.

Equality (similarity) comparison for two ASN1Primitive objects.
pack-priv abstract void
public static ASN1TaggedObject
getInstance(ASN1TaggedObject obj, boolean explicit)

public static ASN1TaggedObject
public ASN1Primitive
getLoadedObject()

Implements org.bouncycastle.asn1.InMemoryRepresentable.getLoadedObject.

Get the in-memory representation of the ASN.1 object.
public ASN1Primitive
getObject()

Return whatever was following the tag.

public ASN1Encodable
getObjectParser(int
the primitive tag value for the object tagged originally.
tag
,
boolean
true if the tagging was done explicitly.
isExplicit
)

Implements org.bouncycastle.asn1.ASN1TaggedObjectParser.getObjectParser.

Return the object held in this tagged object as a parser assuming it has the type of the passed in tag.
public int

Returns:

the tag number.
getTagNo
()

Implements org.bouncycastle.asn1.ASN1TaggedObjectParser.getTagNo.

Return the tag number associated with this object.
public int
hashCode()

Implements abstract org.bouncycastle.asn1.ASN1Primitive.hashCode.

Returns a hash code value for this object.
public boolean
public boolean
isExplicit()

return whether or not the object may be explicitly tagged.

pack-priv ASN1Primitive
toDERObject()

Overrides org.bouncycastle.asn1.ASN1Primitive.toDERObject.

Return the current object as one which encodes using Distinguished Encoding Rules.
pack-priv ASN1Primitive
toDLObject()

Overrides org.bouncycastle.asn1.ASN1Primitive.toDLObject.

Return the current object as one which encodes using Definite Length encoding.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from org.bouncycastle.asn1.ASN1Primitive:
encodedLengthequalsfromByteArrayisConstructedtoASN1Primitive

Field Detail

emptyback to summary
pack-priv boolean empty
explicitback to summary
pack-priv boolean explicit
objback to summary
pack-priv ASN1Encodable obj
tagNoback to summary
pack-priv int tagNo

Constructor Detail

ASN1TaggedObjectback to summary
public ASN1TaggedObject(boolean explicit, int tagNo, ASN1Encodable obj)

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:boolean

true if the object is explicitly tagged.

tagNo:int

the tag number for this object.

obj:ASN1Encodable

the tagged object.

Method Detail

asn1Equalsback to summary
pack-priv boolean asn1Equals(ASN1Primitive o)

Implements abstract org.bouncycastle.asn1.ASN1Primitive.asn1Equals.

Doc from org.bouncycastle.asn1.ASN1Primitive.asn1Equals.

Equality (similarity) comparison for two ASN1Primitive objects.

encodeback to summary
pack-priv abstract void encode(ASN1OutputStream out) throws IOException

Implements abstract org.bouncycastle.asn1.ASN1Primitive.encode.

getInstanceback to summary
public static ASN1TaggedObject getInstance(ASN1TaggedObject obj, boolean explicit)
getInstanceback to summary
public static ASN1TaggedObject getInstance(Object obj)
getLoadedObjectback to summary
public ASN1Primitive getLoadedObject()

Implements org.bouncycastle.asn1.InMemoryRepresentable.getLoadedObject.

Doc from org.bouncycastle.asn1.InMemoryRepresentable.getLoadedObject.

Get the in-memory representation of the ASN.1 object.

Returns:ASN1Primitive

an ASN1Primitive representing the loaded object.

getObjectback to summary
public ASN1Primitive 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.

getObjectParserback to summary
public ASN1Encodable getObjectParser(int tag, boolean isExplicit) throws IOException

Implements org.bouncycastle.asn1.ASN1TaggedObjectParser.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.

Parameters
tag:int

Doc from org.bouncycastle.asn1.ASN1TaggedObjectParser.getObjectParser.

the primitive tag value for the object tagged originally.

isExplicit:boolean

Doc from org.bouncycastle.asn1.ASN1TaggedObjectParser.getObjectParser.

true if the tagging was done explicitly.

Returns:ASN1Encodable

Doc from org.bouncycastle.asn1.ASN1TaggedObjectParser.getObjectParser.

a parser for the tagged object.

Exceptions
IOException:

Doc from org.bouncycastle.asn1.ASN1TaggedObjectParser.getObjectParser.

if a parser cannot be constructed.

getTagNoback to summary
public int getTagNo()

Implements org.bouncycastle.asn1.ASN1TaggedObjectParser.getTagNo.

Return the tag number associated with this object.

Returns:int

the tag number.

hashCodeback to summary
public int hashCode()

Implements abstract org.bouncycastle.asn1.ASN1Primitive.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

isEmptyback to summary
public boolean isEmpty()
isExplicitback to summary
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.

toDERObjectback to summary
pack-priv ASN1Primitive toDERObject()

Overrides org.bouncycastle.asn1.ASN1Primitive.toDERObject.

Doc from org.bouncycastle.asn1.ASN1Primitive.toDERObject.

Return the current object as one which encodes using Distinguished Encoding Rules.

Returns:ASN1Primitive

a DER version of this.

toDLObjectback to summary
pack-priv ASN1Primitive toDLObject()

Overrides org.bouncycastle.asn1.ASN1Primitive.toDLObject.

Doc from org.bouncycastle.asn1.ASN1Primitive.toDLObject.

Return the current object as one which encodes using Definite Length encoding.

Returns:ASN1Primitive

a DL version of this.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object