6.4 Off-line data authentication


6.4 Off-line data authentication

The processing performed by the terminal in this stage determines whether both the terminal and the card support the off-line data authentication stage. In the affirmative case the terminal chooses what kind of off-line data authentication will be performed (i.e., off-line SDA, off-line DDA, or off-line DDA combined with Application Cryptogram generation).

  • In case off-line SDA is performed, the terminal assesses the authenticity of the data personalized in the card by the issuer.

  • When off-line DDA is performed, the terminal can determine whether the card is genuine or not and whether the data personalized in the card has altered since the personalization.

  • When the off-line DDA is combined with the Application Cryptogram generation, the signature produced by the card can include transaction data, which should be already available in the terminal at this stage. This signature, which can be locally verified by the terminal, can be used as a non- repudiation proof in case the cardholder would later deny the transaction at the point of service. This signature also proves the authenticity of the data personalized in the card and the fact that the card is genuine.

6.4.1 Selection of the off-line authentication mechanism

A terminal that is "on-line only", which has the Terminal Type (tag 9F35) with values of 11h, 21h, 14h, 24h, and 34h (according to Annex A.1 in Book 4 [3]), will skip the off-line data authentication stage. In this case, the EMV ¢ transaction is always directed on-line to the issuer, which performs the card authentication.

A terminal that can process an EMV ¢ transaction off-line will determine whether off-line data authentication is to be performed and what kind of data authentication mechanism will be applied. To this end the terminal will analyze the third byte (security capability) of the Terminal Capabilities (tag 9F33) data object in the terminal and the first byte of the AIP obtained from the card (tag 82). Since only these 2 bytes are considered , the description of the processing refers only to the bit number and the data object (either Terminal Capabilities or AIP), while the byte number is implicit.

Note that the terminal can perform the processing described in the algorithm presented below immediately after the execution of the GET PROCESSING OPTIONS , when the AIP is available.

Choice 1 If the card does not support the off-line data authentication stage (i.e., bit 7, bit 6, and bit 2 are set to 0 in the AIP), the terminal skips the off-line data authentication stage. In this case, bit 8 in byte 1 of the TVR, "Off-line data authentication was not performed", is set to 1. This bit is also set by any terminal that is "on-line only".

Choice 2 The terminal shall perform the combined dynamic data authentication/Application Cryptogram generation if the following conditions are simultaneously fulfilled:

  • The card supports the combined dynamic data authentication/Application Cryptogram generation (AIP, bit 2 = 1);

  • The terminal supports the combined dynamic data authentication/Application Cryptogram generation (Terminal Capabilities, bit 5 = 1)

In case the combined dynamic data authentication/Application Cryptogram generation is chosen , the terminal verifies whether all the data objects required by the terminal for the off-line DDA, as explained in Section 6.4.3, are present. The terminal, however, does not perform the processing related to the off-line DDA itself. The terminal processes the other stages of the EMV ¢ transaction flow, which need to be completed before the terminal action analysis stage can be performed.

Choice 3 The terminal shall perform the off-line DDA if the following conditions are simultaneously fulfilled:

  • The card supports off-line DDA (AIP, bit 6 = 1);

  • The terminal supports the off-line DDA (Terminal Capabilities, bit 7 = 1);

  • Either the card or the terminal (or both) does not support the combined dynamic data authentication/Application Cryptogram generation (i.e., AIP, bit 2 = 0; and/or Terminal Capabilities, bit 5 = 0).

In this case the terminal shall perform the off-line DDA processing as explained in Section 6.4.3.

Choice 4 The terminal shall perform the off-line SDA if the following conditions are simultaneously fulfilled:

  • The card supports off-line SDA (AIP, bit 7 = 1);

  • The terminal supports off-line SDA (Terminal Capabilities, bit 8 = 1);

  • Either the card or the terminal (or both) does not support off-line DDA (AIP, bit 6 = 0; and/or Terminal Capabilities, bit 7 = 0);

  • Either the card or the terminal (or both) does not support combined dynamic data authentication/Application Cryptogram generation (AIP, bit 2 = 0; and/or Terminal Capabilities, bit 5 = 0).

