aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-07-27 06:16:00 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-08-01 13:54:57 +0200
commit33344655d519b351d17d4f166dba406d1ab79e8e (patch)
tree54b4d3e303a502bc45947f5d90173efdc2176f1a /include
parentf5b5339a0cd272b3be33013f01e14f5bcc6e5aa8 (diff)
downloadlibnitrokey-33344655d519b351d17d4f166dba406d1ab79e8e.tar.gz
libnitrokey-33344655d519b351d17d4f166dba406d1ab79e8e.tar.bz2
Handle misc functions: factory reset, build aes key, unlock user password (not yet tested)
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'include')
-rw-r--r--include/NitrokeyManager.h6
-rw-r--r--include/stick10_commands.h21
2 files changed, 24 insertions, 3 deletions
diff --git a/include/NitrokeyManager.h b/include/NitrokeyManager.h
index e6e79c7..5bd253d 100644
--- a/include/NitrokeyManager.h
+++ b/include/NitrokeyManager.h
@@ -61,6 +61,12 @@ namespace nitrokey {
void user_authenticate(const char *user_password, const char *temporary_password);
+ void factory_reset(const char *admin_password);
+
+ void build_aes_key(const char *admin_password);
+
+ void unlock_user_password(const char *admin_password);
+
private:
NitrokeyManager();
~NitrokeyManager();
diff --git a/include/stick10_commands.h b/include/stick10_commands.h
index fbd0698..8dc1b22 100644
--- a/include/stick10_commands.h
+++ b/include/stick10_commands.h
@@ -637,7 +637,12 @@ class UserAuthorize : Command<CommandID::USER_AUTHORIZE> {
class UnlockUserPassword : Command<CommandID::UNLOCK_USER_PASSWORD> {
public:
struct CommandPayload {
- uint8_t admin_password[20]; // TODO
+ uint8_t admin_password[20];
+ std::string dissect() const {
+ std::stringstream ss;
+ ss << " admin_password:\t" << admin_password<< std::endl;
+ return ss.str();
+ }
} __packed;
// TODO could we get the stick to return the retry count?
@@ -700,7 +705,12 @@ class LockDevice : Command<CommandID::LOCK_DEVICE> {
class FactoryReset : Command<CommandID::FACTORY_RESET> {
public:
struct CommandPayload {
- uint8_t password[20];
+ uint8_t admin_password[20];
+ std::string dissect() const {
+ std::stringstream ss;
+ ss << " admin_password:\t" << admin_password<< std::endl;
+ return ss.str();
+ }
} __packed;
typedef Transaction<command_id(), struct CommandPayload, struct EmptyPayload>
@@ -710,7 +720,12 @@ class FactoryReset : Command<CommandID::FACTORY_RESET> {
class BuildAESKey : Command<CommandID::NEW_AES_KEY> {
public:
struct CommandPayload {
- uint8_t password[20];
+ uint8_t admin_password[20];
+ std::string dissect() const {
+ std::stringstream ss;
+ ss << " admin_password:\t" << admin_password<< std::endl;
+ return ss.str();
+ }
} __packed;
typedef Transaction<command_id(), struct CommandPayload, struct EmptyPayload>