| ISO 7816-4: Interindustry
Commands for Interchange Annex D: Use of Basic Encoding Rules ASN.1 |
|
ISO 7816 [part 1] [part 2] [part 3] [part4] [section..1 2 3 4 5 6 7 8 9 annex.. A B C D E F] Annex D: Use of Basic Encoding Rules ASN.1
ISO 7816 Annex D.1: BER-TLV data objectEach BER-TLV data object (see ISO/IEC 8825) shall consist of 2 or 3 consecutive fields :
ISO/IEC 7816 uses neither '00' nor 'FF' as tag value. NOTE - Before, between or after BER-TLV data objects, '00' or 'FF' bytes without any meaning may occur (e.g. due to erased or modified TLV-coded data objects).
ISO 7816-4 Annex D.2: Tag fieldThe bits B8 and B7 of the leading byte of tag field shall encode the tag class, i.e. the class of the data object.
If the bits B5-B1 of the leading byte are not all set to 1, then may they shall encode an integer equal to the tag number which therefore lies in the range from 0 to 30. Then the tag field consists of a single byte. Otherwise (B5-B1 set to 1 in the leading byte), the tag field shall continue on one or more subsequent bytes.
ISO 7816-4 Annex D.3: Length fieldIn short form, the length field consists of a single byte where the bit B8 shall be set to 0 and the bits B7-B1 shall encode an integer equal to the number of bytes in the value field. Any length from 0-127 can thus be encoded by 1 byte. In long form, the length field consists of a leading byte where the bit B8 shall be set to 1 and the B7-B1 shall not be all equal, thus encoding a positive integer equal to the number of subsequent bytes in the length field. Those subsequent bytes shall encode an integer equal to the number of bytes in the value field. Any length within the APDU limit (up to 65535) can thus be encoded by 3 bytes. NOTE - ISO/IEC 7816 does not use the indefinite lengths specified by the basic encoding rules of ASN.1 (see ISO/IEC 8825).
ISO 7816-4 Annex D.4: Value fieldIn this part of ISO/IEC 7816, the value field of some primitive BER-TLV data objects consists of zero, one or more SIMPLE-TLV data objects. The value field of any other primitive BER-TLV data object consists of zero, one or more data elements fixed by the specifications of the data objects. The value field of each constructed BER-TLV data object consists of zero, one or more BER-TLV data objects.
|