Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Last commit implements builder pattern for
TLVList
. So is possible parse/unpack TLV byte sequences that are not compliant with ISO/IEC 7816-4 BER-TLV rules. e.g: Visa Base1 Datasets (which are fixed 2 bytes long)After that using
tl
is as usual: unpack, append, pack, etc.It is also possible to create
TLVList
with a fixed tag size:and even mixing them together.
e.g: when fixed length size 1 is used then length is encoded i 1 byte (0..255) unlike at ISO/IEC 7816-4 only (0..127)
The changes affected only
TLVList
andTLVMsg
(and corresponding jUnit test). They are never used in jPOS itself.API changes:
TLVMsg()
TLVMsg.setTag(int)
TLVMsg.setValue(byte[] value)
At problems use just TLVList.append(tag, bytes)
TLVList.unpack
to throws only one uncheckedIllegalArgumentException
insteadISOException
and extra undocumentedBufferUnderflowException
TLVMsg(int, byte)
- use TLVList.append(int, byte) instead.Most of these changes were necessary to ensure consistency in the situation of the availability of various types of
TLVList
(which was previously not necessary)In addition 2427a9f introduces verification of created tag identifiers.
So now it is not possible to create an illegal (in ISO/IEC 7816-4 BER-TLV mode)
FF
,00
, '3F', etc. tags. Using them resulted in the creation of an unparsable byte sequence.