2020-12-06 08:22:20 +08:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Copyright (C) 2020 A. Ozkal
|
|
|
|
//
|
|
|
|
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
|
|
|
// at your option, any later version. See the LICENSE.txt file for the text of
|
|
|
|
// the license.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// High frequency Electronic Machine Readable Travel Document commands
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#ifndef CMDHFEMRTD_H__
|
|
|
|
#define CMDHFEMRTD_H__
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
2020-12-19 23:48:37 +08:00
|
|
|
typedef struct emrtd_dg_s {
|
|
|
|
uint8_t tag;
|
2020-12-29 06:55:18 +08:00
|
|
|
uint8_t dgnum;
|
2020-12-19 23:48:37 +08:00
|
|
|
const char *fileid;
|
|
|
|
const char *filename;
|
|
|
|
const char *desc;
|
2020-12-20 00:12:08 +08:00
|
|
|
bool pace;
|
2020-12-24 04:21:54 +08:00
|
|
|
bool eac; // EAC only (we can't dump these)
|
2020-12-20 00:12:08 +08:00
|
|
|
bool required; // some are required only if PACE
|
|
|
|
bool fastdump; // fast to dump
|
2020-12-19 23:48:37 +08:00
|
|
|
int (*parser)(uint8_t *data, size_t datalen);
|
2020-12-30 11:37:01 +08:00
|
|
|
int (*dumper)(uint8_t *data, size_t datalen, const char *path);
|
2020-12-19 23:48:37 +08:00
|
|
|
} emrtd_dg_t;
|
|
|
|
|
2020-12-29 22:56:29 +08:00
|
|
|
typedef struct emrtd_hashalg_s {
|
|
|
|
const char *name;
|
|
|
|
int (*hasher)(uint8_t *datain, int datainlen, uint8_t *dataout);
|
|
|
|
size_t hashlen;
|
|
|
|
size_t descriptorlen;
|
|
|
|
const uint8_t descriptor[15];
|
|
|
|
} emrtd_hashalg_t;
|
|
|
|
|
2021-02-21 06:43:59 +08:00
|
|
|
typedef struct emrtd_pacealg_s {
|
|
|
|
const char *name;
|
|
|
|
int (*keygenerator)(uint8_t *datain, int datainlen, uint8_t *dataout);
|
|
|
|
const uint8_t descriptor[10];
|
|
|
|
} emrtd_pacealg_t;
|
|
|
|
|
2021-02-21 07:18:10 +08:00
|
|
|
// Standardized Domain Parameters
|
|
|
|
typedef struct emrtd_pacesdp_s {
|
|
|
|
uint8_t id;
|
|
|
|
const char *name;
|
|
|
|
size_t size;
|
|
|
|
} emrtd_pacesdp_t;
|
|
|
|
|
2020-12-06 08:22:20 +08:00
|
|
|
int CmdHFeMRTD(const char *Cmd);
|
|
|
|
|
2020-12-30 11:37:01 +08:00
|
|
|
int dumpHF_EMRTD(char *documentnumber, char *dob, char *expiry, bool BAC_available, const char *path);
|
2020-12-17 04:53:40 +08:00
|
|
|
int infoHF_EMRTD(char *documentnumber, char *dob, char *expiry, bool BAC_available);
|
2020-12-19 07:19:11 +08:00
|
|
|
int infoHF_EMRTD_offline(const char *path);
|
2020-12-06 08:22:20 +08:00
|
|
|
#endif
|