aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NitrokeyManager.cc2
-rw-r--r--include/stick10_commands.h23
2 files changed, 22 insertions, 3 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc
index e0f5fa3..d453f7b 100644
--- a/NitrokeyManager.cc
+++ b/NitrokeyManager.cc
@@ -215,7 +215,7 @@ namespace nitrokey{
void NitrokeyManager::enable_password_safe(const char *user_pin) {
auto p = get_payload<EnablePasswordSafe>();
- strcpyT(p.password, user_pin);
+ strcpyT(p.user_password, user_pin);
EnablePasswordSafe::CommandTransaction::run(*device, p);
}
diff --git a/include/stick10_commands.h b/include/stick10_commands.h
index 92bddd5..c3b0a37 100644
--- a/include/stick10_commands.h
+++ b/include/stick10_commands.h
@@ -462,6 +462,13 @@ class SetPasswordSafeSlotData : Command<CommandID::SET_PW_SAFE_SLOT_DATA_1> {
uint8_t slot_password[PWS_PASSWORD_LENGTH];
bool isValid() const { return !(slot_number & 0xF0); }
+ std::string dissect() const {
+ std::stringstream ss;
+ ss << " slot_number\t" << (int)slot_number << std::endl;
+ ss << " slot_name\t" << (char*)slot_name << std::endl;
+ ss << " slot_password\t" << (char*)slot_password << std::endl;
+ return ss.str();
+ }
} __packed;
typedef Transaction<command_id(), struct CommandPayload, struct EmptyPayload>
@@ -475,6 +482,12 @@ class SetPasswordSafeSlotData2 : Command<CommandID::SET_PW_SAFE_SLOT_DATA_2> {
uint8_t slot_name[PWS_SLOTNAME_LENGTH];
bool isValid() const { return !(slot_number & 0xF0); }
+ std::string dissect() const {
+ std::stringstream ss;
+ ss << " slot_number\t" << (int)slot_number << std::endl;
+ ss << " slot_name\t" << (char*)slot_name << std::endl;
+ return ss.str();
+ }
} __packed;
typedef Transaction<command_id(), struct CommandPayload, struct EmptyPayload>
@@ -487,6 +500,12 @@ class ErasePasswordSafeSlot : Command<CommandID::PW_SAFE_ERASE_SLOT> {
uint8_t slot_number;
bool isValid() const { return !(slot_number & 0xF0); }
+ std::string dissect() const {
+ std::stringstream ss;
+ ss << " slot_number\t" << (int)slot_number << std::endl;
+ return ss.str();
+ }
+
} __packed;
typedef Transaction<command_id(), struct CommandPayload, struct EmptyPayload>
@@ -496,12 +515,12 @@ class ErasePasswordSafeSlot : Command<CommandID::PW_SAFE_ERASE_SLOT> {
class EnablePasswordSafe : Command<CommandID::PW_SAFE_ENABLE> {
public:
struct CommandPayload {
- uint8_t password[30];
+ uint8_t user_password[30];
bool isValid() const { return true; }
std::string dissect() const {
std::stringstream ss;
- ss << " password\t" << password << std::endl;
+ ss << " user_password\t" << (char*) user_password << std::endl;
return ss.str();
}
} __packed;