In this case the terminal shall perform the off-line SDA processing as explained in Section 6.4.2.

6.4.2 Off-line SDA

The off-line SDA requires two separate stages (as shown in Figure 6.5):

  1. During the personalization stage of the card, the issuer computes the Signed Static Application Data certificate, according to the algorithm described in Section 5.8.3. Note that using the terminology adopted in Appendix D, Section D.6.2, the Signed Static Application Data certificate corresponds to the static authenticator Static_Auth . This certificate is a signature created with the issuer private key ( N I , d I )on the static data to be authenticated (referred to as the financial_data in Appendix D, Section D.6.2) in the card, which is formed according to Section 5.8.2. The issuer first proves knowledge of the appropriate credentials for obtaining writing rights in the card. Then, the issuer loads into the card the signed static application data, which is stored as the data object with tag 93, together with the certificate of the CA on the issuer public key ( N I , e I ), referred to as the issuer public key certificate.

  2. During the utilization stage, when the off-line SDA is required by the EMV ¢ transaction profile, the card submits to the terminal the data objects it needs to first verify the authenticity of the issuer public key. If the authenticity of this key verifies correctly, the terminal can use it to check the authenticity of the signed static application data. If the verification passes , the terminal agrees on the authenticity of the financial data stored in the card.

click to expand
Figure 6.5: Overview of the off-line SDA.

The processing needed to verify the authenticity of the data in the card is carried out completely by the terminal, while the card only stores those data objects needed for completing this verification.

Stage 1 The terminal verifies the existence of the following objects in the EMV ¢ data objects heap:

  • Certification Authority Public Key Index (tag 8F);

  • Issuer Public Key Certificate (tag 90);

  • Issuer Public Key Remainder (tag 92), which is present only in certain conditions (see Section 5.4);

  • Issuer Public Key Exponent (tag 9F32);

  • Signed Static Application Data (tag 93).

If any of the objects mentioned above are not present in the card (except for tag 92), set up bit 6, "ICC data missing", of byte 1 of the TVR and consider that SDA has failed.

Stage 2 The terminal constructs the Static Data to Be Authenticated byte string. Note that for a multithread terminal this processing can be started since the read application data is performed, in parallel with the AFL processing, as described in Section 5.8.2. To this end, the terminal first considers the records indicated for authentication of all the AEF(s) registered in the AFL. Second, after all the records are read from the card and the EMV ¢ data objects heap is constructed , the terminal considers the data objects indicated in the Static Data Authentication Tag List to be concatenated at the end of the Static Data to Be Authenticated byte string.

If the terminal fails to process any of the records considered for authentication in the AFL, static data authentication has failed.

Stage 3 The terminal verifies the authenticity of the Issuer Public Key Certificate and recovers the issuer public key ( n I , e I ), following the algorithm presented in Section 5.7.1.

The terminal uses the Certification Authority Public Key Index (tag 8F) together with the RID to retrieve the CA public key ( n CA , e CA ) from the appropriate record of the terminal database of CA public keys (see Table 5.2 in Section 5.5). The RID is obtained from the AID (DF Name , tag 84) returned in the FCI of the currently selected ADF, which contains the EMV ¢ debit/credit application. The length of the modulus n CA is N CA .

If the verification of the Issuer Public Key Certificate does not pass, then the SDA has failed.

If the terminal manages a revocation list associated with the CA, which contains all the compromised issuer public key certificates, the terminal checks that the certificate serial number corresponding to the current Issuer Public Key Certificate is not blacklisted in this revocation list. If the certificate is blacklisted then the terminal sets up bit 5, "Card appears on terminal exception file", of byte 1 of the TVR register. In this case also, it is considered that the SDA has failed.

Stage 4 The terminal verifies the authenticity of the data objects personalized in the card by checking the authenticity of the Signed Static Application Data certificate received from the card with the authentic copy of the issuer public key ( n I , e I ) obtained in stage 3. This verification is performed according to the algorithm presented in Section 5.9.

