Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specific and major difference between Simple TLV and BER TLV

Tags:

iso

I want to know the specific difference between simple TLV and BER TLV

Why the BER TLV 5F05 05 48656C6C6F is Invalid as in BER TLV the tag can have one or more consecutive bytes???

Please give some examples also ..

like image 396
Bhanu Avatar asked Oct 02 '22 18:10

Bhanu


2 Answers

The BER means bearer which allows the carriying of other TLV's within

BER-TLV data object contains (TL (TLV) (TLV) with a tag field followed by a length field encoding a number. The template, consists of one or more BER-TLV data objects, each one consisting of a tag field, a length field encoding a number and if the number is not zero, a value field.

In case its not clear feel free to contact me.

Regards Anup

like image 78
Anup Sharma Avatar answered Oct 06 '22 20:10

Anup Sharma


I would like to add one more thing which is related to my question -

Why the BER TLV 5F05 05 48656C6C6F is Invalid as in BER TLV the tag can have one or more consecutive bytes???

Answer is -

As in BER TLV the Tag field can be structured in following manner : (ISO/IEC 7816 supports length fields of one, two, … up to five bytes)

In case when length of tag is 1 byte then the valid values can be - "00" to "7F"

In case when length of tag is 2 bytes then the valid values can be - "81" (for 1st byte) and "00" to "FF" (for 2nd byte)

In case when length of tag is 3 bytes then the valid values can be - "82" (for 1st byte) and "0000" to "FFFF" (for 2nd + 3rd bytes)

In case when length of tag is 4 bytes then the valid values can be - "83" (for 1st byte) and "000000" to "FFFFFF" (for 2nd + 3rd + 4th bytes)

In case when length of tag is 5 bytes then the valid values can be - "84" (for 1st byte) and "00000000" to "FFFFFFFF" (for 2nd + 3rd + 4th + 5th bytes)

So, in BER TLV 5F05 05 48656C6C6F -> The tag is of 2 bytes length (5F05) which is wrong because if the tag is of 2 bytes length then its first byte must be "81" and 2nd byte can be any in range "00" to "FF.

Feel free to ask in case of confusion.

like image 30
Bhanu Avatar answered Oct 06 '22 18:10

Bhanu