public abstract class ASN1Type extends Object implements ASN1Constants
| Modifier and Type | Field and Description |
|---|---|
int |
constrId
Integer representation of constructed identifier.
|
int |
id
Integer representation of primitive identifier.
|
CLASS_APPLICATION, CLASS_CONTEXTSPECIFIC, CLASS_PRIVATE, CLASS_UNIVERSAL, PC_CONSTRUCTED, PC_PRIMITIVE, TAG_ANY, TAG_BITSTRING, TAG_BMPSTRING, TAG_BOOLEAN, TAG_C_BITSTRING, TAG_C_GENERALIZEDTIME, TAG_C_OCTETSTRING, TAG_C_SEQUENCE, TAG_C_SEQUENCEOF, TAG_C_SET, TAG_C_SETOF, TAG_C_UTCTIME, TAG_C_UTF8STRING, TAG_CHOICE, TAG_EMBEDDEDPDV, TAG_ENUM, TAG_EXTERNAL, TAG_GENERALIZEDTIME, TAG_GENERALSTRING, TAG_GRAPHICSTRING, TAG_IA5STRING, TAG_INSTANCEOF, TAG_INTEGER, TAG_ISO646STRING, TAG_NULL, TAG_NUMERICSTRING, TAG_OBJDESCRIPTOR, TAG_OCTETSTRING, TAG_OID, TAG_PRINTABLESTRING, TAG_REAL, TAG_RELATIVEOID, TAG_SEQUENCE, TAG_SEQUENCEOF, TAG_SET, TAG_SETOF, TAG_T61STRING, TAG_TELETEXSTRING, TAG_UNIVERSALSTRING, TAG_UTCTIME, TAG_UTF8STRING, TAG_VIDEOTEXSTRING, TAG_VISIBLESTRING| Constructor and Description |
|---|
ASN1Type(int tagNumber)
Constructs a primitive, universal ASN.1 type.
|
ASN1Type(int tagClass,
int tagNumber)
Constructs an ASN.1 type.
|
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
checkTag(int identifier)
Tests provided identifier.
|
abstract Object |
decode(BerInputStream in)
Decodes ASN.1 type.
|
Object |
decode(byte[] encoded) |
Object |
decode(byte[] encoded,
int offset,
int encodingLen) |
Object |
decode(InputStream in) |
byte[] |
encode(Object object) |
abstract void |
encodeASN(BerOutputStream out)
Encodes ASN.1 type.
|
abstract void |
encodeContent(BerOutputStream out) |
protected Object |
getDecodedObject(BerInputStream in)
Creates decoded object.
|
int |
getEncodedLength(BerOutputStream out) |
abstract void |
setEncodingContent(BerOutputStream out) |
String |
toString()
Returns a string containing a concise, human-readable description of this
object.
|
void |
verify(byte[] encoded) |
void |
verify(InputStream in) |
public final int id
public final int constrId
public ASN1Type(int tagNumber)
tagNumber - - ASN.1 tag numberIllegalArgumentException - - if tagNumber is invalidpublic ASN1Type(int tagClass,
int tagNumber)
tagClass - - tag class. MUST be
CLASS_UNIVERSAL, CLASS_APPLICATION, CLASS_CONTEXTSPECIFIC, CLASS_PRIVATEtagNumber - - ASN.1 tag number.IllegalArgumentException - - if tagClass or tagNumber is invalidpublic final Object decode(byte[] encoded) throws IOException
IOExceptionpublic final Object decode(byte[] encoded, int offset, int encodingLen) throws IOException
IOExceptionpublic final Object decode(InputStream in) throws IOException
IOExceptionpublic final void verify(byte[] encoded)
throws IOException
IOExceptionpublic final void verify(InputStream in) throws IOException
IOExceptionpublic final byte[] encode(Object object)
public abstract Object decode(BerInputStream in) throws IOException
IOException - if an I/O error occurs or the end of the stream is reachedpublic abstract boolean checkTag(int identifier)
identifier - identifier to be verifiedprotected Object getDecodedObject(BerInputStream in) throws IOException
IOExceptionpublic abstract void encodeASN(BerOutputStream out)
public abstract void encodeContent(BerOutputStream out)
public abstract void setEncodingContent(BerOutputStream out)
public int getEncodedLength(BerOutputStream out)
public String toString()
ObjectgetClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toString method
if you intend implementing your own toString method.