If the verification of the Signed Static Application Data certificate fails, the SDA has failed.

Otherwise, the SDA processing is considered successful. The terminal stores the data authentication code, representing field 3 in the recovered part M R of the static application data to be signed by the issuer (see Section 5.8.3), in the value field of a data object with tag 9F45 and length equal to 2 bytes.

If the terminal decides that SDA has failed in any of the four stages described above, the rest of the processing involved in the SDA stage from that point on is skipped .

  • The terminal will set bit 8, "Off-line data authentication was performed", in byte 1 of the TSI register.

  • The terminal will also set bit 7, "Off-line static data authentication failed", in byte 1 of the TVR register.

6.4.3 Off-line DDA

The off-line DDA guarantees the authenticity of the data personalized in the card by the issuer, as well as that of the card itself. This is possible because the card has processing power and can actively compute an asymmetric cryptogram on an Unpredictable Number coming from the terminal. A genuine card is able to produce a correct cryptogram for each new unpredictable number. When the terminal assesses off-line the correctness of this cryptogram, it accepts that the card is genuine. This is true with overwhelming probability, unless a powerful attacker has broken the tamper resistance of the chip to read the private key of the card or has solved the "heavy" mathematical problem on which relies the computation of the asymmetric cryptogram. This is a big step forward when compared with cards implemented with magnetic stripe or SDA-only EMV ¢ cards. The asymmetric cryptogram computed by the card consists of a digital signature produced on data received from the terminal with the ICC private key. In order to verify this signature, the terminal has to obtain an authentic copy of the corresponding ICC public key, which is recovered traversing the EMV ¢ certification chain CA/issuer/ICC public key (see Figure 5.1 in Section 5.5). It is important to note that the terminal has similar requirements in terms of computation power as in the case of off-line SDA. However, the card has to be able to compute an RSA operation, which requires the presence of a cryptographic coprocessor in the architecture of the card (see Section 3.4.4 and Appendix D, Section D.1.2). Correspondingly, the price of the card increases . The actual ratio between the price of an EMV ¢ chip card with and without cryptographic coprocessor may vary in the range 1.25 of to 2. This ratio depends on whether a card producer offers "on-the-shelf" EMV ¢ cards with coprocessors or rather the developing price for this type of card is shared with the issuer. In the latter case, the bigger the number of ordered cards, the lower the aforementioned ratio. We can expect that this ratio will decrease over the next 5 years , proportionally with the increase of the chip's CPU computation power. At the limit, one can expect that this ratio will become 1, when the CPU will incorporate numerical units for long arithmetic.

This section will first outline the DDA mechanism implemented with digital signatures. Second, the processing performed by the terminal to verify the authenticity of the ICC public key based on traversing the EMV ¢ certification chain consisting of the Issuer Public Key Certificate and the ICC Public Key Certificate is described. Next, the processing performed by the card for computing the digital signature on the data objects sent by the terminal is presented. Finally, how the terminal assesses the correctness of the digital signature generated by the card is explained.

6.4.3.1 Overview of the DDA As can be seen in Figure 6.6, the off-line DDA requires two separate stages:

  1. During the personalization stage the issuer loads the Issuer Public Key Certificate in the card. The issuer also generates the pair ICC private key/ICC public key and produces the ICC Public Key Certificate with the issuer private key (Section 5.6). The issuer loads in the card both the ICC private key (using a confidential channel) and the ICC Public Key Certificate.

    Note that the card could generate the pair ICC private key/ICC public key by itself and forward only the ICC public key for certification to the issuer's personalization terminal (using an authentic channel). In this case, the issuer will compute only the ICC Public Key Certificate for downloading it in the card. The generation of the RSA key pairs by the chip card itself would better enforce the nonrepudiation security service during an EMV ¢ transaction, with no supplementary costs related to the chip card.

  2. During the utilization stage the card supplies both the Issuer Public Key Certificate and the ICC Public Key Certificate to the terminal. The terminal verifies the authenticity of the Issuer Public Key Certificate with the corresponding CA public key and retrieves an authentic copy of the issuer public key (Section 5.7.1). Using this copy, the terminal can verify the authenticity of the ICC Public Key Certificate and the authenticity of the data personalized in the card by the issuer. If all the verifications are successful, the terminal recovers an authentic copy of the ICC public key (Section 5.7.2). The terminal asks the card with an INTERNAL AUTHENTICATE command to produce a digital signature on a byte string constructed from data objects in the terminal. This byte string is formatted according to the indications of the Dynamic Data Authentication Data Object List (DDOL) provided by the card. For implementing the DDA, the DDOL must include the Unpredictable Number (tag 9F37) data object, which is a random number generated by the terminal for each new EMV ¢ session. After receiving the INTERNAL AUTHENTICATE command with the byte string from the terminal, the card produces a digital signature on this byte string as well as on other data from the card. This signature is referred to in the card as the Signed Dynamic Application Data object with tag 9F4B. The card sends this signature back to the terminal, which will verify it with the authentic copy of the ICC public key. If the verification passes, the terminal accepts that the card is genuine.

