From f5b5339a0cd272b3be33013f01e14f5bcc6e5aa8 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Tue, 26 Jul 2016 23:35:24 +0200 Subject: Erasing slot - initial version with some authorization issues Signed-off-by: Szczepan Zalega --- include/NitrokeyManager.h | 10 ++++++---- include/stick10_commands.h | 6 ++++++ 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/NitrokeyManager.h b/include/NitrokeyManager.h index 00011e2..e6e79c7 100644 --- a/include/NitrokeyManager.h +++ b/include/NitrokeyManager.h @@ -17,7 +17,7 @@ namespace nitrokey { public: static NitrokeyManager *instance(); - bool authorize(const char *pin, const char *temporary_password); + bool first_authenticate(const char *pin, const char *temporary_password); bool write_HOTP_slot(uint8_t slot_number, const char *slot_name, const char *secret, uint64_t hotp_counter, const char *temporary_password); bool write_TOTP_slot(uint8_t slot_number, const char *slot_name, const char *secret, @@ -27,8 +27,8 @@ namespace nitrokey { uint8_t last_interval); bool set_time(uint64_t time); bool get_time(); - bool erase_totp_slot(uint8_t slot_number); - bool erase_hotp_slot(uint8_t slot_number); + bool erase_totp_slot(uint8_t slot_number, const char *temporary_password); + bool erase_hotp_slot(uint8_t slot_number, const char *temporary_password); bool connect(); bool disconnect(); void set_debug(bool state); @@ -59,6 +59,8 @@ namespace nitrokey { void erase_password_safe_slot(uint8_t slot_number); + void user_authenticate(const char *user_password, const char *temporary_password); + private: NitrokeyManager(); ~NitrokeyManager(); @@ -72,7 +74,7 @@ namespace nitrokey { bool is_valid_password_safe_slot_number(uint8_t slot_number) const; uint8_t get_internal_slot_number_for_hotp(uint8_t slot_number) const; uint8_t get_internal_slot_number_for_totp(uint8_t slot_number) const; - bool erase_slot(uint8_t slot_number); + bool erase_slot(uint8_t slot_number, const char *temporary_password); uint8_t *get_slot_name(uint8_t slot_number) const; }; diff --git a/include/stick10_commands.h b/include/stick10_commands.h index d88c36b..fbd0698 100644 --- a/include/stick10_commands.h +++ b/include/stick10_commands.h @@ -587,6 +587,12 @@ class UserAuthenticate : Command { uint8_t temporary_password[25]; bool isValid() const { return true; } + std::string dissect() const { + std::stringstream ss; + ss << "card_password:\t" << card_password << std::endl; + ss << "temporary_password:\t" << temporary_password << std::endl; + return ss.str(); + } } __packed; typedef Transaction -- cgit v1.2.1