mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
MRTD add helper functions:
- Check digit - KMRZ
This commit is contained in:
37
lib/nfc/protocols/mrtd_helpers.h
Normal file
37
lib/nfc/protocols/mrtd_helpers.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct {
|
||||
uint8_t year;
|
||||
uint8_t month;
|
||||
uint8_t day;
|
||||
} MrtdDate;
|
||||
|
||||
// NULL terminated document ID
|
||||
#define MRTD_DOCNR_MAX_LENGTH 21
|
||||
|
||||
typedef enum {
|
||||
MrtdAuthMethodBac,
|
||||
MrtdAuthMethodPace,
|
||||
} MrtdAuthMethod;
|
||||
|
||||
typedef struct {
|
||||
MrtdAuthMethod method;
|
||||
|
||||
// BAC input fields
|
||||
MrtdDate birth_date;
|
||||
MrtdDate expiry_date;
|
||||
char doc_number[MRTD_DOCNR_MAX_LENGTH];
|
||||
|
||||
//TODO: PACE
|
||||
} MrtdAuthData;
|
||||
|
||||
uint8_t mrtd_bac_check_digit(const uint8_t* input, const size_t length);
|
||||
|
||||
void mrtd_print_date(uint8_t* output, MrtdDate* date);
|
||||
|
||||
bool mrtd_bac_get_kmrz(MrtdAuthData* auth, uint8_t* output, size_t output_size);
|
||||
Reference in New Issue
Block a user