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.