aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2019-06-25 09:21:16 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2019-06-25 09:21:16 +0200
commit0cf995e79221fa2e88801fb910eba8aacf54d58a (patch)
tree06f27a1a65f9a43b6cfba9a5e5fffdb4ae3b9e72
parentb1b851658ab720462f0c5b46d9cc7661be6cf493 (diff)
downloadlibnitrokey-master.tar.gz
libnitrokey-master.tar.bz2
Add numbers to generated OTP slot namesHEADmaster
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r--unittest/test_pro.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/unittest/test_pro.py b/unittest/test_pro.py
index 5162365..a8df7cd 100644
--- a/unittest/test_pro.py
+++ b/unittest/test_pro.py
@@ -434,7 +434,8 @@ def test_HOTP_64bit_counter(C):
def helper_set_HOTP_test_slot(C, slot_number):
assert C.NK_first_authenticate(DefaultPasswords.ADMIN, DefaultPasswords.ADMIN_TEMP) == DeviceErrorCode.STATUS_OK
- assert C.NK_write_hotp_slot(slot_number, b'python_test', bbRFC_SECRET, 0, False, False, True, b'', DefaultPasswords.ADMIN_TEMP) == DeviceErrorCode.STATUS_OK
+ slot_name = b'HOTP_test'[:-2] + '{:02}'.format(slot_number).encode()
+ assert C.NK_write_hotp_slot(slot_number, slot_name, bbRFC_SECRET, 0, False, False, True, b'', DefaultPasswords.ADMIN_TEMP) == DeviceErrorCode.STATUS_OK
def helper_set_TOTP_test_slot(C, slot_number):
@@ -443,7 +444,8 @@ def helper_set_TOTP_test_slot(C, slot_number):
assert C.NK_write_config(255, 255, 255, PIN_protection, not PIN_protection,
DefaultPasswords.ADMIN_TEMP) == DeviceErrorCode.STATUS_OK
assert C.NK_first_authenticate(DefaultPasswords.ADMIN, DefaultPasswords.ADMIN_TEMP) == DeviceErrorCode.STATUS_OK
- assert C.NK_write_totp_slot(slot_number, b'python_test', bbRFC_SECRET, 30, False, False, False, b'',
+ slot_name = b'TOTP_test'[:-2] + '{:02}'.format(slot_number).encode()
+ assert C.NK_write_totp_slot(slot_number, slot_name, bbRFC_SECRET, 30, False, False, False, b'',
DefaultPasswords.ADMIN_TEMP) == DeviceErrorCode.STATUS_OK