xmlns:atom="http://www.w3.org/2005/Atom" xmlns:atom="http://www.w3.org/2005/Atom"

Please note that the date you requested in the address for this web page is not an actual date upon which a change occurred to this item of legislation. You are being shown the legislation from , which is the first date before then upon which a change was made.

ANNEX I CU.K. Requirements for construction, testing, installation, and inspection

Appendix 11

COMMON SECURITY MECHANISMS U.K.

PART BU.K. SECOND-GENERATION TACHOGRAPH SYSTEM
10.VU- CARD MUTUAL AUTHENTICATION AND SECURE MESSAGINGU.K.
10.5. Secure Messaging U.K.
10.5.1 General U.K.
CSM_181All commands and responses exchanged between a vehicle unit and a tachograph card after successful Chip Authentication took place and until the end of the session shall be protected by Secure Messaging.U.K.
CSM_182Except when reading from a file with access condition SM-R-ENC-MAC-G2 (see Appendix 2, section 4), Secure Messaging shall be used in authentication-only mode. In this mode, a cryptographic checksum (a.k.a. MAC) is added to all commands and responses to ensure message authenticity and integrity.U.K.
CSM_183When reading data from a file with access condition SM-R-ENC-MAC-G2, Secure Messaging shall be used in encrypt-then-authenticate mode, i.e. the response data is encrypted first to ensure message confidentiality, and afterwards a MAC over the formatted encrypted data is calculated to ensure authenticity and integrity.U.K.
CSM_184Secure Messaging shall use AES as defined in [AES] with the session keys KMAC and KENC that were agreed during Chip Authentication.U.K.
CSM_185An unsigned integer shall be used as the Send Sequence Counter (SSC) to prevent replay attacks. The size of the SSC shall be equal to the AES block size, i.e. 128 bits. The SSC shall be in MSB-first format. The Send Sequence Counter shall be initialized to zero (i.e. ‘00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00’) when Secure Messaging is started. The SSC shall be increased every time before a command or response APDU is generated, i.e. since the starting value of the SSC in a SM session is 0, in the first command the value of the SSC will be 1. The value of SSC for the first response will be 2.U.K.
CSM_186For message encryption, KENC shall be used with AES in the Cipher Block Chaining (CBC) mode of operation, as defined in [ISO 10116], with an interleave parameter m = 1 and an initialization vector SV = E(KENC, SSC), i.e. the current value of the Send Sequence Counter encrypted with KENC.U.K.
CSM_187For message authentication, KMAC shall be used with AES in CMAC mode as specified in [SP 800-38B]. The length of the MAC shall be linked to the length of the AES session keys, as specified in CSM_50. The Send Sequence Counter shall be included in the MAC by prepending it before the datagram to be authenticated.U.K.
10.5.2 Secure Message Structure U.K.
CSM_188Secure Messaging shall make use only of the Secure Messaging data objects (see [ISO 7816-4]) listed in Table 5. In any message, these data objects shall be used in the order specified in this table.U.K.
Table 5
Secure Messaging Data Objects
Data Object NameTagPresence (M)andatory, (C)onditional or (F)orbidden in
CommandsResponses
Plain value not encoded in BER-TLV‘81’CC
Plain value encoded in BER-TLV, but not including SM DOs‘B3’CC
Padding-content indicator followed by cryptogram, plain value not encoded in BER-TLV‘87’CC
Protected Le‘97’CF
Processing Status‘99’FM
Cryptographic Checksum‘8E’MM

Note: As specified in Appendix 2, tachograph cards may support the READ BINARY and UPDATE BINARY command with an odd INS byte (‘B1’ resp. ‘D7’). These command variants are required to read and update files with more than 32 768 bytes or more. In case such a variant is used, a data object with tag ‘B3’ shall be used instead of an object with tag ‘81’. See Appendix 2 for more information.U.K.

CSM_189All SM data objects shall be encoded in DER TLV as specified in [ISO 8825-1]. This encoding results in a Tag-Length-Value (TLV) structure as follows:U.K.
Tag

:

The tag is encoded in one or two octets and indicates the content.

Length

:

The length is encoded as an unsigned integer in one, two, or three octets, resulting in a maximum length of 65 535 octets. The minimum number of octets shall be used.

Value

:

The value is encoded in zero or more octets

CSM_190APDUs protected by Secure Messaging shall be created as follows:U.K.
[F1CSM_191 Any data object to be encrypted shall be padded according to [ISO 7816-4] using padding-content indicator 01. For the calculation of the MAC, data objects in the APDU shall be padded according to [ISO 7816-4]. U.K.

Note: Padding for Secure Messaging is always performed by the secure messaging layer, not by the CMAC or CBC algorithms. U.K.

Summary and Examples U.K.

A command APDU with applied Secure Messaging will have the following structure, depending on the case of the respective unsecured command (DO is data object):

Case 1

:

CLA INS P1 P2 || Lc' || DO 8E || Le

Case 2

:

CLA INS P1 P2 || Lc' || DO 97 || DO 8E || Le

Case 3 (even INS byte)

:

CLA INS P1 P2 || Lc' || DO 81 || DO 8E || Le

Case 3 (odd INS byte)

:

CLA INS P1 P2 || Lc' || DO B3 || DO 8E || Le

Case 4 (even INS byte)

:

CLA INS P1 P2 || Lc' || DO 81 || DO 97 || DO 8E || Le

Case 4 (odd INS byte)

:

CLA INS P1 P2 || Lc' || DO B3 || DO 97 || DO 8E || Le

where Le = 00’ or ‘00 00 depending on whether short length fields or extended length fields are used; see [ISO 7816-4].

A response APDU with applied Secure Messaging will have the following structure, depending on the case of the respective unsecured response:

Case 1 or 3

:

DO 99 || DO 8E || SW1SW2

Case 2 or 4 (even INS byte) without encryption

:

DO 81 || DO 99 || DO 8E || SW1SW2

Case 2 or 4 (even INS byte) with encryption

:

DO 87 || DO 99 || DO 8E || SW1SW2

Case 2 or 4 (odd INS byte) without encryption

:

DO B3 || DO 99 || DO 8E || SW1SW2

Note: Case 2 or 4 (odd INS byte) with encryption is never used in the communication between a VU and a card. U.K.

Below are three example APDU transformations for commands with even INS code. Figure 8 shows an authenticated Case 4 command APDU, Figure 9 shows an authenticated Case 1/Case 3 response APDU, and Figure 10 shows an encrypted and authenticated Case 2/Case 4 response APDU.

Figure 8

Transformation of an authenticated Case 4 Command APDU

Figure 9

Transformation of an authenticated Case 1 / Case 3 Response APDU

Figure 10 Transformation of an encrypted and authenticated Case 2/Case 4 Response APDU U.K.

]

10.5.3 Secure Messaging Session Abortion U.K.
CSM_192A vehicle unit shall abort an ongoing Secure Messaging session if and only if one of the following conditions occur:U.K.
[F1CSM_193 A tachograph card shall abort an ongoing Secure Messaging session if and only if one of the following conditions occur: U.K.
CSM_194Regarding SM error handling by a tachograph card:U.K.

In such a case, the status bytes shall be returned without using SM.

CSM_195If a Secure Messaging session between a VU and a tachograph card is aborted, the VU and the tachograph card shallU.K.
CSM_196If for any reason the VU decides to restart mutual authentication towards an inserted card, the process shall restart with verification of the card certificate chain, as described in section 10.2, and shall continue as described in sections 10.2 — 10.5.U.K.