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.DLTaggedObject, org.bouncycastle.asn1.DERTaggedObject, org.bouncycastle.asn1.BERTaggedObject
Imports
java.io.IOException, org.bouncycastle.util.Arrays

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
private static final int
private static final int
pack-priv final int
pack-priv final ASN1Encodable
private static final int
private static final int
pack-priv final int
pack-priv final int

Constructor Summary

AccessConstructor and Description
protected
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.

protected
ASN1TaggedObject(boolean explicit, int tagClass, int tagNo, ASN1Encodable obj)

pack-priv
ASN1TaggedObject(int explicitness, int tagClass, int tagNo, ASN1Encodable obj)

Method Summary

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

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

Equality (similarity) comparison for two ASN1Primitive objects.
private static ASN1TaggedObject
pack-priv static ASN1Primitive
createConstructedDL(int tagClass, int tagNo, ASN1EncodableVector contentsElements)

pack-priv static ASN1Primitive
createConstructedIL(int tagClass, int tagNo, ASN1EncodableVector contentsElements)

pack-priv static ASN1Primitive
createPrimitive(int tagClass, int tagNo, byte[] contentsOctets)

public ASN1Object
getBaseObject()

Needed for open types, until we have better type-guided parsing support.

public ASN1Primitive
getBaseUniversal(boolean
Whether the tagged type for this object was declared EXPLICIT.
declaredExplicit
,
int
The universal tag number of the expected base object.
tagNo
)

Note

tagged objects are generally context dependent.

pack-priv ASN1Primitive
getBaseUniversal(boolean declaredExplicit, ASN1UniversalType universalType)

public ASN1Object
getExplicitBaseObject()

Needed for open types, until we have better type-guided parsing support.

public ASN1TaggedObject
public ASN1TaggedObject
getImplicitBaseTagged(int baseTagClass, int baseTagNo)

public static ASN1TaggedObject
public static ASN1TaggedObject
getInstance(Object obj, int tagClass)

public static ASN1TaggedObject
getInstance(Object obj, int tagClass, int tagNo)

public static ASN1TaggedObject
getInstance(ASN1TaggedObject taggedObject, boolean declaredExplicit)

public final ASN1Primitive
getLoadedObject()

Implements org.bouncycastle.asn1.InMemoryRepresentable.getLoadedObject.

Get the in-memory representation of the ASN.1 object.
public int
getTagClass()

Implements org.bouncycastle.asn1.ASN1TaggedObjectParser.getTagClass.

Return the tag class associated with this object.
public int

Returns:

the tag number.
getTagNo
()

Implements org.bouncycastle.asn1.ASN1TaggedObjectParser.getTagNo.

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

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

Returns a hash code value for the object.
public boolean
hasTag(int tagClass, int tagNo)

Implements org.bouncycastle.asn1.ASN1TaggedObjectParser.hasTag.

public boolean
public boolean
isExplicit()

return whether or not the object may be explicitly tagged.

pack-priv boolean
public ASN1Encodable
parseBaseUniversal(boolean declaredExplicit, int baseTagNo)

Implements org.bouncycastle.asn1.ASN1TaggedObjectParser.parseBaseUniversal.

public ASN1Encodable
parseExplicitBaseObject()

Implements org.bouncycastle.asn1.ASN1TaggedObjectParser.parseExplicitBaseObject.

Needed for open types, until we have better type-guided parsing support.
public ASN1TaggedObjectParser
public ASN1TaggedObjectParser
pack-priv abstract ASN1Sequence
pack-priv abstract ASN1TaggedObject
replaceTag(int tagClass, int tagNo)

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

Field Detail

DECLARED_EXPLICITback to summary
private static final int DECLARED_EXPLICIT
DECLARED_IMPLICITback to summary
private static final int DECLARED_IMPLICIT
explicitnessback to summary
pack-priv final int explicitness
objback to summary
pack-priv final ASN1Encodable obj
PARSED_EXPLICITback to summary
private static final int PARSED_EXPLICIT
PARSED_IMPLICITback to summary
private static final int PARSED_IMPLICIT
tagClassback to summary
pack-priv final int tagClass
tagNoback to summary
pack-priv final int tagNo

Constructor Detail

ASN1TaggedObjectback to summary
protected 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.

ASN1TaggedObjectback to summary
protected ASN1TaggedObject(boolean explicit, int tagClass, int tagNo, ASN1Encodable obj)
ASN1TaggedObjectback to summary
pack-priv ASN1TaggedObject(int explicitness, int tagClass, int tagNo, ASN1Encodable obj)

Method Detail

asn1Equalsback to summary
pack-priv final boolean asn1Equals(ASN1Primitive other)

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

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

Equality (similarity) comparison for two ASN1Primitive objects.