click to expand
Figure 6.6: Overview of the off-line DDA.

6.4.3.2 Verifying the authenticity of the card data and ICC public key

First, the terminal verifies the authenticity of the data personalized in the card and of the ICC public key traversing the EMV ¢ certification chain composed of the Issuer Public Key Certificate and the ICC Public Key Certificate. This processing is carried out completely by the terminal, while the card only conveys those data objects needed for completing this verification.

Stage 1 The terminal verifies the existence of the following objects in the EMV ¢ data objects heap:

  • All the data objects needed by the terminal for performing the off-line SDA (stage 1 in Section 6.4.2), except for the Signed Static Application Data (tag 93);

  • ICC Public Key Certificate (tag 9F46);

  • ICC Public Key Remainder (tag 9F48), which is present only in certain conditions (Section 5.4);

  • ICC Public Key Exponent (tag 9F47).

If any of the objects mentioned above are not present in the card (except for tag 9F48 and tag 9F49), set up bit 6, "ICC data missing", in byte 1 of the TVR and consider that DDA has failed.

Note that if the terminal does not identify the DDOL (tag gF49) in the EMV ¢ data objects heap, the terminal should use a default DDOL personalized in the EMV ¢ terminal application by the acquirer. If the default DDOL is also missing, the DDA has failed.

