aboutsummaryrefslogtreecommitdiff
path: root/NitrokeyManager.cc
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-10-14 15:00:04 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-10-19 16:34:34 +0200
commit801fcc59dbf04dfce4323d2a3cad99f9d643e525 (patch)
treee4a7abb7a904f9b8fadf2c5d9c1bd72d86159c2a /NitrokeyManager.cc
parentfa9f178a05f6fa0209411e7d91eb78d64dc0a3ca (diff)
downloadlibnitrokey-801fcc59dbf04dfce4323d2a3cad99f9d643e525.tar.gz
libnitrokey-801fcc59dbf04dfce4323d2a3cad99f9d643e525.tar.bz2
Support regenerating AES keys on NK Storage
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r--NitrokeyManager.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc
index 20657a5..47b68d4 100644
--- a/NitrokeyManager.cc
+++ b/NitrokeyManager.cc
@@ -396,9 +396,21 @@ namespace nitrokey{
}
void NitrokeyManager::build_aes_key(const char *admin_password) {
- auto p = get_payload<BuildAESKey>();
- strcpyT(p.admin_password, admin_password);
- BuildAESKey::CommandTransaction::run(*device, p);
+ switch (device->get_device_model()) {
+ case DeviceModel::PRO: {
+ auto p = get_payload<BuildAESKey>();
+ strcpyT(p.admin_password, admin_password);
+ BuildAESKey::CommandTransaction::run(*device, p);
+ break;
+ }
+ case DeviceModel::STORAGE : {
+ auto p = get_payload<stick20::CreateNewKeys>();
+ strcpyT(p.admin_password, admin_password);
+ p.setKindPrefixed();
+ stick20::CreateNewKeys::CommandTransaction::run(*device, p);
+ break;
+ }
+ }
}
void NitrokeyManager::factory_reset(const char *admin_password) {