aboutsummaryrefslogtreecommitdiff
path: root/unittest
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-10-28 14:33:25 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-11-26 18:56:25 +0100
commit3b1926164b2e0eb91cf3a7e9c854cca85f7d4c8e (patch)
tree55a4c529734b5d36f95e64239684a96975159138 /unittest
parente262c978f4cb8b448087102b68bbdcc731a090a0 (diff)
downloadlibnitrokey-3b1926164b2e0eb91cf3a7e9c854cca85f7d4c8e.tar.gz
libnitrokey-3b1926164b2e0eb91cf3a7e9c854cca85f7d4c8e.tar.bz2
Support for changing firmware update password and test
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'unittest')
-rw-r--r--unittest/test2.cc25
1 files changed, 24 insertions, 1 deletions
diff --git a/unittest/test2.cc b/unittest/test2.cc
index 21122ef..8db91b7 100644
--- a/unittest/test2.cc
+++ b/unittest/test2.cc
@@ -178,7 +178,30 @@ TEST_CASE("setup multiple hidden volumes", "[hidden2]") {
}
}
-TEST_CASE("general test", "[test]") {
+//in case of a bug this could change update PIN to some unexpected value
+// - please save log with packet dump if this test will not pass
+TEST_CASE("update password change", "[dangerous]") {
+ Stick20 stick;
+ bool connected = stick.connect();
+ REQUIRE(connected == true);
+ Log::instance().set_loglevel(Loglevel::DEBUG_L2);
+
+ auto pass1 = "12345678";
+ auto pass2 = "12345678901234567890";
+
+ auto data = {
+ make_pair(pass1, pass2),
+ make_pair(pass2, pass1),
+ };
+ for (auto && password: data) {
+ auto p = get_payload<stick20::ChangeUpdatePassword>();
+ strcpyT(p.current_update_password, password.first);
+ strcpyT(p.new_update_password, password.second);
+ stick20::ChangeUpdatePassword::CommandTransaction::run(stick, p);
+ }
+}
+
+ TEST_CASE("general test", "[test]") {
Stick20 stick;
bool connected = stick.connect();
REQUIRE(connected == true);