!LtkCA($CA, ~privkCA) Cert auth $CA has the private key privkCA
!CertCA($CA, cert) Cert auth $CA's public key certificate is cert
The banks
!LtkBank($Bank, ~privkBank),
!CertBank($Bank, cert),
!IssuingCA($Bank, $CA),
A Mastercard:
!Card(~Track2, DBsupport, $Bank, ~KM, ~privkCard, certCard, certBank, cardAIP, CVMlist) (We do not model the file locator: AFL
Card_L1_Nonces
Card_Started(Track2, Nr, Nc): Card has started a run with reader nonce Nr and card nonce Nc
Card_Gen_AC(Track2, AC): Card has generated AC, stored for DB step.
N.B. "Card" may refer to any payment device, including phones
The Terminal
!Terminal($Term,MCC,DBsupport) : The merchent code of the Terminal, either 'transit' or 'retail'
Terminal_Nonce_L1($Term, Nr) : Terminal has started in DB mode with reader nonce Nr
Terminal_No_DB($Term) : Terminal has started a legacy run of the protocol
Terminal_Start_L3($Term, Mode, Nr, Nc) : Terminal as started a run of the L3 prototocol, Mode is 'DB' or 'noDB', if it's DB then Nr and Nc are the nonces, otherwise they are 'none'.
Terminal_Running($Term, Track2, amount, UN, DBmode, Nr, Nc): As above plus terminal has send GEN AC with nonce UN
Terminal_SDAD_Passed($Term,Nr,Nc,< Track2, AIP, CDOL1_DATA, ATC, IAD, AC>) : Terminal has accepted the SDAD and is doing the DB check before sending data to the bank.
DBsupport: is DB protocol supported? Either 'DB' or 'noDB'
DBmode: Is this current session running with DB protection? Either 'DB' or 'noDB'
Sign types:
01: card cert
02: bank cert
03: CA cert
04: SDAD
05: DB proof
Important checks made by the L3 EMV protocol
CHECK 1: The Terminal_Sends_READRECORD_MC rule checks that the cards AIP is CDA mode
CHECK 2: Before generating the GEN AC message the reader will check the CVM_list includes online.
CHECK 3: After the read record the terminal must check bank and card Certs, using a CA.
CHECK 4: In reponse to GEN AC, the device may approve any amount if CDCVM used
CHECK 5: Device may approve a low amount with No CDCVM if Magic Bytes are used and the MCC is transit
CHECK 6: Check SDAD is correctly signed with the expected fields.
CHECK 7: Bank can approve a high or low amount if IAD to shows that CDCVM was used.
CHECK 8: Bank can approve a low amount without CDCVM if MCC = transit.
New checks added by the L1 DB protocol
CHECK DB_1: If ATQA indicates support for L1DB then exchange nonces.
CHECK DB_2: Terminals that support L1DB will check the AIP matches the selected mode.
*/
// A card that doesn't support DB
rule Create_Mastercard_Legacy:
let
pubkCard = pk(~privkCard)
cont = <'01', ~Track2, pubkCard, $Bank>
certCard = <cont, sign{cont}~privkBank>
cardAIP = <'CDA','CDCVM','noDB'> // Card will only CDA and offers CDCVM, no DB support
CVMlist ='PIN_online' // Card would like online auth, other list options (e.g. magstrip not modelled)