Implementing Electronic Card Payment Systems (Artech House Computer Security Series)

6.6 Cardholder verification

The cardholder verification stage allows the terminal to verify the link between the person at the point of service and the eligible cardholder to whom the application in the card was issued. This stage can be performed any time after the completion of the read application data stage and before finalizing the terminal action analysis stage.

6.6.1 Cardholder verification methods in EMV ¢

The EMV ¢ standard accepts several CVMs, which are discussed below. A method number on 6 bits, which is indicated in parentheses, is associated with each CVM, according to Annex C.3, in Book 3 [1].

6.6.2 Data objects involved in cardholder verification

The Cardholder Verification Method List (CVM List) is a data object with tag 8E, which is stored in the card application since its personalization. It contains two amount fields, which are referred to as X and Y , and a list of all the cardholder verification rules accepted by the card. The meaning of these components is described below.

Both the first ( X ) and second ( Y ) amount fields are encoded with an implicit decimal point on 4 bytes in a binary format. They are expressed in the same currency, whose type is encoded in the Application Currency Code data object with tag 9F42 stored in the card. X and Y represent two threshold values established by the issuer, which determine whether the terminal should apply a certain CVM or not. This decision depends on the relationship between the amount involved in the current transaction, which is stored in the terminal in the Amount, Authorized data object (tag 81), and X, Y (see also the CVM condition codes below).

A Cardholder Verification Rule (CVR) consists of 2 bytes: the first indicates the type of CVM to be used, while the second specifies in which condition this CVM will be applied.

The first byte, referred to as the Cardholder Verification Method Code (CVM Code), is encoded as follows :

The second byte, referred to as the Cardholder Verification Method Condition Code (CVM Condition Code), indicates the condition to be respected for applying the CVM whose code is specified in the first byte:

The issuer specifies the values of the threshold amounts X and Y in the first tow fields of 4 bytes of the CVM List.

Thus, one can see that the CVM List stored in the card application indicates to the terminal the types of CVM supported by the card, the conditions in which each CVM should be applied, and their preferred order.

In its turn the terminal supports all the CVMs indicated in the second byte of the Terminal Capabilities (tag 9F33) (see Annex A2 in Book 4 [3]):

In addition, the terminal shall recognize the CVM codes for "No CVM required" and "Fail CVM processing", which may be present in the card's CVM List.

The terminal will register the result of the last CVM that was performed in the cardholder verification method results (CVM Results, tag 9F34), whose encoding is given below (according to Annex A4 in Book 4 [3]):

6.6.3 Common processing performed by the terminal

Whenever bit 5, "Cardholder verification is supported", in byte 1 of the AIP is set, the terminal performs the cardholder verification stage. This section presents the actions performed by the terminal regardless of the type of CVM.

The terminal checks whether the CVM List (tag 8E) is present in the EMV ¢ heap of the terminal.

