summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-11-12 18:34:23 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2016-12-03 16:01:49 +0100
commitd28794ef7d6d6fa7e8d6478fb912302691fe75e7 (patch)
tree635448e1c6983da76655fe4d522dfd4975d79cad
parent3ab15750995624222fa32927fee7f9b1598ba3bf (diff)
downloadlibnitrokey-d28794ef7d6d6fa7e8d6478fb912302691fe75e7.tar.gz
libnitrokey-d28794ef7d6d6fa7e8d6478fb912302691fe75e7.tar.bz2
Add test for STATUS_AES_DEC_FAILED error
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r--unittest/test_pro.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/unittest/test_pro.py b/unittest/test_pro.py
index c7772d6..5c8ecb4 100644
--- a/unittest/test_pro.py
+++ b/unittest/test_pro.py
@@ -74,6 +74,14 @@ def test_regenerate_aes_key(C):
assert C.NK_build_aes_key(DefaultPasswords.ADMIN) == DeviceErrorCode.STATUS_OK
assert C.NK_enable_password_safe(DefaultPasswords.USER) == DeviceErrorCode.STATUS_OK
+def test_enable_password_safe_after_factory_reset(C):
+ assert C.NK_lock_device() == DeviceErrorCode.STATUS_OK
+ assert C.NK_factory_reset(DefaultPasswords.ADMIN) == DeviceErrorCode.STATUS_OK
+ wait(10)
+ assert C.NK_enable_password_safe(DefaultPasswords.USER) == DeviceErrorCode.STATUS_AES_DEC_FAILED
+ assert C.NK_build_aes_key(DefaultPasswords.ADMIN) == DeviceErrorCode.STATUS_OK
+ assert C.NK_enable_password_safe(DefaultPasswords.USER) == DeviceErrorCode.STATUS_OK
+
@pytest.mark.xfail(reason="NK Pro firmware bug: regenerating AES key command not always results in cleared slot data")
def test_destroy_password_safe(C):
@@ -96,6 +104,7 @@ def test_destroy_password_safe(C):
assert C.NK_first_authenticate(DefaultPasswords.ADMIN, DefaultPasswords.ADMIN_TEMP) == DeviceErrorCode.STATUS_OK
assert C.NK_build_aes_key(DefaultPasswords.ADMIN) == DeviceErrorCode.STATUS_OK
+ assert C.NK_lock_device() == DeviceErrorCode.STATUS_OK
assert C.NK_enable_password_safe(DefaultPasswords.USER) == DeviceErrorCode.STATUS_OK
assert gs(C.NK_get_password_safe_slot_name(0)) != 'slotname1'