|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--net.rim.device.api.crypto.asn1.ASN1InputStream
A parser which parses bytes according to the ASN.1 Distinguished Encoding Rules (DER) and Basic Encoding Rules (BER) format specification.
Note: This is parses data in the same way that ASN1InputByteArray does. The difference is that ASN1InputByteArray class acts on byte arrays, rather than input streams, and is less object intensive. Hence, ASN1InputByteArray should be used instead of ASN1InputStream whenever possible. The only time you would want to use ASN1InputStream over ASN1InputByteArray is when you wish to be looking at multiple positions in the stream at once ( such as if you want to look at two sequences, within the same structure, at the same time.
Note that exception caching is omitted for clarity.
Test ::= SEQUENCE {
myNumber INTEGER,
myArray OCTET_STRING
}
// Declarations of variables which will hold the values from the Test fields
int myNumber;
byte[] myArray;
// Our input stream is an object which inherits from java.io.InputStream
InputStream inputStream = ...;
// Create an ASN.1 input stream (which uses DER encoding)
ASN1InputStream asn1Input = ASN1InputStream(inputStream);
// Read the beginning of an ASN.1 sequence
ASN1InputStream testSequence = asn1Input.readSequence();
// Read an integer value from the input stream
myNumber = testSequence.readInteger();
// Read the octet string
myArray = testSequence.readOctetStringAsByteArray();
// The value of the ASN.1 type "Test" is now stored in myNumber and myArray
DERTags,
ASN1InputByteArray,
ASN1OutputStream| Constructor Summary | ||
|
ASN1InputStream(byte[] data)
Creates an ASN1InputStream object based upon the data in the
given byte array.
|
|
|
ASN1InputStream(byte[] data,
int offset,
int length)
Creates an ASN1InputStream based upon the data in the
given byte array.
|
|
|
ASN1InputStream(InputStream inputStream)
Constructs an ASN1InputStream object which reads bytes from
inputStream.
|
|
| Method Summary | ||
|
boolean |
endOfStream()
Checks if we are at the end of this ASN1 stream, returning true if this is the case. |
|
boolean |
isNextTagApplicationSpecific()
Returns true if the next tag indicates application-specific. |
|
boolean |
isNextTagContextSpecific()
Returns true if the next tag indicates context-specific. |
|
boolean |
isNextTagPrivate()
Returns true if the next tag indicates private-use. |
|
boolean |
isNextTagUniversal()
Returns true if the next tag indicates Universal. |
|
int |
peekNextTag()
Returns the next tag value from the stream (without any flags). |
|
ASN1BitSet |
readBitString()
Reads a bit string in from the ASN1 input stream. |
|
ASN1BitSet |
readBitString(int tagging,
int tag)
Reads a bit string in from the ASN1 input stream with tagging. |
|
ASN1BitSet |
readBitString(int tagging,
int tag,
byte[] defaultValue)
Reads a bit string in from the ASN1 input stream with tagging. |
|
ASN1BitSet |
readBitString(int tagging,
int tag,
int clsFlags)
Reads a bit string in from the ASN1 input stream with tagging. |
|
ASN1BitSet |
readBitString(int tagging,
int tag,
int clsFlags,
byte[] defaultValue)
Reads a bit string in from the ASN1 input stream with tagging. |
|
String |
readBMPString()
Reads a BMP string in from the ASN1 input stream. |
|
String |
readBMPString(int tagging,
int tag)
Reads a BMP string in from the ASN1 input stream with tagging. |
|
String |
readBMPString(int tagging,
int tag,
int clsFlags)
Reads a BMP string in from the ASN1 input stream with tagging. |
|
String |
readBMPString(int tagging,
int tag,
int clsFlags,
String defaultValue)
Reads a BMP string in from the ASN1 input stream with tagging. |
|
String |
readBMPString(int tagging,
int tag,
String defaultValue)
Reads a BMP string in from the ASN1 input stream with tagging. |
|
boolean |
readBoolean()
Reads a boolean in from the ASN1 input stream. |
|
boolean |
readBoolean(int tagging,
int tag)
Reads a boolean in from the ASN1 input stream with tagging. |
|
boolean |
readBoolean(int tagging,
int tag,
boolean defaultValue)
Reads a boolean in from the ASN1 input stream with tagging. |
|
boolean |
readBoolean(int tagging,
int tag,
int clsFlags)
Reads a boolean in from the ASN1 input stream with tagging. |
|
boolean |
readBoolean(int tagging,
int tag,
int clsFlags,
boolean defaultValue)
Reads a boolean in from the ASN1 input stream with tagging. |
|
int |
readEnumerated()
Reads an enumerated value in from the ASN1 input stream. |
|
int |
readEnumerated(int tagging,
int tag)
Reads an enumerated value in from the ASN1 input stream with tagging. |
|
int |
readEnumerated(int tagging,
int tag,
int defaultValue)
Reads an enumerated value in from the ASN1 input stream with tagging. |
|
int |
readEnumerated(int tagging,
int tag,
int clsFlags,
int defaultValue)
Reads an enumerated value in from the ASN1 input stream with tagging. |
|
byte[] |
readFieldAsByteArray()
Returns the current field as a byte array. |
|
long |
readGeneralizedTime()
Returns an ASN.1 explicit time object from the input. |
|
long |
readGeneralizedTime(int tagging,
int tag)
Returns an ASN.1 explicit time object from the input. |
|
long |
readGeneralizedTime(int tagging,
int tag,
int clsFlags)
Returns an ASN.1 explicit time object from the input. |
|
long |
readGeneralizedTime(int tagging,
int tag,
int clsFlags,
long defaultValue)
Returns an ASN.1 explicit time object from the input. |
|
long |
readGeneralizedTime(int tagging,
int tag,
long defaultValue)
Returns an ASN.1 explicit time object from the input. |
|
String |
readIA5String()
Reads an IA5 string in from the ASN1 input stream. |
|
String |
readIA5String(int tagging,
int tag)
Reads a IA5 string in from the ASN1 input stream with tagging. |
|
String |
readIA5String(int tagging,
int tag,
int clsFlags)
Reads a IA5 string in from the ASN1 input stream with tagging. |
|
String |
readIA5String(int tagging,
int tag,
int clsFlags,
String defaultValue)
Reads a IA5 string in from the ASN1 input stream with tagging. |
|
String |
readIA5String(int tagging,
int tag,
String defaultValue)
Reads a IA5 string in from the ASN1 input stream with tagging. |
|
int |
readInteger()
Reads an integer in from the ASN1 input stream. |
|
int |
readInteger(int tagging,
int tag)
Reads an integer in from the ASN1 input stream with tagging. |
|
int |
readInteger(int tagging,
int tag,
int defaultValue)
Reads an integer in from the ASN1 input stream with tagging. |
|
int |
readInteger(int tagging,
int tag,
int clsFlags,
int defaultValue)
Reads an integer in from the ASN1 input stream with tagging. |
|
byte[] |
readIntegerAsByteArray()
Reads an integer (as a byte array) in from the ASN1 input stream. |
|
byte[] |
readIntegerAsByteArray(int tagging,
int tag)
Reads an integer (as a byte array) in from the ASN1 input stream with tagging. |
|
byte[] |
readIntegerAsByteArray(int tagging,
int tag,
byte[] defaultValue)
Reads an integer (as a byte array) in from the ASN1 input stream with tagging. |
|
byte[] |
readIntegerAsByteArray(int tagging,
int tag,
int clsFlags)
Reads an integer (as a byte array) in from the ASN1 input stream with tagging. |
|
byte[] |
readIntegerAsByteArray(int tagging,
int tag,
int clsFlags,
byte[] defaultValue)
Reads an integer (as a byte array) in from the ASN1 input stream with tagging. |
|
boolean |
readNull()
Reads a null in from the ASN1 input stream. |
|
boolean |
readNull(int tagging,
int tag)
Reads a null in from the ASN1 input stream with tagging. |
|
boolean |
readNull(int tagging,
int tag,
boolean defaultValue)
Reads a null in from the ASN1 input stream with tagging. |
|
boolean |
readNull(int tagging,
int tag,
int clsFlags)
Reads a null in from the ASN1 input stream with tagging. |
|
boolean |
readNull(int tagging,
int tag,
int clsFlags,
boolean defaultValue)
Reads a null in from the ASN1 input stream with tagging. |
|
InputStream |
readOctetString()
Reads an octet string in from the ASN1 input stream. |
|
InputStream |
readOctetString(int tagging,
int tag)
Reads an octet string in from the ASN1 input stream with tagging. |
|
InputStream |
readOctetString(int tagging,
int tag,
byte[] defaultValue)
Reads an octet string in from the ASN1 input stream with tagging. |
|
InputStream |
readOctetString(int tagging,
int tag,
int clsFlags)
Reads an octet string in from the ASN1 input stream with tagging. |
|
InputStream |
readOctetString(int tagging,
int tag,
int clsFlags,
byte[] defaultValue)
Reads an octet string in from the ASN1 input stream with tagging. |
|
byte[] |
readOctetStringAsByteArray()
Reads an octet string in from the ASN1 input stream. |
|
byte[] |
readOctetStringAsByteArray(int tagging,
int tag)
Reads an octet string in from the ASN1 input stream with tagging. |
|
byte[] |
readOctetStringAsByteArray(int tagging,
int tag,
byte[] defaultValue)
Reads an octet string in from the ASN1 input stream with tagging. |
|
byte[] |
readOctetStringAsByteArray(int tagging,
int tag,
int clsFlags)
Reads an octet string in from the ASN1 input stream with tagging. |
|
byte[] |
readOctetStringAsByteArray(int tagging,
int tag,
int clsFlags,
byte[] defaultValue)
Reads an octet string in from the ASN1 input stream with tagging. |
|
OID |
readOID()
Returns an ASN.1 Object Identifier (OID) from the input. |
|
OID |
readOID(int tagging,
int tag)
Returns an ASN.1 Object Identifier (OID) from the input with tagging. |
|
OID |
readOID(int tagging,
int tag,
int clsFlags)
Returns an ASN.1 Object Identifier (OID) from the input with tagging. |
|
OID |
readOID(int tagging,
int tag,
int clsFlags,
OID defaultValue)
Returns an ASN.1 Object Identifier (OID) from the input with tagging. |
|
OID |
readOID(int tagging,
int tag,
OID defaultValue)
Returns an ASN.1 Object Identifier (OID) from the input with tagging. |
|
String |
readPrintableString()
Reads a PRINTABLE string in from the ASN1 input stream. |
|
String |
readPrintableString(int tagging,
int tag)
Reads a PRINTABLE string in from the ASN1 input stream with tagging. |
|
String |
readPrintableString(int tagging,
int tag,
int clsFlags)
Reads a PRINTABLE string in from the ASN1 input stream with tagging. |
|
String |
readPrintableString(int tagging,
int tag,
int clsFlags,
String defaultValue)
Reads a PRINTABLE string in from the ASN1 input stream with tagging. |
|
String |
readPrintableString(int tagging,
int tag,
String defaultValue)
Reads a PRINTABLE string in from the ASN1 input stream with tagging. |
|
ASN1InputStream |
readSequence()
Reads a sequence in from the ASN1 input stream. |
|
ASN1InputStream |
readSequence(int tagging,
int tag)
Reads a sequence in from the ASN1 input stream with tagging. |
|
ASN1InputStream |
readSequence(int tagging,
int tag,
int clsFlags)
Reads a sequence in from the ASN1 input stream with tagging. |
|
ASN1InputStream |
readSet()
Reads a set in from the ASN1 input stream. |
|
ASN1InputStream |
readSet(int tagging,
int tag)
Reads a set in from the ASN1 input stream with tagging. |
|
ASN1InputStream |
readSet(int tagging,
int tag,
int clsFlags)
Reads a set in from the ASN1 input stream with tagging. |
|
InputStream |
readStreamWithTag(int tag)
Reads a stream from the ASN1 input stream with tagging. |
|
String |
readT61String()
Reads a T61 string in from the ASN1 input stream. |
|
String |
readT61String(int tagging,
int tag)
Reads a T61 string in from the ASN1 input stream with tagging. |
|
String |
readT61String(int tagging,
int tag,
int clsFlags)
Reads a T61 string in from the ASN1 input stream with tagging. |
|
String |
readT61String(int tagging,
int tag,
int clsFlags,
String defaultValue)
Reads a T61 string in from the ASN1 input stream with tagging. |
|
String |
readT61String(int tagging,
int tag,
String defaultValue)
Reads a T61 string in from the ASN1 input stream with tagging. |
|
long |
readUTCTime()
Returns an ASN.1 explicit time object from the input. |
|
long |
readUTCTime(int tagging,
int tag)
Returns an ASN.1 explicit time object from the input. |
|
long |
readUTCTime(int tagging,
int tag,
int clsFlags)
Returns an ASN.1 explicit time object from the input. |
|
long |
readUTCTime(int tagging,
int tag,
int clsFlags,
long defaultValue)
Returns an ASN.1 explicit time object from the input. |
|
long |
readUTCTime(int tagging,
int tag,
long defaultValue)
Returns an ASN.1 explicit time object from the input. |
|
String |
readUTF8String()
Reads a UTF8 string in from the ASN1 input stream. |
|
String |
readUTF8String(int tagging,
int tag)
Reads a UTF8 string in from the ASN1 input stream with tagging. |
|
String |
readUTF8String(int tagging,
int tag,
int clsFlags)
Reads a UTF8 string in from the ASN1 input stream with tagging. |
|
String |
readUTF8String(int tagging,
int tag,
int clsFlags,
String defaultValue)
Reads a UTF8 string in from the ASN1 input stream with tagging. |
|
String |
readUTF8String(int tagging,
int tag,
String defaultValue)
Reads a UTF8 string in from the ASN1 input stream with tagging. |
|
void |
skipField()
Skips the current field. |
|
void |
skipField(int tag)
Skips the current field. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ASN1InputStream(InputStream inputStream)
ASN1InputStream object which reads bytes from
inputStream.
inputStream - The input stream containing the ASN1 data
(must not be null).public ASN1InputStream(byte[] data)
ASN1InputStream object based upon the data in the
given byte array.
data - The byte array containing the ASN1 data.
public ASN1InputStream(byte[] data,
int offset,
int length)
ASN1InputStream based upon the data in the
given byte array.
data - The byte array containing the ASN1 data.offset - The starting offset of the ASN1 data within the array.length - The length of the ASN1 data.| Method Detail |
public boolean isNextTagUniversal()
throws EOFException,
IOException
Universal means that the assigned tag is recognized outside the scope of the current construction.
EOFException - Thrown when the end of the stream is reached.IOException - Thrown in the case of an I/O error.
public boolean isNextTagApplicationSpecific()
throws EOFException,
IOException
Application-specific means that the assigned tag is specific to the scope of the current application.
EOFException - Thrown when the end of the stream is reached.IOException - Thrown in the case of an I/O error.
public boolean isNextTagContextSpecific()
throws EOFException,
IOException
Context-specific means that the assigned tag is specific to the constructed type you find it in.
EOFException - Thrown when the end of the stream is reached.IOException - Thrown in the case of an I/O error.
public boolean isNextTagPrivate()
throws EOFException,
IOException
EOFException - Thrown when the end of the stream is reached.IOException - Thrown in the case of an I/O error.
public int peekNextTag()
throws EOFException,
IOException
This call can be used for ASN.1 CHOICE or ANY types.
EOFException - Thrown when the end of the stream is reached.IOException - Thrown in the case of an I/O error.
public boolean readBoolean()
throws ASN1EncodingException,
EOFException,
IOException
ASN1EncodingException - Thrown if the boolean could not be found or was
incorrectly formatted.EOFException - Thrown if the end of the stream was reached.IOException - Thrown if an I/O error was encountered.
public boolean readBoolean(int tagging,
int tag)
throws ASN1EncodingException,
EOFException,
IOException
tagging - The type of tagging to use (TAG_NONE, TAG_IMPLICIT, TAG_EXPLICIT).tag - The tag value to look for (ignored if tagging is TAG_NONE).ASN1EncodingException - Thrown if the boolean was incorrectly formatted.EOFException - Thrown if the end of the stream was reached.IOException - Thrown if an I/O error was encountered.
public boolean readBoolean(int tagging,
int tag,
boolean defaultValue)
throws ASN1EncodingException,
EOFException,
IOException
tagging - The type of tagging to use (TAG_NONE, TAG_IMPLICIT, TAG_EXPLICIT).tag - The tag value to look for (ignored if tagging is TAG_NONE).defaultValue - The value to return if the tag cannot be found.ASN1EncodingException - Thrown if the boolean was incorrectly formatted.EOFException - Thrown if the end of the stream was reached.IOException - Thrown if an I/O error was encountered.
public boolean readBoolean(int tagging,
int tag,
int clsFlags)
throws ASN1EncodingException,
EOFException,
IOException
tagging - The type of tagging to use (TAG_NONE, TAG_IMPLICIT, TAG_EXPLICIT).tag - The tag value to look for (ignored if tagging is TAG_NONE).clsFlags - The class flag to check for ( either DERTags.UNIVERSAL_CLASS_FLAG,
DERTags.APPLICATION_SPECIFIC_CLASS_FLAG, DERTags.CONTEXT_SPECIFIC_CLASS_FLAG or DERTags.PRIVATE_CLASS_FLAG )ASN1EncodingException - Thrown if the boolean was incorrectly formatted.EOFException - Thrown if the end of the stream was reached.IOException - Thrown if an I/O error was encountered.
public boolean readBoolean(int tagging,
int tag,
int clsFlags,
boolean defaultValue)
throws ASN1EncodingException,
EOFException,
IOException
tagging - The type of tagging to use (TAG_NONE, TAG_IMPLICIT, TAG_EXPLICIT).tag - The tag value to look for (ignored if tagging is TAG_NONE).clsFlags - The class flag to check for ( either DERTags.UNIVERSAL_CLASS_FLAG,
DERTags.APPLICATION_SPECIFIC_CLASS_FLAG, DERTags.CONTEXT_SPECIFIC_CLASS_FLAG or DERTags.PRIVATE_CLASS_FLAG )defaultValue - The value to return if the tag cannot be found.ASN1EncodingException - Thrown if the boolean was incorrectly formatted.EOFException - Thrown if the end of the stream was reached.IOException - Thrown if an I/O error was encountered.
public boolean readNull()
throws ASN1EncodingException,
EOFException,
IOException
ASN1EncodingException - Thrown if the null could not be found or was
incorrectly formatted.EOFException - Thrown if the end of the stream was reached.IOException - Thrown if an I/O error was encountered.
public boolean readNull(int tagging,
int tag)
throws ASN1EncodingException,
EOFException,
IOException
tagging - The type of tagging to use (TAG_NONE, TAG_IMPLICIT, TAG_EXPLICIT).tag - The tag value to look for (ignored if tagging is TAG_NONE).ASN1EncodingException - Thrown if the null was incorrectly formatted.EOFException - Thrown if the end of the stream was reached.IOException - Thrown if an I/O error was encountered.
public boolean readNull(int tagging,
int tag,
boolean defaultValue)
throws ASN1EncodingException,
EOFException,
IOException
tagging - The type of tagging to use (TAG_NONE, TAG_IMPLICIT, TAG_EXPLICIT).tag - The tag value to look for (ignored if tagging is TAG_NONE).defaultValue - The value to return if the tag cannot be found.ASN1EncodingException - Thrown if the null was incorrectly formatted.EOFException - Thrown if the end of the stream was reached.IOException - Thrown if an I/O error was encountered.
public boolean readNull(int tagging,
int tag,
int clsFlags)
throws ASN1EncodingException,
EOFException,
IOException
tagging - The type of tagging to use (TAG_NONE, TAG_IMPLICIT, TAG_EXPLICIT).tag - The tag value to look for (ignored if tagging is TAG_NONE).clsFlags - The class flag to check for ( either DERTags.UNIVERSAL_CLASS_FLAG,
DERTags.APPLICATION_SPECIFIC_CLASS_FLAG, DERTags.CONTEXT_SPECIFIC_CLASS_FLAG or DERTags.PRIVATE_CLASS_FLAG )ASN1EncodingException - Thrown if the null was incorrectly formatted.EOFException - Thrown if the end of the stream was reached.IOException - Thrown if an I/O error was encountered.
public boolean readNull(int tagging,
int tag,
int clsFlags,
boolean defaultValue)
throws ASN1EncodingException,
EOFException,
IOException
tagging - The type of tagging to use (TAG_NONE, TAG_IMPLICIT, TAG_EXPLICIT).tag - The tag value to look for (ignored if tagging is TAG_NONE).clsFlags - The class flag to check for ( either DERTags.UNIVERSAL_CLASS_FLAG,
DERTags.APPLICATION_SPECIFIC_CLASS_FLAG, DERTags.CONTEXT_SPECIFIC_CLASS_FLAG or DERTags.PRIVATE_CLASS_FLAG )defaultValue - The value to return if the tag cannot be found.ASN1EncodingException - Thrown if the null was incorrectly formatted.EOFException - Thrown if the end of the stream was reached.IOException - Thrown if an I/O error was encountered.
public int readInteger()
throws ASN1EncodingException,
EOFException,
IOException
ASN1EncodingException - Thrown if the boolean was incorrectly formatted.EOFException - Thrown if the end of the stream was reached.IOException - Thrown if an I/O error was encountered.
public int readInteger(int tagging,
int tag)
throws ASN1EncodingException,
EOFException,
IOException
tagging - The type of tagging to use (TAG_NONE, TAG_IMPLICIT, TAG_EXPLICIT).tag - The tag value to look for (ignored if tagging is TAG_NONE).ASN1EncodingException - Thrown if the boolean was incorrectly formatted.EOFException - Thrown if the end of the stream was reached.IOException - Thrown if an I/O error was encountered.
public int readInteger(int tagging,
int tag,
int defaultValue)
throws ASN1EncodingException,
EOFException,
IOException
tagging - The type of tagging to use (TAG_NONE, TAG_IMPLICIT, TAG_EXPLICIT).tag - The tag value to look for (ignored if tagging is TAG_NONE).defaultValue - The value to return if the tag cannot be found.ASN1EncodingException - Thrown if the boolean was incorrectly formatted.EOFException - Thrown if the end of the stream was reached.IOException - Thrown if an I/O error was encountered.
public int readInteger(int tagging,
int tag,
int clsFlags,
int defaultValue)
throws ASN1EncodingException,
EOFException,
IOException
tagging - The type of tagging to use (TAG_NONE, TAG_IMPLICIT, TAG_EXPLICIT).tag - The tag value to look for (ignored if tagging is TAG_NONE).clsFlags - The class flag to check for ( either DERTags.UNIVERSAL_CLASS_FLAG,
DERTags.APPLICATION_SPECIFIC_CLASS_FLAG, DERTags.CONTEXT_SPECIFIC_CLASS_FLAG or DERTags.PRIVATE_CLASS_FLAG )defaultValue - The value to return if the tag cannot be found.ASN1EncodingException - Thrown if the boolean was incorrectly formatted.EOFException - Thrown if the end of the stream was reached.IOException - Thrown if an I/O error was encountered.
public int readEnumerated()
throws ASN1EncodingException,
EOFException,
IOException
ASN1EncodingException - Thrown if the value was incorrectly formatted.EOFException - Thrown if the end of the stream was reached.IOException - Thrown if an I/O error was encountered.
public int readEnumerated(int tagging,
int tag)
throws ASN1EncodingException,
EOFException,
IOException
tagging - The type of tagging to use (TAG_NONE, TAG_IMPLICIT, TAG_EXPLICIT).tag - The tag value to look for (ignored if tagging is TAG_NONE).ASN1EncodingException - Thrown if the value was incorrectly formatted.EOFException - Thrown f the end of the stream was reached.IOException - Thrown if an I/O error was encountered.
public int readEnumerated(int tagging,
int tag,
int defaultValue)
throws ASN1EncodingException,
EOFException,
IOException
tagging - The type of tagging to use (TAG_NONE, TAG_IMPLICIT, TAG_EXPLICIT).tag - The tag value to look for (ignored if tagging is TAG_NONE).defaultValue - The value to return if the tag cannot be found.ASN1EncodingException - Thrown if the value was incorrectly formatted.EOFException - Thrown if the end of the stream was reached.IOException - Thrown if an I/O error was encountered.
public int readEnumerated(int tagging,
int tag,
int clsFlags,
int defaultValue)
throws ASN1EncodingException,
EOFException,
IOException
tagging - The type of tagging to use (TAG_NONE, TAG_IMPLICIT, TAG_EXPLICIT).tag - The tag value to look for (ignored if tagging is TAG_NONE).clsFlags - The class flag to check for ( either DERTags.UNIVERSAL_CLASS_FLAG,
DERTags.APPLICATION_SPECIFIC_CLASS_FLAG, DERTags.CONTEXT_SPECIFIC_CLASS_FLAG or DERTags.PRIVATE_CLASS_FLAG )defaultValue - The value to return if the tag cannot be found.ASN1EncodingException - Thrown if the value was incorrectly formatted.EOFException - Thrown if the end of the stream was reached.IOException - Thrown if an I/O error was encountered.
public byte[] readIntegerAsByteArray()
throws ASN1EncodingException,
EOFException,
IOException
Note that if the integer read was negative, it is up to the caller to interpret it as such. We cannot do that interpretation for the user since we are just returning a byte array which has no sign associated with it.
ASN1EncodingException - Thrown if the boolean could not be found or was
incorrectly formatted.EOFException - Thrown if the end of the stream was reached.IOException - Thrown if an I/O error was encountered.
public byte[] readIntegerAsByteArray(int tagging,
int tag)
throws ASN1EncodingException,
EOFException,
IOException
Note that if the integer read was negative, it is up to the caller to interpret it as such. We cannot do that interpretation for the user since we are just returning a byte array which has no sign associated with it.
tagging - The type of tagging to use (TAG_NONE, TAG_IMPLICIT, TAG_EXPLICIT).tag - The tag value to look for (ignored if tagging is TAG_NONE).ASN1EncodingException - Thrown if the boolean was incorrectly formatted.EOFException - Thrown if the end of the stream was reached.IOException - Thrown if an I/O error was encountered.
public byte[] readIntegerAsByteArray(int tagging,
int tag,
byte[] defaultValue)
throws ASN1EncodingException,
EOFException,
IOException
Note that if the integer read was negative, it is up to the caller to interpret it as such. We cannot do that interpretation for the user since we are just returning a byte array which has no sign associated with it.
tagging - The type of tagging to use (TAG_NONE, TAG_IMPLICIT, TAG_EXPLICIT).tag - The tag value to look for (ignored if tagging is TAG_NONE).defaultValue - The value to return if the tag cannot be found.ASN1EncodingException - Thrown if the boolean was incorrectly formatted.EOFException - Thrown if the end of the stream was reached.