Go to the source code of this file.
Defines | |
#define | WARM_RESET_VALUE 0xAA |
This is a magic value that may be used in detecting a warm reset. | |
#define | MAX_EXCHANGES 50 |
Maximum number of command-response pairs recorded when logging. | |
#define | EEPROM_WARM_RESET 0x0 |
EEPROM address for byte used on warm reset. | |
#define | EEPROM_PIN 0x8 |
EEPROM address for stored PIN. | |
#define | EEPROM_APPLICATION 0x32 |
EEPROM address for selected application. | |
#define | EEPROM_COUNTER 0x40 |
EEPROM address for transaction counter. | |
#define | EEPROM_TLOG_POINTER_HI 0x48 |
EEPROM address for log high address pointer. | |
#define | EEPROM_TLOG_POINTER_LO 0x49 |
EEPROM address for log low address pointer. | |
#define | EEPROM_TLOG_DATA 0x80 |
EEPROM address for transaction log data. | |
#define | EEPROM_MAX_ADDRESS 0xFE0 |
EEPROM maximum allowed address. | |
#define | APP_STORE_PIN 0x01 |
Store PIN. | |
#define | APP_LOG_FORWARD 0x02 |
Forward Commands and make log. | |
#define | APP_FW_MODIFY_PIN 0x03 |
Forward Commands and Modify PIN. | |
#define | APP_FILTER_GENERATEAC 0x04 |
Filter Transaction Amount. | |
#define | APP_FILTER_LOG 0x05 |
Filter amount and log commands. | |
#define | APP_ERASE_EEPROM 0x06 |
Erase EEPROM. | |
#define | APP_TERMINAL_1 0x07 |
Terminal application. | |
#define | APPLICATION_COUNT 7 |
Number of existing applications. | |
Functions | |
int | main (void) |
Main function. | |
void | InitSCD () |
Initializes the SCD. | |
uint8_t | SelectApplication () |
Show menu and select application. | |
void | TestSCDTerminal () |
Tests the SCD-Terminal communication. | |
void | TestSCDICC () |
Tests the SCD-ICC communication. | |
void | SwitchLeds () |
Simple application to switch some LEDs on and off. | |
void | TestHardware () |
Tests the hardware (LEDs, LCD and buttons). | |
uint8_t | ForwardData () |
Forward commands between terminal and ICC through the ICC. | |
uint8_t | FilterGenerateACSimple () |
Hard-codded version of the FilterGenerateAC function. | |
uint8_t | FilterGenerateAC () |
Filter Generate AC command until user accepts or denies the transaction. | |
uint8_t | StorePIN () |
Stores the PIN data from VERIFY command to EEPROM. | |
uint8_t | ForwardAndChangePIN () |
Forward commands and modify VERIFY command with EEPROM PIN data. | |
uint8_t | FilterAndLog () |
Filter Generate AC command and log transaction. | |
uint8_t | Terminal1 () |
Run the terminal application Terminal1. | |
void | SleepUntilTerminalClock () |
Puts the SCD to sleep until receives clock from terminal. | |
void | SleepUntilCardInserted () |
Puts the SCD to sleep until card is inserted or removed. |
scd.h Header file
Contains definitions of functions used by the Smart Card Detective including filtering and modification of EMV commands
Copyright (C) 2010 Omar Choudary (osc22@cam.ac.uk)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Definition in file scd.h.
#define APP_FW_MODIFY_PIN 0x03 |
#define EEPROM_APPLICATION 0x32 |
#define EEPROM_COUNTER 0x40 |
#define EEPROM_MAX_ADDRESS 0xFE0 |
#define EEPROM_TLOG_DATA 0x80 |
#define EEPROM_TLOG_POINTER_HI 0x48 |
#define EEPROM_TLOG_POINTER_LO 0x49 |
#define EEPROM_WARM_RESET 0x0 |
#define MAX_EXCHANGES 50 |
#define WARM_RESET_VALUE 0xAA |
uint8_t FilterAndLog | ( | ) |
Filter Generate AC command and log transaction.
This function filters the Generate AC command just like the FilterGenerateAC function but it also logs all the information about the transaction
uint8_t FilterGenerateAC | ( | ) |
Filter Generate AC command until user accepts or denies the transaction.
This function initiates the communication between ICC and terminal and then forwards the commands and responses from terminal to ICC but blocks the Generate AC request until the user accepts or denies the transaction.
Transaction amount is displayed on LCD and thus the LCD is required for this application.
If the terminal enables the reset line (either by warm reset or by interrupting the transaction the INT0 interrupt routing will be called
uint8_t FilterGenerateACSimple | ( | ) |
Hard-codded version of the FilterGenerateAC function.
This function initiates the communication between ICC and terminal and then forwards the commands and responses from terminal to ICC but blocks the Generate AC request until the user accepts or denies the transaction *
If the terminal enables the reset line (either by warm reset or by interrupting the transaction the INT0 interrupt routing will be called
This function uses hard-coded data. Please use FilterGenerateAC instead.
uint8_t ForwardAndChangePIN | ( | ) |
Forward commands and modify VERIFY command with EEPROM PIN data.
This function is similar to ForwardData but it modifies the VERIFY command. The command data of the VERIFY command is replaced with stored data in EEPROM when the command is sent to the ICC.
uint8_t ForwardData | ( | ) |
Forward commands between terminal and ICC through the ICC.
This function initiates the communication between ICC and terminal and then forwards the commands and responses from terminal to ICC and back until the terminal sends a reset signal.
When a reset signal is received the SCD restarts. The reset signal can be used to copy the transaction data into EEPROM as in the current implementation. The EEPROM data can then be retrieved using any programmer.
void InitSCD | ( | ) |
uint8_t SelectApplication | ( | ) |
Show menu and select application.
This function shows a menu with the existing applications and allows the user to select one of them.
The different applications are shown on the LCD and the user can use the buttons to scroll between the list and to select the desired application.
void SleepUntilCardInserted | ( | ) |
void SleepUntilTerminalClock | ( | ) |
uint8_t StorePIN | ( | ) |
Stores the PIN data from VERIFY command to EEPROM.
This function forwards commands between the terminal and ICC much like the ForwardData method, but when it receives the Verify command it stores the PIN entered by the user in the EEPROM. This is useful in order to store the PIN once and then use it in further transactions so that the original PIN is never revealed.
This method returns immediately after receiving the verify command. Thus PIN entry should be done for example using a CAP reader, where the completion of this transaction is not essential.
The PIN is stored in the EEPROM at the address mentioned by the parameter EEPROM_PIN
void SwitchLeds | ( | ) |
uint8_t Terminal1 | ( | ) |
Run the terminal application Terminal1.
This method implements a terminal application with the basic steps of an EMV transaction. This includes selection by AID, DDA signature, PIN verification and transaction data authorization (Generate AC).
void TestHardware | ( | ) |
void TestSCDICC | ( | ) |
void TestSCDTerminal | ( | ) |
Tests the SCD-Terminal communication.
This function implements an infinite communication loop between the SCD and my terminal emulator, by continuously replying to the SELECT command for "1PAY.SYS.DDF01"
The main role of this function is to test the correct transfer of bytes between the terminal and the SCD