aboutsummaryrefslogtreecommitdiff
path: root/NitrokeyManager.cc
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-07-26 12:23:26 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-08-01 13:54:57 +0200
commit32ed4100e098ae2930e6fd94800c6ce7041101c2 (patch)
tree5cd408f732d1b40ec1651dbcae35ffa0f4501206 /NitrokeyManager.cc
parent39b7c99bbd00c0bc4906939ceefb724a3d9ddc35 (diff)
downloadlibnitrokey-32ed4100e098ae2930e6fd94800c6ce7041101c2.tar.gz
libnitrokey-32ed4100e098ae2930e6fd94800c6ce7041101c2.tar.bz2
Working PW safe getting slot name
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r--NitrokeyManager.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc
index 15f09b8..8f5db6f 100644
--- a/NitrokeyManager.cc
+++ b/NitrokeyManager.cc
@@ -236,5 +236,31 @@ namespace nitrokey{
LockDevice::CommandTransaction::run(*device);
}
+ const char *NitrokeyManager::get_password_safe_slot_name(uint8_t slot_number, const char *temporary_password) {
+ auto p = get_payload<GetPasswordSafeSlotName>();
+ p.slot_number = slot_number;
+
+ auto auth = get_payload<UserAuthorize>();
+ strcpyT(auth.temporary_password, temporary_password);
+ auth.crc_to_authorize = GetPasswordSafeSlotName::CommandTransaction::getCRC(p);
+ UserAuthorize::CommandTransaction::run(*device, auth);
+
+ auto response = GetPasswordSafeSlotName::CommandTransaction::run(*device, p);
+ return strdup((const char *) response.slot_name);
+ }
+
+ const char *NitrokeyManager::get_password_safe_slot_login(uint8_t slot_number) {
+ auto p = get_payload<GetPasswordSafeSlotLogin>();
+ p.slot_number = slot_number;
+ auto response = GetPasswordSafeSlotLogin::CommandTransaction::run(*device, p);
+ return strdup((const char *) response.slot_login);
+ }
+
+ const char *NitrokeyManager::get_password_safe_slot_password(uint8_t slot_number) {
+ auto p = get_payload<GetPasswordSafeSlotPassword>();
+ p.slot_number = slot_number;
+ auto response = GetPasswordSafeSlotPassword::CommandTransaction::run(*device, p);
+ return strdup((const char *) response.slot_password);
+ }
} \ No newline at end of file