Package org.bouncycastle.asn1
Class ASN1ApplicationSpecific
java.lang.Object
org.bouncycastle.asn1.ASN1Object
org.bouncycastle.asn1.ASN1Primitive
org.bouncycastle.asn1.ASN1ApplicationSpecific
- All Implemented Interfaces:
ASN1ApplicationSpecificParser
,ASN1Encodable
,ASN1TaggedObjectParser
,InMemoryRepresentable
,Encodable
- Direct Known Subclasses:
BERApplicationSpecific
,DERApplicationSpecific
,DLApplicationSpecific
public abstract class ASN1ApplicationSpecific
extends ASN1Primitive
implements ASN1ApplicationSpecificParser
Base class for an ASN.1 ApplicationSpecific object
-
Method Summary
Modifier and TypeMethodDescriptionint
Return the tag number associated with this object,byte[]
Return the contents of this object as a byte[]Return the enclosed object assuming explicit tagging.static ASN1ApplicationSpecific
getInstance
(Object obj) Return an ASN1ApplicationSpecific from the passed in object, which may be a byte array, or null.final ASN1Primitive
Get the in-memory representation of the ASN.1 object.Deprecated.Will be removed.getObject
(int tagNo) Return the enclosed object assuming implicit tagging.getObjectParser
(int tag, boolean isExplicit) Return a parser for the actual object tagged.int
Return the tag class associated with this object.ASN1ApplicationSpecific uses an internal ASN1TaggedObject for the implementation, and will soon be deprecated in favour of using ASN1TaggedObject with a tag class ofBERTags.APPLICATION
.int
getTagNo()
Return the tag number associated with this object.boolean
hasApplicationTag
(int tagNo) boolean
hasContextTag
(int tagNo) int
hashCode()
boolean
hasTag
(int tagClass, int tagNo) boolean
Return true if the object is marked as constructed, false otherwise.parseBaseUniversal
(boolean declaredExplicit, int baseTagNo) Needed for open types, until we have better type-guided parsing support.parseImplicitBaseTagged
(int baseTagClass, int baseTagNo) Read the next object in the parser.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, toString, wait, wait, wait
Methods inherited from interface org.bouncycastle.asn1.ASN1Encodable
toASN1Primitive
-
Method Details
-
getInstance
Return an ASN1ApplicationSpecific from the passed in object, which may be a byte array, or null.- Parameters:
obj
- the object to be converted.- Returns:
- obj's representation as an ASN1ApplicationSpecific object.
-
getApplicationTag
public int getApplicationTag()Return the tag number associated with this object,- Returns:
- the application tag number.
-
getContents
public byte[] getContents()Return the contents of this object as a byte[]- Returns:
- the encoded contents of the object.
-
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.
-
getObject
Deprecated.Will be removed. UsegetEnclosedObject()
instead.Return the enclosed object assuming explicit tagging.- Returns:
- the resulting object
- Throws:
IOException
- if reconstruction fails.
-
getEnclosedObject
Return the enclosed object assuming explicit tagging.- Returns:
- the resulting object
- Throws:
IOException
- if reconstruction fails.
-
getObject
Return the enclosed object assuming implicit tagging.- Parameters:
tagNo
- the type tag that should be applied to the object's contents.- Returns:
- the resulting object
- Throws:
IOException
- if reconstruction fails.
-
getObjectParser
Description copied from interface:ASN1TaggedObjectParser
Return a parser for the actual object tagged.- 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.
-
parseBaseUniversal
- Specified by:
parseBaseUniversal
in interfaceASN1TaggedObjectParser
- Throws:
IOException
-
parseExplicitBaseObject
Description copied from interface:ASN1TaggedObjectParser
Needed 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 tagclass
andnumber
.- Specified by:
parseExplicitBaseObject
in interfaceASN1TaggedObjectParser
- Throws:
IOException
-
parseExplicitBaseTagged
- Specified by:
parseExplicitBaseTagged
in interfaceASN1TaggedObjectParser
- Throws:
IOException
-
parseImplicitBaseTagged
public ASN1TaggedObjectParser parseImplicitBaseTagged(int baseTagClass, int baseTagNo) throws IOException - Specified by:
parseImplicitBaseTagged
in interfaceASN1TaggedObjectParser
- Throws:
IOException
-
getTagClass
public int getTagClass()Description copied from interface:ASN1TaggedObjectParser
Return the tag class associated with this object.- Specified by:
getTagClass
in interfaceASN1TaggedObjectParser
- Returns:
- the tag class.
-
getTagNo
public int getTagNo()Description copied from interface:ASN1TaggedObjectParser
Return the tag number associated with this object.- Specified by:
getTagNo
in interfaceASN1TaggedObjectParser
- Returns:
- the tag number.
-
hasApplicationTag
public boolean hasApplicationTag(int tagNo) -
hasContextTag
public boolean hasContextTag(int tagNo) - Specified by:
hasContextTag
in interfaceASN1TaggedObjectParser
-
hasTag
public boolean hasTag(int tagClass, int tagNo) - Specified by:
hasTag
in interfaceASN1TaggedObjectParser
-
getTaggedObject
ASN1ApplicationSpecific uses an internal ASN1TaggedObject for the implementation, and will soon be deprecated in favour of using ASN1TaggedObject with a tag class ofBERTags.APPLICATION
. This method lets you get the internal ASN1TaggedObject so that client code can begin the migration. -
hashCode
public int hashCode()- Specified by:
hashCode
in classASN1Primitive
-
isConstructed
public boolean isConstructed()Return true if the object is marked as constructed, false otherwise.- Returns:
- true if constructed, otherwise false.
-
readObject
Description copied from interface:ASN1ApplicationSpecificParser
Read the next object in the parser.- Specified by:
readObject
in interfaceASN1ApplicationSpecificParser
- Returns:
- an ASN1Encodable
- Throws:
IOException
- on a parsing or decoding error.
-