Top |
enum | mccr_track_state_t |
enum | mccr_reader_state_t |
enum | mccr_reader_state_antecedent_t |
enum | mccr_security_level_t |
#define | MCCR_ENCRYPTION_COUNTER_DISABLED |
#define | MCCR_ENCRYPTION_COUNTER_EXPIRED |
#define | MCCR_ENCRYPTION_COUNTER_MIN |
#define | MCCR_ENCRYPTION_COUNTER_MAX |
This section defines methods to query the current device state.
Example 3. Reading the DUKPT KSN and counter
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
mccr_status_t st; uint8_t *ksn; size_t ksn_size, i; if ((st = mccr_device_get_dukpt_ksn_and_counter (device, &ksn, &ksn_size)) != MCCR_STATUS_OK) { fprintf (stderr, "error: cannot get DUKPT KSN and counter: %s\n", mccr_status_to_string (st)); return; } printf ("DUKPT KSN and counter: "); for (i = 0; i < ksn_size; i++) printf ("%02x%s", ksn[i], i < (ksn_size - 1) ? ":" : ""); printf ("\n"); free (ksn); |
mccr_status_t mccr_device_read_software_id (mccr_device_t *device
,char **out_str
);
Read the Software ID property string.
When no longer needed, out_str
should be disposed with free()
.
device |
an open mccr_device_t. |
|
out_str |
output location for the newly allocated string property. |
mccr_status_t mccr_device_read_usb_serial_number (mccr_device_t *device
,char **out_str
);
Read the USB serial number property string.
When no longer needed, out_str
should be disposed with free()
.
device |
an open mccr_device_t. |
|
out_str |
output location for the newly allocated string property. |
mccr_status_t mccr_device_read_polling_interval (mccr_device_t *device
,uint8_t *out_val
);
Read the polling interval, in milliseconds.
When no longer needed, out_str
should be disposed with free()
.
mccr_status_t mccr_device_read_device_serial_number (mccr_device_t *device
,char **out_str
);
Read the device serial number property string.
When no longer needed, out_str
should be disposed with free()
.
device |
an open mccr_device_t. |
|
out_str |
output location for the newly allocated string property. |
mccr_status_t mccr_device_read_magnesafe_version_number (mccr_device_t *device
,char **out_str
);
Read the MagneSafe version number property string.
When no longer needed, out_str
should be disposed with free()
.
device |
an open mccr_device_t. |
|
out_str |
output location for the newly allocated string property. |
const char *
mccr_track_state_to_string (mccr_track_state_t st
);
Gets a description for the given mccr_track_state_t.
mccr_status_t mccr_device_read_track_id_enable (mccr_device_t *device
,bool *out_aamva_supported
,mccr_track_state_t *out_track_1
,mccr_track_state_t *out_track_2
,mccr_track_state_t *out_track_3
);
Read the ISO track mask property string.
device |
an open mccr_device_t. |
|
out_aamva_supported |
output location for the boolean specifying whether AAMVA cards are supported.. |
|
out_track_1 |
output location for the mccr_track_state_t with the track 1 status. |
|
out_track_2 |
output location for the mccr_track_state_t with the track 2 status. |
|
out_track_3 |
output location for the mccr_track_state_t with the track 3 status. |
mccr_status_t mccr_device_read_max_packet_size (mccr_device_t *device
,uint8_t *out_val
);
Read the maximum packet size, in bytes.
mccr_status_t mccr_device_read_iso_track_mask (mccr_device_t *device
,char **out_str
);
Read the ISO track mask property string.
When no longer needed, out_str
should be disposed with free()
.
device |
an open mccr_device_t. |
|
out_str |
output location for the newly allocated string property. |
mccr_status_t mccr_device_read_aamva_track_mask (mccr_device_t *device
,char **out_str
);
Read the AAMVA track mask property string.
When no longer needed, out_str
should be disposed with free()
.
device |
an open mccr_device_t. |
|
out_str |
output location for the newly allocated string property. |
mccr_status_t mccr_device_get_dukpt_ksn_and_counter (mccr_device_t *device
,uint8_t **out_ksn_and_counter
,size_t *out_ksn_and_counter_size
);
Get DUKPT KSN and counter.
The returned array will be 10 bytes long, the output out_ksn_and_counter_size
is given for convenience.
When no longer needed, out_ksn_and_counter
should be disposed with free()
.
device |
an open mccr_device_t. |
|
out_ksn_and_counter |
output location for the newly allocated array containing the KSN and counter. |
|
out_ksn_and_counter_size |
output location for the size_t with the size of |
mccr_status_t mccr_device_set_session_id (mccr_device_t *device
,uint64_t session_id
);
Set the current session id, used by the host to uniquely identify the present transaction.
const char *
mccr_reader_state_to_string (mccr_reader_state_t st
);
Gets a description for the given mccr_reader_state_t.
const char *
mccr_reader_state_antecedent_to_string
(mccr_reader_state_antecedent_t val
);
Gets a description for the given mccr_reader_state_antecedent_t.
mccr_status_t mccr_device_get_reader_state (mccr_device_t *device
,mccr_reader_state_t *out_state
,mccr_reader_state_antecedent_t *out_antecedent
);
Get current reader state and how the reader reached it.
device |
an open mccr_device_t. |
|
out_state |
output location for the mccr_reader_state_t. |
|
out_antecedent |
output location for the mccr_reader_state_antecedent_t. |
mccr_status_t mccr_device_get_security_level (mccr_device_t *device
,mccr_security_level_t *out_level
);
Get current security level.
mccr_status_t mccr_device_get_encryption_counter (mccr_device_t *device
,char **out_device_serial_number
,uint32_t *out_encryption_counter
);
Get device serial number and encryption counter.
When no longer needed, out_device_serial_number
should be disposed with free()
.
device |
an open mccr_device_t. |
|
out_device_serial_number |
output location for the newly allocated device serial number string. |
|
out_encryption_counter |
output location for the encryption counter. |
mccr_status_t mccr_device_get_magtek_update_token (mccr_device_t *device
,uint8_t **out_mut
,size_t *out_mut_size
);
Get Magtek Update Token (MUT).
The returned array will be 36 bytes long, the output out_mut_size
is given for convenience.
When no longer needed, out_mut
should be disposed with free()
.
device |
an open mccr_device_t. |
|
out_mut |
output location for the array containing the MUT. |
|
out_mut_size |
output location for the size_t with the size of |
How the reader got into its current state.
Security level.
#define MCCR_ENCRYPTION_COUNTER_DISABLED 0xFFFFFF
Encryption counter is disabled.
#define MCCR_ENCRYPTION_COUNTER_EXPIRED 0x000000
Encryption counter is expired (all transactions prohibited).
#define MCCR_ENCRYPTION_COUNTER_MIN 0x000001
Minimum valid encryption counter.