mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-06-13 19:43:34 -07:00
MRTD reread with auth
This commit is contained in:
@@ -2,9 +2,11 @@
|
||||
|
||||
#define TAG "PassportAuth"
|
||||
|
||||
#define MRTD_AUTH_METHOD_COUNT 2
|
||||
// Indexes must match MrtdAuthMethod (lib/nfc/protocols/mrtd.h)
|
||||
#define MRTD_AUTH_METHOD_COUNT 4
|
||||
// Indexes must match MrtdAuthMethod (lib/nfc/protocols/mrtd_helpers.h)
|
||||
const char* const mrtd_auth_method_text[MRTD_AUTH_METHOD_COUNT] = {
|
||||
"None",
|
||||
"Any",
|
||||
"BAC",
|
||||
"PACE",
|
||||
};
|
||||
@@ -77,6 +79,9 @@ void nfc_scene_passport_auth_on_enter(void* context) {
|
||||
nfc);
|
||||
|
||||
value_index = nfc->dev->dev_data.mrtd_data.auth.method;
|
||||
if(value_index == MrtdAuthMethodNone) {
|
||||
value_index = MrtdAuthMethodAny;
|
||||
}
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
variable_item_set_current_value_text(item, mrtd_auth_method_text[value_index]);
|
||||
|
||||
@@ -114,6 +119,9 @@ bool nfc_scene_passport_auth_on_event(void* context, SceneManagerEvent event) {
|
||||
case NfcScenePassportAuthSelectAuth:
|
||||
if(nfc->dev->dev_data.mrtd_data.auth.method == MrtdAuthMethodPace) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcScenePassportPaceTodo);
|
||||
} else {
|
||||
nfc_device_clear(nfc->dev);
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneRead);
|
||||
}
|
||||
consumed = true;
|
||||
break;
|
||||
|
||||
@@ -277,7 +277,22 @@ void mrtd_test(MrtdApplication* app, MrtdData* mrtd_data) {
|
||||
mrtd_data->auth.expiry_date = (MrtdDate){.year=94, .month=6, .day=23};
|
||||
memcpy(mrtd_data->auth.doc_number, "L898902C<", 9);
|
||||
*/
|
||||
mrtd_bac(app, &mrtd_data->auth);
|
||||
|
||||
MrtdAuthMethod method = mrtd_data->auth.method;
|
||||
FURI_LOG_D(TAG, "Auth method: %d", method);
|
||||
switch(method) {
|
||||
case MrtdAuthMethodAny:
|
||||
//TODO: try PACE, then BAC
|
||||
case MrtdAuthMethodBac:
|
||||
mrtd_bac(app, &mrtd_data->auth);
|
||||
break;
|
||||
case MrtdAuthMethodPace:
|
||||
FURI_LOG_E(TAG, "Auth method PACE not implemented");
|
||||
break;
|
||||
case MrtdAuthMethodNone:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MrtdApplication* mrtd_alloc_init(FuriHalNfcTxRxContext* tx_rx) {
|
||||
|
||||
@@ -15,6 +15,8 @@ typedef struct {
|
||||
#define MRTD_DOCNR_MAX_LENGTH 21
|
||||
|
||||
typedef enum {
|
||||
MrtdAuthMethodNone,
|
||||
MrtdAuthMethodAny,
|
||||
MrtdAuthMethodBac,
|
||||
MrtdAuthMethodPace,
|
||||
} MrtdAuthMethod;
|
||||
|
||||
Reference in New Issue
Block a user