#include <ccid.h>#include <emv.h>#include <Python.h>#include <structmember.h>#include "py_ccid.h"
Go to the source code of this file.
Data Structures | |
| struct | cp_emv |
| struct | cp_app |
| struct | cp_data |
| struct | key_cb |
| struct | dol_cb |
Defines | |
| #define | _INT_CONST(m, c) PyModule_AddIntConstant(m, #c, EMV_ ## c) |
Functions | |
| static PyObject * | data_dict (struct cp_emv *, emv_data_t *, unsigned int) |
| static void | set_err (emv_t e) |
| static PyObject * | bcd_convert (const uint8_t *ptr, size_t len) |
| static PyObject * | binary_convert (const uint8_t *ptr, size_t len) |
| static PyObject * | date_convert (const uint8_t *ptr, size_t len) |
| static PyObject * | cp_data_repr (struct cp_data *self) |
| static PyObject * | cp_data_value (struct cp_data *self, PyObject *args) |
| static PyObject * | cp_data_children (struct cp_data *self, PyObject *args) |
| static PyObject * | cp_data_type (struct cp_data *self, PyObject *args) |
| static PyObject * | cp_data_tag (struct cp_data *self, PyObject *args) |
| static PyObject * | cp_data_tag_label (struct cp_data *self, PyObject *args) |
| static PyObject * | cp_data_sda (struct cp_data *self, PyObject *args) |
| static void | cp_data_dealloc (struct cp_data *self) |
| static void | cp_app_dealloc (struct cp_app *self) |
| static PyObject * | cp_app_rid (struct cp_app *self, PyObject *args) |
| static PyObject * | cp_app_aid (struct cp_app *self, PyObject *args) |
| static PyObject * | cp_app_label (struct cp_app *self, PyObject *args) |
| static PyObject * | cp_app_pname (struct cp_app *self, PyObject *args) |
| static PyObject * | cp_app_prio (struct cp_app *self, PyObject *args) |
| static PyObject * | cp_app_confirm (struct cp_app *self, PyObject *args) |
| static int | cp_emv_init (struct cp_emv *self, PyObject *args, PyObject *kwds) |
| static void | dirty_applist (struct cp_emv *self) |
| static void | cp_emv_dealloc (struct cp_emv *self) |
| static PyObject * | app_list (struct cp_emv *self) |
| static int | set_current (struct cp_emv *self) |
| static PyObject * | cp_appsel_pse (struct cp_emv *self, PyObject *args) |
| static PyObject * | cp_select_pse (struct cp_emv *self, PyObject *args) |
| static PyObject * | cp_select_aid (struct cp_emv *self, PyObject *args) |
| static PyObject * | cp_select_aid_next (struct cp_emv *self, PyObject *args) |
| static PyObject * | cp_current_app (struct cp_emv *self, PyObject *args) |
| static PyObject * | cp_init (struct cp_emv *self, PyObject *args) |
| static PyObject * | data_list (struct cp_emv *owner, emv_data_t *elem, unsigned int nmemb) |
| static PyObject * | cp_read_app_data (struct cp_emv *self, PyObject *args) |
| static const uint8_t * | get_mod (void *priv, unsigned int idx, size_t *len) |
| static const uint8_t * | get_exp (void *priv, unsigned int idx, size_t *len) |
| static PyObject * | cp_sda (struct cp_emv *self, PyObject *args) |
| static PyObject * | cp_dda (struct cp_emv *self, PyObject *args) |
| static PyObject * | cp_cvm_pin (struct cp_emv *self, PyObject *args) |
| static PyObject * | cp_pin_try_counter (struct cp_emv *self, PyObject *args) |
| static PyObject * | cp_atc (struct cp_emv *self, PyObject *args) |
| static PyObject * | cp_oatc (struct cp_emv *self, PyObject *args) |
| static PyObject * | ac2tuple (const uint8_t *ptr, size_t len) |
| static PyObject * | cp_gen_ac (struct cp_emv *self, PyObject *args) |
| static int | dol_cbfn (uint16_t tag, uint8_t *ptr, size_t len, void *priv) |
| static PyObject * | do_dol (struct cp_emv *self, PyObject *args, int create) |
| static PyObject * | cp_dol_read (struct cp_emv *self, PyObject *args) |
| static PyObject * | cp_dol_create (struct cp_emv *self, PyObject *args) |
| PyMODINIT_FUNC | initemv (void) |
Variables | |
| static PyMethodDef | cp_data_methods [] |
| static PyTypeObject | data_pytype |
| static PyMethodDef | cp_app_methods [] |
| static PyTypeObject | app_pytype |
| static PyMethodDef | cp_emv_methods [] |
| static PyTypeObject | emv_pytype |
| static PyMethodDef | methods [] |
| #define _INT_CONST | ( | m, | |||
| c | ) | PyModule_AddIntConstant(m, #c, EMV_ ## c) |
| static PyObject* ac2tuple | ( | const uint8_t * | ptr, | |
| size_t | len | |||
| ) | [static] |
Definition at line 695 of file py_emv.c.
Referenced by cp_gen_ac().

| static PyObject* app_list | ( | struct cp_emv * | self | ) | [static] |
Definition at line 393 of file py_emv.c.
References cp_app::app, cp_app::cur, cp_app::dirty, emv_appsel_pse_first(), emv_appsel_pse_next(), and cp_app::owner.
Referenced by cp_appsel_pse().


| static PyObject* bcd_convert | ( | const uint8_t * | ptr, | |
| size_t | len | |||
| ) | [static] |
Definition at line 75 of file py_emv.c.
Referenced by cp_data_repr().

| static PyObject* binary_convert | ( | const uint8_t * | ptr, | |
| size_t | len | |||
| ) | [static] |
Definition at line 90 of file py_emv.c.
Referenced by cp_data_repr().

| static PyObject* cp_app_aid | ( | struct cp_app * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 270 of file py_emv.c.
References EMV_AID_LEN, and emv_app_aid().

| static PyObject* cp_app_confirm | ( | struct cp_app * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 309 of file py_emv.c.
References emv_app_confirm().

| static void cp_app_dealloc | ( | struct cp_app * | self | ) | [static] |
Definition at line 251 of file py_emv.c.
References emv_app_delete().

| static PyObject* cp_app_label | ( | struct cp_app * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 282 of file py_emv.c.
References emv_app_label().

| static PyObject* cp_app_pname | ( | struct cp_app * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 291 of file py_emv.c.
References emv_app_pname().

| static PyObject* cp_app_prio | ( | struct cp_app * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 300 of file py_emv.c.
References emv_app_prio().

| static PyObject* cp_app_rid | ( | struct cp_app * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 259 of file py_emv.c.
References emv_app_rid(), and EMV_RID_LEN.

| static PyObject* cp_appsel_pse | ( | struct cp_emv * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 448 of file py_emv.c.
References app_list(), dirty_applist(), emv_appsel_pse(), and set_err().

| static PyObject* cp_atc | ( | struct cp_emv * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 685 of file py_emv.c.
References emv_trm_atc().

| static PyObject* cp_current_app | ( | struct cp_emv * | self, | |
| PyObject * | args | |||
| ) | [static] |
| static PyObject* cp_cvm_pin | ( | struct cp_emv * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 664 of file py_emv.c.
References emv_cvm_pin(), and set_err().

| static PyObject* cp_data_children | ( | struct cp_data * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 151 of file py_emv.c.
References data_dict(), and emv_data_children().

| static void cp_data_dealloc | ( | struct cp_data * | self | ) | [static] |
| static PyObject* cp_data_repr | ( | struct cp_data * | self | ) | [static] |
Definition at line 115 of file py_emv.c.
References bcd_convert(), binary_convert(), date_convert(), emv_data(), EMV_DATA_BCD, EMV_DATA_BINARY, EMV_DATA_DATE, emv_data_int(), EMV_DATA_INT, EMV_DATA_TEXT, and emv_data_type().

| static PyObject* cp_data_sda | ( | struct cp_data * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 182 of file py_emv.c.
References emv_data_sda().

| static PyObject* cp_data_tag | ( | struct cp_data * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 165 of file py_emv.c.
References emv_data_tag().

| static PyObject* cp_data_tag_label | ( | struct cp_data * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 170 of file py_emv.c.
References emv_data_tag_label().

| static PyObject* cp_data_type | ( | struct cp_data * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 160 of file py_emv.c.
References emv_data_type().

| static PyObject* cp_data_value | ( | struct cp_data * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 142 of file py_emv.c.
References emv_data().

| static PyObject* cp_dda | ( | struct cp_emv * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 648 of file py_emv.c.
References emv_authenticate_dynamic(), key_cb::exp, get_exp(), get_mod(), key_cb::mod, and set_err().

| static PyObject* cp_dol_create | ( | struct cp_emv * | self, | |
| PyObject * | args | |||
| ) | [static] |
| static PyObject* cp_dol_read | ( | struct cp_emv * | self, | |
| PyObject * | args | |||
| ) | [static] |
| static void cp_emv_dealloc | ( | struct cp_emv * | self | ) | [static] |
Definition at line 386 of file py_emv.c.
References dirty_applist(), and emv_fini().

| static int cp_emv_init | ( | struct cp_emv * | self, | |
| PyObject * | args, | |||
| PyObject * | kwds | |||
| ) | [static] |
Definition at line 345 of file py_emv.c.
References emv_init(), and cp_chipcard::slot.

| static PyObject* cp_gen_ac | ( | struct cp_emv * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 721 of file py_emv.c.
References ac2tuple(), emv_generate_ac(), hex_dump(), and set_err().

| static PyObject* cp_init | ( | struct cp_emv * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 527 of file py_emv.c.
References emv_app_aip(), emv_app_init(), and set_err().

| static PyObject* cp_oatc | ( | struct cp_emv * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 690 of file py_emv.c.
References emv_trm_last_online_atc().

| static PyObject* cp_pin_try_counter | ( | struct cp_emv * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 680 of file py_emv.c.
References emv_pin_try_counter().

| static PyObject* cp_read_app_data | ( | struct cp_emv * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 576 of file py_emv.c.
References data_list(), emv_read_app_data(), emv_retrieve_records(), and set_err().

| static PyObject* cp_sda | ( | struct cp_emv * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 632 of file py_emv.c.
References emv_authenticate_static_data(), key_cb::exp, get_exp(), get_mod(), key_cb::mod, and set_err().

| static PyObject* cp_select_aid | ( | struct cp_emv * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 481 of file py_emv.c.
References emv_app_select_aid(), set_current(), and set_err().

| static PyObject* cp_select_aid_next | ( | struct cp_emv * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 501 of file py_emv.c.
References cp_app::app, emv_app_select_aid_next(), set_current(), and set_err().

| static PyObject* cp_select_pse | ( | struct cp_emv * | self, | |
| PyObject * | args | |||
| ) | [static] |
Definition at line 462 of file py_emv.c.
References cp_app::app, emv_app_select_pse(), set_current(), and set_err().

| static PyObject * data_dict | ( | struct cp_emv * | owner, | |
| emv_data_t * | elem, | |||
| unsigned int | nmemb | |||
| ) | [static] |
Definition at line 227 of file py_emv.c.
References cp_data::data, emv_data_tag(), and cp_data::owner.
Referenced by cp_data_children().


| static PyObject* data_list | ( | struct cp_emv * | owner, | |
| emv_data_t * | elem, | |||
| unsigned int | nmemb | |||
| ) | [static] |
Definition at line 555 of file py_emv.c.
References cp_data::data, and cp_data::owner.
Referenced by cp_read_app_data().

| static PyObject* date_convert | ( | const uint8_t * | ptr, | |
| size_t | len | |||
| ) | [static] |
Definition at line 107 of file py_emv.c.
Referenced by cp_data_repr().

| static void dirty_applist | ( | struct cp_emv * | self | ) | [static] |
Definition at line 364 of file py_emv.c.
References cp_app::app, and cp_app::dirty.
Referenced by cp_appsel_pse(), and cp_emv_dealloc().

| static PyObject* do_dol | ( | struct cp_emv * | self, | |
| PyObject * | args, | |||
| int | create | |||
| ) | [static] |
Definition at line 837 of file py_emv.c.
References dol_cb::dict, dol_cbfn(), emv_construct_dol(), and dol_cb::list.
Referenced by cp_dol_create(), and cp_dol_read().


| static int dol_cbfn | ( | uint16_t | tag, | |
| uint8_t * | ptr, | |||
| size_t | len, | |||
| void * | priv | |||
| ) | [static] |
Definition at line 795 of file py_emv.c.
References dol_cb::dict, and dol_cb::list.
Referenced by do_dol().

| static const uint8_t* get_exp | ( | void * | priv, | |
| unsigned int | idx, | |||
| size_t * | len | |||
| ) | [static] |
Definition at line 613 of file py_emv.c.
References key_cb::exp.
Referenced by cp_dda(), and cp_sda().

| static const uint8_t* get_mod | ( | void * | priv, | |
| unsigned int | idx, | |||
| size_t * | len | |||
| ) | [static] |
Definition at line 594 of file py_emv.c.
References key_cb::mod.
Referenced by cp_dda(), and cp_sda().

| PyMODINIT_FUNC initemv | ( | void | ) |
Definition at line 892 of file py_emv.c.
References _INT_CONST.
| static int set_current | ( | struct cp_emv * | self | ) | [static] |
Definition at line 422 of file py_emv.c.
References cp_app::app, cp_app::cur, cp_app::dirty, emv_current_app(), cp_app::owner, and set_err().
Referenced by cp_select_aid(), cp_select_aid_next(), and cp_select_pse().


| static void set_err | ( | emv_t | e | ) | [static] |
Definition at line 36 of file py_emv.c.
References code, EMV_ERR_CCID, EMV_ERR_SYSTEM, emv_error(), emv_error_additional(), emv_error_string(), emv_error_type(), and str.
Referenced by cp_appsel_pse(), cp_cvm_pin(), cp_dda(), cp_gen_ac(), cp_init(), cp_read_app_data(), cp_sda(), cp_select_aid(), cp_select_aid_next(), cp_select_pse(), and set_current().


PyTypeObject app_pytype [static] |
{
PyObject_HEAD_INIT(NULL)
.tp_name = "emv.app",
.tp_basicsize = sizeof(struct cp_app),
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_new = PyType_GenericNew,
.tp_dealloc = (destructor)cp_app_dealloc,
.tp_methods = cp_app_methods,
.tp_doc = "EMV application",
}
PyMethodDef cp_app_methods[] [static] |
{
{"rid",(PyCFunction)cp_app_rid, METH_NOARGS,
"app.rid() - Registered application ID"},
{"aid",(PyCFunction)cp_app_aid, METH_NOARGS,
"app.aid() - Application ID"},
{"label",(PyCFunction)cp_app_label, METH_NOARGS,
"app.name() - Label"},
{"pname",(PyCFunction)cp_app_pname, METH_NOARGS,
"app.pname() - Preferred name"},
{"prio",(PyCFunction)cp_app_prio, METH_NOARGS,
"app.prio() - Application priority"},
{"confirm",(PyCFunction)cp_app_confirm, METH_NOARGS,
"app.confirm() - Application confirmation indicator"},
{NULL, }
}
PyMethodDef cp_data_methods[] [static] |
{
{"type",(PyCFunction)cp_data_type, METH_NOARGS,
"data.type() - Data element type"},
{"tag",(PyCFunction)cp_data_tag, METH_NOARGS,
"data.type() - Data element BER tag"},
{"tag_label",(PyCFunction)cp_data_tag_label, METH_NOARGS,
"data.type() - Data element tag name if known, None if not"},
{"children",(PyCFunction)cp_data_children, METH_NOARGS,
"data.children() - Returns dictionary of child elements"},
{"value",(PyCFunction)cp_data_value, METH_NOARGS,
"data.value() - Retrieve value of data element"},
{"sda",(PyCFunction)cp_data_sda, METH_NOARGS,
"data.sda() - Returns True if SDA protected"},
{NULL,},
}
PyMethodDef cp_emv_methods[] [static] |
PyTypeObject data_pytype [static] |
{
PyObject_HEAD_INIT(NULL)
.tp_name = "emv.data",
.tp_basicsize = sizeof(struct cp_data),
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_new = PyType_GenericNew,
.tp_dealloc = (destructor)cp_data_dealloc,
.tp_methods = cp_data_methods,
.tp_repr = (reprfunc)cp_data_repr,
.tp_doc = "EMV data element",
}
PyTypeObject emv_pytype [static] |
{
PyObject_HEAD_INIT(NULL)
.tp_name = "emv.card",
.tp_basicsize = sizeof(struct cp_emv),
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_new = PyType_GenericNew,
.tp_init = (initproc)cp_emv_init,
.tp_dealloc = (destructor)cp_emv_dealloc,
.tp_methods = cp_emv_methods,
.tp_doc = "EMV chip",
}
PyMethodDef methods[] [static] |
{
{"dol_read",(PyCFunction)cp_dol_read, METH_VARARGS,
"dol_read(str) - returns list of (tag, len) tuples"},
{"dol_create",(PyCFunction)cp_dol_create, METH_VARARGS,
"dol_create(str) - returns the constructed binary data item"},
{NULL, }
}
1.6.3