checkedCastback to summary
private static ASN1TaggedObject checkedCast(ASN1Primitive primitive)
createConstructedDLback to summary
pack-priv static ASN1Primitive createConstructedDL(int tagClass, int tagNo, ASN1EncodableVector contentsElements)
createConstructedILback to summary
pack-priv static ASN1Primitive createConstructedIL(int tagClass, int tagNo, ASN1EncodableVector contentsElements)
createPrimitiveback to summary
pack-priv static ASN1Primitive createPrimitive(int tagClass, int tagNo, byte[] contentsOctets)
getBaseObjectback to summary
public ASN1Object getBaseObject()

Needed for open types, until we have better type-guided parsing support. Use sparingly for other purposes, and prefer getExplicitBaseTagged(), getImplicitBaseTagged(int, int) or getBaseUniversal(boolean, int) where possible. Before using, check for matching tag class and number.

getBaseUniversalback to summary
public ASN1Primitive getBaseUniversal(boolean declaredExplicit, int tagNo)

Note

tagged objects are generally context dependent. Before trying to extract a tagged object this way, make sure you have checked that both the tag class and tag number match what you are looking for.

Parameters
declaredExplicit:boolean

Whether the tagged type for this object was declared EXPLICIT.

tagNo:int

The universal tag number of the expected base object.

getBaseUniversalback to summary
pack-priv ASN1Primitive getBaseUniversal(boolean declaredExplicit, ASN1UniversalType universalType)
getExplicitBaseObjectback to summary
public ASN1Object getExplicitBaseObject()

Needed for open types, until we have better type-guided parsing support. Use sparingly for other purposes, and prefer getExplicitBaseTagged() or getBaseUniversal(boolean, int) where possible. Before using, check for matching tag class and number.

getExplicitBaseTaggedback to summary
public ASN1TaggedObject getExplicitBaseTagged()
getImplicitBaseTaggedback to summary
public ASN1TaggedObject getImplicitBaseTagged(int baseTagClass, int baseTagNo)
getInstanceback to summary
public static ASN1TaggedObject getInstance(Object obj)
getInstanceback to summary
public static ASN1TaggedObject getInstance(Object obj, int tagClass)
getInstanceback to summary
public static ASN1TaggedObject getInstance(Object obj, int tagClass, int tagNo)
getInstanceback to summary
public static ASN1TaggedObject getInstance(ASN1TaggedObject taggedObject, boolean declaredExplicit)
getLoadedObjectback to summary
public final 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.

getTagClassback to summary
public int getTagClass()

Implements org.bouncycastle.asn1.ASN1TaggedObjectParser.getTagClass.

Doc from org.bouncycastle.asn1.ASN1TaggedObjectParser.getTagClass.

Return the tag class associated with this object.

Returns:int

the tag class.

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.

hasContextTagback to summary
public boolean hasContextTag()

Implements org.bouncycastle.asn1.ASN1TaggedObjectParser.hasContextTag.

hasContextTagback to summary
public boolean hasContextTag(int tagNo)

Implements org.bouncycastle.asn1.ASN1TaggedObjectParser.hasContextTag.

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

hasTagback to summary
public boolean hasTag(int tagClass, int tagNo)

Implements org.bouncycastle.asn1.ASN1TaggedObjectParser.hasTag.

hasTagClassback to summary
public boolean hasTagClass(int tagClass)

Implements org.bouncycastle.asn1.ASN1TaggedObjectParser.hasTagClass.

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.

isParsedback to summary
pack-priv boolean isParsed()
parseBaseUniversalback to summary
public ASN1Encodable parseBaseUniversal(boolean declaredExplicit, int baseTagNo) throws IOException

Implements org.bouncycastle.asn1.ASN1TaggedObjectParser.parseBaseUniversal.

parseExplicitBaseObjectback to summary
public ASN1Encodable parseExplicitBaseObject() throws IOException

Implements org.bouncycastle.asn1.ASN1TaggedObjectParser.parseExplicitBaseObject.

Doc from org.bouncycastle.asn1.ASN1TaggedObjectParser.parseExplicitBaseObject.

Needed for open types, until we have better type-guided parsing support. Use sparingly for other purposes, and prefer parseExplicitBaseTagged() or parseBaseUniversal(boolean, int) where possible. Before using, check for matching tag class and number.

parseExplicitBaseTaggedback to summary
public ASN1TaggedObjectParser parseExplicitBaseTagged() throws IOException

Implements org.bouncycastle.asn1.ASN1TaggedObjectParser.parseExplicitBaseTagged.

parseImplicitBaseTaggedback to summary
public ASN1TaggedObjectParser parseImplicitBaseTagged(int baseTagClass, int baseTagNo) throws IOException

Implements org.bouncycastle.asn1.ASN1TaggedObjectParser.parseImplicitBaseTagged.

rebuildConstructedback to summary
pack-priv abstract ASN1Sequence rebuildConstructed(ASN1Primitive primitive)
replaceTagback to summary
pack-priv abstract ASN1TaggedObject replaceTag(int tagClass, int tagNo)
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.