Package com.yubico.yubikit.core.util
Class Tlv
java.lang.Object
com.yubico.yubikit.core.util.Tlv
Tag, length, Value structure that helps to parse APDU response data.
This class handles BER-TLV encoded data with determinate length.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]getBytes()Returns the Tlv as a BER-TLV encoded byte array.intReturns the length of the value.intgetTag()Returns the tag.byte[]getValue()returns the value.static Tlvparse(byte[] data) Parse a Tlv from a BER-TLV encoded byte array.static Tlvparse(byte[] data, int offset, int length) Parse a Tlv from a BER-TLV encoded byte array.toString()
-
Constructor Details
-
Tlv
public Tlv(int tag, @Nullable byte[] value) Creates a new Tlv given a tag and a value.
-
-
Method Details
-
getTag
public int getTag()Returns the tag. -
getValue
public byte[] getValue()returns the value. -
getLength
public int getLength()Returns the length of the value. -
getBytes
public byte[] getBytes()Returns the Tlv as a BER-TLV encoded byte array. -
toString
-
parse
Parse a Tlv from a BER-TLV encoded byte array.- Parameters:
data- a byte array containing the TLV encoded data.offset- the offset in data where the TLV data begins.length- the length of the TLV encoded data.- Returns:
- The parsed Tlv
-
parse
Parse a Tlv from a BER-TLV encoded byte array.- Parameters:
data- a byte array containing the TLV encoded data (and nothing more).- Returns:
- The parsed Tlv
-