For each CVR, the processing is described below:

  1. Verify the CVM Condition Code (the second byte of the CVR):

    • Check that the terminal understands the CVM Condition Code. It could be that the EMV ¢ application in the card is a more recent version than the counterpart application in the terminal. Therefore, it could be that the terminal does not yet know how to interpret a condition whose code is known to the card.

    • Check that all the data elements involved for the verification of that condition are present in the terminal. For example, the evaluation of a condition that involves the thresholds X and Y needs the presence of the Application Currency Code (tag 9F42).

    • Verify that the business environment at the point of service for the current transaction respects the condition expressed in this CVR.

      If any of the verifications mentioned above fails, then do:

      If the current CVR is the last in the CVM List:

      • Set bit 8, "Cardholder verification was not successful", in byte 3 of the TVR.

      • The terminal shall set byte 1 of the CVM Results to "No CVM performed" (3Fh).

      • Terminate the cardholder verification stage.

      • Else consider the next CVR, and restart from step 1.

      Else continue with verifying the CVM code in the first byte of the CVR, as detailed below in step 2.

  2. Verify that the method number (the rightmost 6 bits) in the CVM code is one of those accepted by EMV ¢ (see Section 6.6.2) or is otherwise understood by the terminal, as specified by a particular payment system or issuer.

    The terminal shall set bytes 1 and 2 of the CVM Results with the method code and condition code of the current CVM rule interpreted from the CVM List.

    If the method number in the CVM code is "No CVM required" (011111b) and if the terminal supports "No CVM required", it shall set byte 3 of the CVM Results to "successful". Terminate the cardholder verification stage.

    If the method number in the CVM Code is "Fail CVM processing", the terminal shall set byte 3 of the CVM Results to "failed". Terminate the cardholder verification stage.

    If the method number in the CVM code is not known and, correspondingly, the terminal does not understand the CVM, then do:

    The terminal shall set the third byte of the CVM Results to "failed".

    If the CVM condition code is known and correctly satisfied:

    • Set bit 7, "Unrecognized CVM", in byte 3 of the TVR.

    • If the current CVR is the last in the CVM List:

      • Set bit 8, "Cardholder verification was not successful", in byte 3 of the TVR.

      • Terminate the cardholder verification stage.

        Else consider the next CVR, and restart from step 1.

      Else perform the CVM whose code is indicated. Refer to Section 6.6.4 for off-line PIN processing and to Section 6.6.6 for on-line PIN processing.

      If the terminal successfully completes the CVM:

      • Set bit 7, "Cardholder verification was performed", in byte 1 of the TSI.

      • Terminate the cardholder verification stage.

        Else (the CVM processing failed)

      • If bit 7 of the CVM Code is 0:

        • Set bit 8, "Cardholder verification was not successful", in byte 3 of the TVR.

        • Terminate the cardholder verification stage.

          Else (bit 7 of the CVM Code is 1):

          • If CVR is the last entry in the CVM List

            Set bit 8, "Cardholder verification was not successful", in byte 3 of the TVR.

            Terminate the cardholder verification stage.

        • Else consider the next CVR entry in the CVM List, and continue with step 1.

6.6.4 Off-line PIN processing

The processing described in this section applies for the following CVM(s):

First, we discuss two concepts used in the processing performed by the terminal.

From the point of view of service availability for the cardholder, the third approach is probably better.

The processing performed by the terminal is described below. If the terminal does not support off-line PIN:

Set bit 5, "PIN entry required and PIN pad not present or not working", in byte 3 of the TVR.

Else

If PIN pad is malfunctioning

Set bit 5, "PIN entry required and PIN pad not present or not working", in byte 3 of the TVR.

Else

If either the merchant or the cardholder bypass the PIN processing

In case the terminal supports off-line PIN, the PIN pad works correctly, and the cardholder does not bypass the PIN, the processing performed by the terminal is the following. Issue the GET DATA command to the card, with the C-APDU presented in Table 6.4 (according to Table I-16 in Book 3 [1]). This command is used to retrieve the PIN Try Counter primitive data object from the card. This object is not encapsulated in any record within the current application.

Table 6.4: The C-APDU Corresponding to GET DATA Command

Code

Value

CLA

80 (EMV ¢ specific command)

INS

CA

P1 P2

9F17 (value corresponding to the PIN Try Counter primitive data object)

Lc

Not present

Data

Not present

Le

00

The data field of the corresponding R-APDU contains the PIN Try Counter, including its tag 9F17 and its length. When the value of this counter is zero, there are no more PIN trials left.

If SW1 SW2 = 9000 and PIN Try Counter is zero then the following processing is performed:

If either SW1SW2 ‰  9000 or SW1SW2 = 9000 and PIN Try Counter is different than zero, then the following processing is performed:

Table 6.5: C-APDU of the GET CHALLENGE Command

Code

Value

CLA

00 (interindustry command)

INS

84

