
public class DERDecoder extends Object implements ASN1Decoder
| Constructor and Description |
|---|
DERDecoder(byte[] buf)
Create a DER decoder that will decode values from the given byte array.
|
DERDecoder(byte[] buf,
int offset,
int length)
Create a DER decoder that will decode values from the given byte array.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
decodeBitString()
Decode the next ASN.1 element as a bit string.
|
BigInteger |
decodeBitStringAsInteger()
Decode the next ASN.1 element as a bit string where the value is a ASN.1 INTEGER.
|
String |
decodeBitStringAsString()
Decode the next ASN.1 element as a bit string.
|
String |
decodeBMPString()
Decode the next ASN.1 element as an BMPString.
|
byte[] |
decodeBMPStringAsBytes()
Decode the next ASN.1 element as an BMPString.
|
boolean |
decodeBoolean()
Decode the next ASN.1 element as a boolean value.
|
String |
decodeIA5String()
Decode the next ASN.1 element as an IA5 string.
|
byte[] |
decodeIA5StringAsBytes()
Decode the next ASN.1 element as an IA5 string.
|
void |
decodeImplicit(int number)
Indicate that the next ASN.1 element has the given implicit, context-specific tag.
|
void |
decodeImplicit(int clazz,
int number)
Indicate that the next ASN.1 element has the given implicit tag.
|
BigInteger |
decodeInteger()
Decode the next ASN.1 element as an integer.
|
void |
decodeNull()
Decode the next ASN.1 element as a null element.
|
String |
decodeObjectIdentifier()
Decode the next ASN.1 element as an object identifier.
|
String |
decodeObjectIdentifierAsKeyAlgorithm()
Decodes an OID and resolve its corresponding key algorithm.
|
byte[] |
decodeOctetString()
Decode the next ASN.1 element as an octet string.
|
String |
decodeOctetStringAsString()
Decode the next ASN.1 element as an octet string.
|
String |
decodeOctetStringAsString(String charSet)
Decode the next ASN.1 element as an octet string.
|
String |
decodePrintableString()
Decode the next ASN.1 element as a PrintableString.
|
byte[] |
decodePrintableStringAsBytes()
Decode the next ASN.1 element as a PrintableString.
|
String |
decodeUniversalString()
Decode the next ASN.1 element as an UniversalString.
|
byte[] |
decodeUniversalStringAsBytes()
Decode the next ASN.1 element as an UniversalString.
|
String |
decodeUtf8String()
Decode the next ASN.1 element as an UTF8String.
|
byte[] |
decodeUtf8StringAsBytes()
Decode the next ASN.1 element as an UTF8String.
|
byte[] |
drain()
Drain all of the remaining bytes from the input stream.
|
byte[] |
drainElement()
Drain all of the bytes from the next ASN.1 element.
|
byte[] |
drainElementValue()
Drain the value bytes from the next ASN.1 element.
|
void |
endExplicit()
Advance to the end of an explicitly tagged element.
|
void |
endSequence()
Advance to the end of a sequence.
|
void |
endSet()
Advance to the end of a set.
|
void |
endSetOf()
Advance to the end of a "set of" element.
|
boolean |
hasNextElement()
Determine if there is at least one more ASN.1 element that can be read.
|
boolean |
isNextType(int clazz,
int number,
boolean isConstructed)
Determine if the type of the next ASN.1 element matches the given type without
actually decoding the next element.
|
int |
peekType()
Retrieve the type of the next ASN.1 element without actually decoding
the next element.
|
void |
skipElement()
Skip over the next ASN.1 element.
|
void |
startExplicit(int number)
Start decoding an ASN.1 explicitly tagged element.
|
void |
startExplicit(int clazz,
int number)
Start decoding an ASN.1 explicitly tagged element.
|
void |
startSequence()
Start decoding an ASN.1 sequence.
|
void |
startSet()
Start decoding an ASN.1 set.
|
void |
startSetOf()
Start decoding an ASN.1 "set of" element.
|
public DERDecoder(byte[] buf)
buf - the byte array to decodepublic DERDecoder(byte[] buf,
int offset,
int length)
buf - the byte array to decodeoffset - the offset in the byte array of the first byte to readlength - the maximum number of bytes to read from the byte arraypublic void startSequence()
throws ASN1Exception
ASN1DecoderASN1Decoder.endSequence() is called.startSequence in interface ASN1DecoderASN1Exception - if the next element is not a sequencepublic void endSequence()
throws ASN1Exception
ASN1DecoderendSequence in interface ASN1DecoderASN1Exception - if an error occurs while advancing to the end of the sequencepublic void startSet()
throws ASN1Exception
ASN1DecoderASN1Decoder.endSet() is called.startSet in interface ASN1DecoderASN1Exception - if the next element is not a setpublic void endSet()
throws ASN1Exception
ASN1DecoderendSet in interface ASN1DecoderASN1Exception - if an error occurs while advancing to the end of the setpublic void startSetOf()
throws ASN1Exception
ASN1DecoderASN1Decoder.endSetOf() is called.startSetOf in interface ASN1DecoderASN1Exception - if the next element is not a setpublic void endSetOf()
throws ASN1Exception
ASN1DecoderendSetOf in interface ASN1DecoderASN1Exception - if an error occurs while advancing to the end of the setpublic void startExplicit(int number)
throws ASN1Exception
ASN1DecoderASN1Decoder.endExplicit()
is called.startExplicit in interface ASN1Decodernumber - the tag number for the explicit, context-specific tagASN1Exception - if the next element's type does not match the given typepublic void startExplicit(int clazz,
int number)
throws ASN1Exception
ASN1DecoderASN1Decoder.endExplicit()
is called.startExplicit in interface ASN1Decoderclazz - the class for the explicit tagnumber - the tag number for the explicit tagASN1Exception - if the next element's type does not match the given typepublic void endExplicit()
throws ASN1Exception
ASN1DecoderendExplicit in interface ASN1DecoderASN1Exception - if an error occurs while advancing to the end of the explicitly
tagged elementpublic byte[] decodeOctetString()
throws ASN1Exception
ASN1DecoderdecodeOctetString in interface ASN1DecoderASN1Exception - if the next element is not an octet stringpublic String decodeOctetStringAsString() throws ASN1Exception
ASN1DecoderdecodeOctetStringAsString in interface ASN1DecoderASN1Exception - if the next element is not an octet stringpublic String decodeOctetStringAsString(String charSet) throws ASN1Exception
ASN1DecoderdecodeOctetStringAsString in interface ASN1DecodercharSet - the character set to use when decodingASN1Exception - if the next element is not an octet stringpublic String decodeIA5String() throws ASN1Exception
ASN1DecoderdecodeIA5String in interface ASN1DecoderASN1Exception - if the next element is not an IA5 stringpublic byte[] decodeIA5StringAsBytes()
throws ASN1Exception
ASN1DecoderdecodeIA5StringAsBytes in interface ASN1DecoderASN1Exception - if the next element is not an IA5 stringpublic byte[] decodeBitString()
throws ASN1Exception
ASN1DecoderdecodeBitString in interface ASN1DecoderASN1Exception - if the next element is not a bit stringpublic BigInteger decodeBitStringAsInteger()
ASN1DecoderdecodeBitStringAsInteger in interface ASN1DecoderBigInteger decoded from the bit stringpublic String decodeBitStringAsString() throws ASN1Exception
ASN1DecoderdecodeBitStringAsString in interface ASN1DecoderASN1Exception - if the next element is not a bit stringpublic String decodePrintableString() throws ASN1Exception
ASN1DecoderdecodePrintableString in interface ASN1DecoderASN1Exception - if the next element is not a PrintableStringpublic byte[] decodePrintableStringAsBytes()
throws ASN1Exception
ASN1DecoderdecodePrintableStringAsBytes in interface ASN1DecoderASN1Exception - if the next element is not a PrintableStringpublic String decodeUniversalString() throws ASN1Exception
ASN1DecoderdecodeUniversalString in interface ASN1DecoderASN1Exception - if the next element is not a UniversalStringpublic byte[] decodeUniversalStringAsBytes()
throws ASN1Exception
ASN1DecoderdecodeUniversalStringAsBytes in interface ASN1DecoderASN1Exception - if the next element is not a UniversalStringpublic String decodeUtf8String() throws ASN1Exception
ASN1DecoderdecodeUtf8String in interface ASN1DecoderASN1Exception - if the next element is not a UTF8Stringpublic byte[] decodeUtf8StringAsBytes()
throws ASN1Exception
ASN1DecoderdecodeUtf8StringAsBytes in interface ASN1DecoderASN1Exception - if the next element is not a UTF8Stringpublic String decodeBMPString() throws ASN1Exception
ASN1DecoderdecodeBMPString in interface ASN1DecoderASN1Exception - if the next element is not a BMPStringpublic byte[] decodeBMPStringAsBytes()
throws ASN1Exception
ASN1DecoderdecodeBMPStringAsBytes in interface ASN1DecoderASN1Exception - if the next element is not a BMPStringpublic String decodeObjectIdentifier() throws ASN1Exception
ASN1DecoderdecodeObjectIdentifier in interface ASN1DecoderASN1Exception - if the next element is not a bit stringpublic BigInteger decodeInteger() throws ASN1Exception
ASN1DecoderdecodeInteger in interface ASN1DecoderASN1Exception - if the next element is not an integerpublic void decodeNull()
throws ASN1Exception
ASN1DecoderdecodeNull in interface ASN1DecoderASN1Exception - if the next element is not nullpublic void decodeImplicit(int number)
ASN1DecoderdecodeImplicit in interface ASN1Decodernumber - the tag number for the implicit tagpublic void decodeImplicit(int clazz,
int number)
ASN1DecoderdecodeImplicit in interface ASN1Decoderclazz - the class for the implicit tagnumber - the tag number for the implicit tagpublic boolean decodeBoolean()
throws ASN1Exception
ASN1DecoderdecodeBoolean in interface ASN1DecoderASN1Exception - if the next element is not a boolean valuepublic boolean isNextType(int clazz,
int number,
boolean isConstructed)
ASN1DecoderisNextType in interface ASN1Decoderclazz - the tag class to match againstnumber - the tag number to match againstisConstructed - whether or not the next element should be constructedtrue if the type of the next ASN.1 element matches the given type
and false otherwisepublic int peekType()
throws ASN1Exception
ASN1DecoderpeekType in interface ASN1DecoderASN1Exception - if an error occurs while determining the type of the next elementpublic void skipElement()
throws ASN1Exception
ASN1DecoderskipElement in interface ASN1DecoderASN1Exception - if the next element cannot be skippedpublic boolean hasNextElement()
ASN1DecoderhasNextElement in interface ASN1Decodertrue if there is at least one more ASN.1 element that can be read and false otherwisepublic byte[] drainElementValue()
throws ASN1Exception
ASN1DecoderdrainElementValue in interface ASN1DecoderASN1Exception - if the value bytes from the next ASN.1 element cannot be obtainedpublic byte[] drainElement()
throws ASN1Exception
ASN1DecoderdrainElement in interface ASN1DecoderASN1Exception - if the bytes from the next ASN.1 element cannot be obtainedpublic byte[] drain()
ASN1Decoderdrain in interface ASN1Decoderpublic String decodeObjectIdentifierAsKeyAlgorithm()
Copyright © 2020 JBoss by Red Hat. All rights reserved.