Stage 2 The terminal constructs the static data to be authenticated byte string as it was described in Section 5.8.2. If the static authentication tag list contains any tags other than those accepted (note that there are some differences between the EMV'96 and the EMV 2000 specifications), DDA has failed.

Stage 3 The terminal verifies the authenticity of the Issuer Public Key Certificate (tag 90) and recovers the issuer public key ( n I , e I ) according to the algorithm described in Section 5.7.1.

Stage 4 The terminal verifies the authenticity of the ICC Public Key Certificate (tag 9F46) received from the card with the authentic copy of the issuer public key, ( n I , e I ), which was obtained in stage 3. N I denotes the length of the modulus n I .

If any of the verifications mentioned above failed, DDA has failed. The terminal stores the ICC public key ( n IC , e IC ) to subsequently verify the Signed Dynamic Application Data produced by the card. The terminal proceeds with the next stage.

Stage 5 The terminal initiates the computation of the Signed Dynamic Application Data in the card with an INTERNAL AUTHENTICATE command.

  • Step 1: The terminal generates a random number of 4 bytes, the value of which is assigned to the Unpredictable Number data object (tag 9F37). Its role is to guarantee the uniqueness of the digital signature computed by the card, countering potential replay attacks.

  • Step 2: The terminal creates the terminal dynamic data byte string, concatenating the value fields of all the data objects whose tag-length identifiers are listed in the DDOL. The DDOL should contain at least the tag-length identifier of the unpredictable number, but may also include the identifiers of other data objects from the terminal like the Terminal Identification (tag 9F1C), Terminal Country Code (tag 9F1A), and (tag 9A).

    • If the DDOL received from the card does not have the identifier of the Unpredictable Number among its identifiers, the DDA has failed.

    • If the card did not send the DDOL, the terminal must use the default DDOL. The terminal must check that the tag-length identifier of the Unpredictable Number is among the items listed in the default DDOL. If this is not the case, the DDA has failed.

  • Step 3: The terminal creates the C-APDU corresponding to the INTERNAL AUTHENTICATE command. This C-APDU is summarized in Table 6.3 (according to Table I-19 in Book 3 [1]).

Table 6.3: The C-APDU Corresponding to INTERNAL AUTHENTICATE

Code

Value

CLA

00 (interindustry command)

INS

88

P1

00

P2

00

Lc

Variable (the length of the concatenated value fields of the data objects listed in the DDOL or default DDOL)

Data

Terminal dynamic data ”this is the byte string containing the concatenation of the value fields of the data objects indicated by the card in the DDOL

Le

00

The control parameter P1 encodes the reference of the algorithm for computing the signed dynamic application data, from the terminal's viewpoint. The actual value accepted for P1 is 00, which means that no information on the algorithm is given through P1. At present, the algorithm used by the card for generating the Signed Dynamic Application Data is the RSA algorithm. After formatting the C-APDU of the INTERNAL AUTHENTICATE command, the terminal sends it to the card.

Note that if the combined dynamic data authentication/Application Cryptogram generation is chosen for implementing the off-line data authentication service (choice 2 in Section 6.4.1), all the processing described above is performed except for step 3 in stage 5. In this case, the terminal does not send a separate INTERNAL AUTHENTICATE command to the card.

6.4.3.3 Signature generation by the ICC

Before computing the signature, the card checks that the parameters P1 and P2 of the INTERNAL AUTHENTICATE command are equal to 00. It then checks that the issuer did not previously block the currently selected application through a post-script command. The card also checks that in the current session the execution of the GET PROCESSING OPTIONS command was successfully performed and no other INTERNAL AUTHENTICATE C-APDU was sent to the card. Otherwise the card returns SW1SW2 = 6985, "Command not allowed; conditions of use not satisfied" (see Table I-4 in Book 3 [1]).

Then the card computes the ICC Dynamic Number (tag 9F4C). This is a time-variant parameter generated by the card. When receiving this parameter in an authorization request sent on-line or even in a payment capture message during the clearing, the issuer can check the freshness of this parameter. Thus, the issuer verifies whether the terminal performed the DDA stage or not, when this is required by the EMV ¢ transaction profile. The parameter can be a sequence number incremented each time the INTERNAL AUTHENTICATE command is sent to the card, for which the issuer keeps a synchronous counter in the IH. The parameter can also be a symmetric cryptogram, which is unique for each card and for each transaction. This cryptogram can be a MAC computed by the card on the ATC, which is incremented at every transaction. This MAC is computed with a unique key diversified for each card from a unique master key of the issuer assigned for the purpose of computing the ICC Dynamic Number.

Note that the issuer could have required that the terminal send the entire Signed Dynamic Application Data to the IH for verification. But this could overload the authorization request message with N IC bytes, which can amount to 248 bytes instead of the 3 to 9 bytes needed by the ICC Dynamic Number. When non-repudiation is not a security feature required by the issuer, the use of the ICC Dynamic Number is more economical.

The ICC applies the digital signature scheme giving message recovery implemented with the RSA algorithm, as described in Appendix F, Section F.3.1 (case 2). This algorithm is applied on the message M = M R M ² with the RSA parameters n S = n IC and d S = d IC to obtain a signature S , which is referred to as the signed dynamic application data, stored in the card with the tag 9F4B.

The message M = M R M ² is referred to as the dynamic application data to be signed (see Table 11 in Book 2 [2]).

  • The part M ² consists of the terminal dynamic data byte string, as received in the INTERNAL AUTHENTICATE command from the terminal.

  • The part M R consists of five fields:

    1. Field 1 ”signed data format (1 byte): it has the fix value 05h.

    2. Field 2 ”hash algorithm indicator (1 byte): it identifies the hash algorithm used to produce the hash code H . This value is used in step 1 of the algorithm described in Appendix F, Section F.3.1 (case 2). At the moment, SHA-1 is the hash algorithm recommended by the EMV ¢ 2000 specifications in Annex B3.1 of Book 2 [2]. Thus, the value of the hash algorithm indicator is set to 01h.

    3. Field 3 ”ICC dynamic data length (1 byte): It specifies the bytelength L DD of the ICC dynamic data in field 4. This parameter has to satisfy the relation 0 L DD N IC ˆ’ 25.

    4. Field 4 ”ICC dynamic data ( L DD bytes): It consists of L DD bytes, of which the leftmost byte encodes the length of the ICC Dynamic Number (between 2 and 8 bytes), and the following 2 to 8 bytes represent the ICC Dynamic Number. The rest of the ICC dynamic data, until L DD bytes, can be used by each issuer in a proprietary manner.

    5. Field 5 ”pad pattern: It contains a number of N IC ˆ’ L DD ˆ’ 25 bytes of value BBh.

After the successful completion of this computation, the card sets up an internal flag to mark that DDA was completed. The card can elaborate the R-APDU to be returned to the terminal in two formats:

  1. Response Message Template Format 1: This is a primitive data object with tag 80 whose length is N IC . The value field of this data object contains only the value field of the signed dynamic authentication data.

  2. Response Message Template Format 2: This is a constructed data object with tag 77, which may include several data objects encoded in a BER-TLV format, but which will always contain the signed dynamic authentication data. The other data objects, when they are included, are proprietary to each issuer.

The R-APDU includes at the rightmost position the status words SW1SW2 = 9000.

6.4.3.4 Verifying the signed dynamic authentication data in the terminal

After receiving the signed dynamic authentication data in the R-APDU returned by the card to the INTERNAL AUTHENTICATE command, the terminal verifies its authenticity.

  • Step 1: Verify that the length of the Signed Dynamic Application Data is N IC .

  • Step 2: Apply the signature verification/recovery algorithm in Appendix F, Section F.3.2 (case 2), where S is the signed dynamic application data, n S = n IC , and e S = e IC . The length N of the modulus is N IC .

    The data that is recovered X is parsed as X = B M R H E . The following processing is performed on these items:

    1. Check that E (last byte of X ), which is the recovered data trailer, equals BCh.

    2. Check that B (first byte of X ), which is the recovered data header, equals 6Ah.

    3. Consider M R as the next N IC ˆ’ 22 bytes after B . Parse M R according to the five fields identified in Section 6.4.3.4.

    4. Check that the signed data format read in field 1 of M R is 05h.

    5. Set up the value of the message M ² to the value represented by the terminal dynamic data. This is the byte string containing the concatenation of the value fields of the data objects indicated by the card in the DDOL. This byte string was already computed for including it in the data field of the INTERNAL AUTHENTICATE C-APDU (Section 6.4.3.2, stage 5).

    6. Create the message M , representing the dynamic application data to be signed (see Table 11 in Book 2 [2]), as the concatenation from left to right of the recovered part M R and of the computed part M ² (i.e., M = M R M ² ).

    7. Read the hash algorithm indicator from field 2 of M R . Note that at the moment this value is 01h, corresponding to the SHA-1 algorithm, the only approved hash algorithm in the EMV 2000 specifications (see Annex B3.1 in Book 2 [2]).

    8. Use the indicated hash algorithm to compute the hash code h of M .

    9. Check that h equals the hash result H , which represents the last 20 bytes in X before E .

If any of the verifications mentioned above fail, DDA has failed.

If the terminal decides that DDA has failed in any of the stages and steps described above, the rest of the processing from that point on is skipped. The terminal sets bit 8, "Off-line data authentication was performed", in byte 1 of the TSI register. The terminal will also set bit 4, "Off-line dynamic data authentication failed", in byte 1 of the TVR register.

Otherwise, the DDA processing is considered successful. The terminal constructs the ICC Dynamic Number data object with tag 9F4C, the length field of which equals the first byte of field 4 (see Section 6.4.3.4). The subsequent bytes in field 4, which is indicated in the first byte of field 4, are saved as the value field of the data object with tag 9F4C.