P1 P2

00 00

Lc

Not present

Data

Not present

Le

00

In case of successful execution the card returns the R-APDU containing a random sequence of 8 bytes and SW1SW2 = 9000. The terminal stores this sequence in the value field of the Unpredictable Number data object (tag 9F37). The terminal uses this Unpredictable Number to insure the uniqueness of each RSA digital envelope containing a PIN. This security mechanism impedes an attacker from successfully impersonating the legitimate cardholder by simply replying a previously sent RSA digital envelope or determining the PIN from an RSA digital envelope through a dictionary attack.

After retrieving the PIN received in the command either directly or in the RSA digital envelope, the card compares this value with a witness PIN stored in its permanent memory since the personalization. Every time this comparison fails, the number of possible PIN trials stored in the PIN Try Counter is decreased. The status words SW1SW2 are positioned to 6983 or 6984, in case the PIN Try Counter was zero at the moment the VERIFY command was issued. Otherwise, the card answers the code SW1SW2 = 63Cx, where x indicates the remaining number of possible PIN trials, which could also be zero in case PIN Try Counter is zero.

The terminal receives the R-APDU from the card corresponding to the VERIFY command. This R-APDU consists of the status words SW1SW2, which allows the terminal to assess the completion of the required off-line PIN verification in the card:

6.6.5 RSA digital envelope carrying the PIN

Figure 6.7 outlines the CVM "Enciphered PIN verification performed by ICC" (000100b) (see Appendix D, Section D.5.5, for more details). The main advantage of this CVM is that an attacker loses any opportunity to eavesdrop the cardholder's PIN on the interface between the ICC and the terminal, since the PIN is wrapped in an RSA digital envelope.

Figure 6.7: Overview of the enciphered PIN verification performed by ICC.

During the personalization stage, the issuer generates the pair ICC PIN encipherment private key/ICC PIN encipherment public key and produces the ICC PIN Encipherment Public Key Certificate with the issuer private key. The issuing of this certificate is described in Section 5.6. The issuer loads both the ICC PIN encipherment private key (using a confidential channel) and the ICC PIN Encipherment Public Key Certificate in the card. Note, in order to save EEPROM space in the card, the ICC private/public key pair could be used instead of the ICC PIN encipherment private/public key pair to perform the unwrapping/wrapping of the RSA envelopes. It is important to mention, however, that whenever the card has enough EEPROM space, the best security practice is to keep separate key pairs for signature generation/verification and for unwrapping /wrapping RSA digital envelopes.

During a transaction that selected the "Enciphered PIN verification performed by ICC" as CVM the terminal verifies the existence in the EMV ¢ data objects heap of the following objects:

If the terminal cannot retrieve the last three data objects, it searches for the following three data objects:

If both sets of data objects mentioned above are missing, the enciphered PIN verification performed by ICC fails.

If the first set of data objects is present, the terminal obtains an authentic copy of the ICC PIN encipherment public key ( n PE , e PE ) applying the same algorithm as that described for obtaining the ICC public key (see Section 5.7.2).

The terminal creates a message M of N PE (or N IC ) bytes from the following items:

The RSA digital envelope is obtained through a public RSA operation (see Appendix F, Section F.2) on M with the modulus n PE and the public exponent e PE .

After receiving the C-APDU of the VERIFY command with P2 = 88, the card retrieves the RSA digital envelope E from the data field. The card applies a secret RSA operation (see Appendix F, Section F.2) on this digital envelope with the modulus n PE and the secret exponent d PE , where ( n PE , d PE ) represents the ICC PIN encipherment private key. The result of this operation is denoted M ² .

The card performs the following verifications:

If all the verifications mentioned above are passed, the enciphered PIN verification is considered successful.

6.6.6 On-line PIN processing

The processing described in this section applies to the CVM "Enciphered PIN verified on-line" (000010b). The processing performed by the terminal is described below.

Категории