aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-07-25 18:32:59 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-08-01 13:54:57 +0200
commitb37e5990aa409689e5d6162776583616ac03e0ac (patch)
treeefb9585d220fa737aab90a35541b76bddfb6a09d /include
parent689f38b7a4bbb823b8d43bab8357a32558d3775c (diff)
downloadlibnitrokey-b37e5990aa409689e5d6162776583616ac03e0ac.tar.gz
libnitrokey-b37e5990aa409689e5d6162776583616ac03e0ac.tar.bz2
Enabling password safe and password safe status (latter not working yet)
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'include')
-rw-r--r--include/NitrokeyManager.h4
-rw-r--r--include/stick10_commands.h16
2 files changed, 20 insertions, 0 deletions
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 <typename T, typename Q, int N>
+ void write_array(T &ss, Q (&arr)[N]){
+ ss << std::hex << std::setfill('0') << std::setw(2);
+ for (int i=0; i<N; i++){
+ ss << arr[i] << " ";
+ }
+ ss << std::endl;
+ };
+
+
class GetPasswordSafeSlotStatus : Command<CommandID::GET_PW_SAFE_SLOT_STATUS> {
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<command_id(), struct EmptyPayload, struct ResponsePayload>