From b37e5990aa409689e5d6162776583616ac03e0ac Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Mon, 25 Jul 2016 18:32:59 +0200 Subject: Enabling password safe and password safe status (latter not working yet) Signed-off-by: Szczepan Zalega --- include/NitrokeyManager.h | 4 ++++ include/stick10_commands.h | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) (limited to 'include') diff --git a/include/NitrokeyManager.h b/include/NitrokeyManager.h index a3399fa..6f4ab75 100644 --- a/include/NitrokeyManager.h +++ b/include/NitrokeyManager.h @@ -40,6 +40,10 @@ namespace nitrokey { void change_user_PIN(char *current_PIN, char *new_PIN); void change_admin_PIN(char *current_PIN, char *new_PIN); + void enable_password_safe(const char *user_pin); + + void get_password_safe_slot_status(); + private: NitrokeyManager(); ~NitrokeyManager(); diff --git a/include/stick10_commands.h b/include/stick10_commands.h index d923d93..c8eda03 100644 --- a/include/stick10_commands.h +++ b/include/stick10_commands.h @@ -340,12 +340,28 @@ class GetUserPasswordRetryCount CommandTransaction; }; + template + void write_array(T &ss, Q (&arr)[N]){ + ss << std::hex << std::setfill('0') << std::setw(2); + for (int i=0; i { public: struct ResponsePayload { uint8_t password_safe_status[PWS_SLOT_COUNT]; bool isValid() const { return true; } + std::string dissect() const { + std::stringstream ss; + ss << "password_safe_status\t"; + write_array(ss, password_safe_status); + return ss.str(); + } } __packed; typedef Transaction -- cgit v1.2.1