aboutsummaryrefslogtreecommitdiff
path: root/unittest
diff options
context:
space:
mode:
Diffstat (limited to 'unittest')
-rw-r--r--unittest/test.cc2
-rw-r--r--unittest/test2.cc34
-rw-r--r--unittest/test3.cc24
-rw-r--r--unittest/test_HOTP.cc2
4 files changed, 31 insertions, 31 deletions
diff --git a/unittest/test.cc b/unittest/test.cc
index 46b6ae1..41cf545 100644
--- a/unittest/test.cc
+++ b/unittest/test.cc
@@ -8,7 +8,7 @@
using namespace std;
using namespace nitrokey::device;
-using namespace nitrokey::proto::stick10;
+using namespace nitrokey::proto::NKPro;
using namespace nitrokey::log;
using namespace nitrokey::misc;
diff --git a/unittest/test2.cc b/unittest/test2.cc
index 13e33a3..37d5983 100644
--- a/unittest/test2.cc
+++ b/unittest/test2.cc
@@ -15,7 +15,7 @@ static const char *const default_user_pin = "123456";
using namespace std;
using namespace nitrokey::device;
using namespace nitrokey::proto;
-using namespace nitrokey::proto::stick20;
+using namespace nitrokey::proto::NKStorage;
using namespace nitrokey::log;
using namespace nitrokey::misc;
@@ -67,7 +67,7 @@ TEST_CASE("long operation test", "[test_long]") {
for (int i = 0; i < 30; ++i) {
try {
- stick10::GetStatus::CommandTransaction::run(stick);
+ NKPro::GetStatus::CommandTransaction::run(stick);
}
catch (LongOperationInProgressException &progressException){
CHECK((int)progressException.progress_bar_value>=0);
@@ -128,18 +128,18 @@ TEST_CASE("test device internal status with various commands", "[fast]") {
REQUIRE(connected == true);
Log::instance().set_loglevel(Loglevel::DEBUG);
- auto p = get_payload<stick20::SendStartup>();
+ auto p = get_payload<NKStorage::SendStartup>();
p.set_defaults();
- auto device_status = stick20::SendStartup::CommandTransaction::run(stick, p);
+ auto device_status = NKStorage::SendStartup::CommandTransaction::run(stick, p);
REQUIRE(device_status.data().AdminPwRetryCount == 3);
REQUIRE(device_status.data().UserPwRetryCount == 3);
REQUIRE(device_status.data().ActiveSmartCardID_u32 != 0);
- auto production_status = stick20::ProductionTest::CommandTransaction::run(stick);
+ auto production_status = NKStorage::ProductionTest::CommandTransaction::run(stick);
REQUIRE(production_status.data().SD_Card_Size_u8 == 8);
REQUIRE(production_status.data().SD_CardID_u32 != 0);
- auto sdcard_occupancy = stick20::GetSDCardOccupancy::CommandTransaction::run(stick);
+ auto sdcard_occupancy = NKStorage::GetSDCardOccupancy::CommandTransaction::run(stick);
REQUIRE((int) sdcard_occupancy.data().ReadLevelMin >= 0);
REQUIRE((int) sdcard_occupancy.data().ReadLevelMax <= 100);
REQUIRE((int) sdcard_occupancy.data().WriteLevelMin >= 0);
@@ -151,19 +151,19 @@ TEST_CASE("setup hidden volume test", "[hidden]") {
bool connected = stick->connect();
REQUIRE(connected == true);
Log::instance().set_loglevel(Loglevel::DEBUG);
- stick10::LockDevice::CommandTransaction::run(stick);
+ NKPro::LockDevice::CommandTransaction::run(stick);
this_thread::sleep_for(2000ms);
auto user_pin = default_user_pin;
execute_password_command<EnableEncryptedPartition>(stick, user_pin);
- auto p = get_payload<stick20::SetupHiddenVolume>();
+ auto p = get_payload<NKStorage::SetupHiddenVolume>();
p.SlotNr_u8 = 0;
p.StartBlockPercent_u8 = 70;
p.EndBlockPercent_u8 = 90;
auto hidden_volume_password = "123123123";
strcpyT(p.HiddenVolumePassword_au8, hidden_volume_password);
- stick20::SetupHiddenVolume::CommandTransaction::run(stick, p);
+ NKStorage::SetupHiddenVolume::CommandTransaction::run(stick, p);
this_thread::sleep_for(2000ms);
execute_password_command<EnableHiddenEncryptedPartition>(stick, hidden_volume_password);
@@ -176,19 +176,19 @@ TEST_CASE("setup multiple hidden volumes", "[hidden]") {
Log::instance().set_loglevel(Loglevel::DEBUG);
auto user_pin = default_user_pin;
- stick10::LockDevice::CommandTransaction::run(stick);
+ NKPro::LockDevice::CommandTransaction::run(stick);
this_thread::sleep_for(2000ms);
execute_password_command<EnableEncryptedPartition>(stick, user_pin);
constexpr int volume_count = 4;
for (int i = 0; i < volume_count; ++i) {
- auto p = get_payload<stick20::SetupHiddenVolume>();
+ auto p = get_payload<NKStorage::SetupHiddenVolume>();
p.SlotNr_u8 = i;
p.StartBlockPercent_u8 = 20 + 10*i;
p.EndBlockPercent_u8 = p.StartBlockPercent_u8+i+1;
auto hidden_volume_password = std::string("123123123")+std::to_string(i);
strcpyT(p.HiddenVolumePassword_au8, hidden_volume_password.c_str());
- stick20::SetupHiddenVolume::CommandTransaction::run(stick, p);
+ NKStorage::SetupHiddenVolume::CommandTransaction::run(stick, p);
this_thread::sleep_for(2000ms);
}
@@ -220,10 +220,10 @@ TEST_CASE("update password change", "[dangerous]") {
make_pair(pass2, pass1),
};
for (auto && password: data) {
- auto p = get_payload<stick20::ChangeUpdatePassword>();
+ auto p = get_payload<NKStorage::ChangeUpdatePassword>();
strcpyT(p.current_update_password, password.first);
strcpyT(p.new_update_password, password.second);
- stick20::ChangeUpdatePassword::CommandTransaction::run(stick, p);
+ NKStorage::ChangeUpdatePassword::CommandTransaction::run(stick, p);
}
}
@@ -234,7 +234,7 @@ TEST_CASE("general test", "[test]") {
Log::instance().set_loglevel(Loglevel::DEBUG);
- stick10::LockDevice::CommandTransaction::run(stick);
+ NKPro::LockDevice::CommandTransaction::run(stick);
// execute_password_command<EnableEncryptedPartition>(stick, "123456");
// execute_password_command<DisableEncryptedPartition>(stick, "123456");
// execute_password_command<DisableHiddenEncryptedPartition>(stick, "123123123");
@@ -242,7 +242,7 @@ TEST_CASE("general test", "[test]") {
execute_password_command<SendSetReadonlyToUncryptedVolume>(stick, default_user_pin);
execute_password_command<SendSetReadwriteToUncryptedVolume>(stick, default_user_pin);
execute_password_command<SendClearNewSdCardFound>(stick, default_admin_pin, 'A');
- stick20::GetDeviceStatus::CommandTransaction::run(stick);
+ NKStorage::GetDeviceStatus::CommandTransaction::run(stick);
this_thread::sleep_for(1000ms);
// execute_password_command<LockFirmware>(stick, "123123123"); //CAUTION
// execute_password_command<EnableFirmwareUpdate>(stick, "123123123"); //CAUTION FIRMWARE PIN
@@ -250,5 +250,5 @@ TEST_CASE("general test", "[test]") {
execute_password_command<ExportFirmware>(stick, "12345678", 'A');
// execute_password_command<FillSDCardWithRandomChars>(stick, "12345678", 'A');
- stick10::LockDevice::CommandTransaction::run(stick);
+ NKPro::LockDevice::CommandTransaction::run(stick);
}
diff --git a/unittest/test3.cc b/unittest/test3.cc
index 9e0ef11..65680ad 100644
--- a/unittest/test3.cc
+++ b/unittest/test3.cc
@@ -11,13 +11,13 @@ const char * RFC_SECRET = "12345678901234567890";
#include <NitrokeyManager.h>
#include "device_proto.h"
#include "log.h"
-#include "stick10_commands_0.8.h"
-//#include "stick20_commands.h"
+#include "NKPro_commands_0.8.h"
+//#include "NKStorage_commands.h"
using namespace std;
using namespace nitrokey::device;
using namespace nitrokey::proto;
-using namespace nitrokey::proto::stick10_08;
+using namespace nitrokey::proto::NKPro_08;
using namespace nitrokey::log;
using namespace nitrokey::misc;
@@ -52,20 +52,20 @@ TEST_CASE("write slot", "[pronew]"){
strcpyT(p2.temporary_admin_password, temporary_password);
p2.setTypeName();
strcpyT(p2.data, "test name aaa");
- stick10_08::SendOTPData::CommandTransaction::run(stick, p2);
+ NKPro_08::SendOTPData::CommandTransaction::run(stick, p2);
p2 = get_payload<SendOTPData>();
strcpyT(p2.temporary_admin_password, temporary_password);
strcpyT(p2.data, RFC_SECRET);
p2.setTypeSecret();
- stick10_08::SendOTPData::CommandTransaction::run(stick, p2);
+ NKPro_08::SendOTPData::CommandTransaction::run(stick, p2);
auto p = get_payload<WriteToOTPSlot>();
strcpyT(p.temporary_admin_password, temporary_password);
p.use_8_digits = true;
p.slot_number = 0 + 0x10;
p.slot_counter_or_interval = 0;
- stick10_08::WriteToOTPSlot::CommandTransaction::run(stick, p);
+ NKPro_08::WriteToOTPSlot::CommandTransaction::run(stick, p);
auto pc = get_payload<WriteGeneralConfig>();
pc.enable_user_password = 0;
@@ -135,20 +135,20 @@ TEST_CASE("authorize user HOTP", "[pronew]") {
strcpyT(p2.temporary_admin_password, temporary_password);
p2.setTypeName();
strcpyT(p2.data, "test name aaa");
- stick10_08::SendOTPData::CommandTransaction::run(stick, p2);
+ NKPro_08::SendOTPData::CommandTransaction::run(stick, p2);
p2 = get_payload<SendOTPData>();
strcpyT(p2.temporary_admin_password, temporary_password);
strcpyT(p2.data, RFC_SECRET);
p2.setTypeSecret();
- stick10_08::SendOTPData::CommandTransaction::run(stick, p2);
+ NKPro_08::SendOTPData::CommandTransaction::run(stick, p2);
auto p = get_payload<WriteToOTPSlot>();
strcpyT(p.temporary_admin_password, temporary_password);
p.use_8_digits = true;
p.slot_number = 0 + 0x10;
p.slot_counter_or_interval = 0;
- stick10_08::WriteToOTPSlot::CommandTransaction::run(stick, p);
+ NKPro_08::WriteToOTPSlot::CommandTransaction::run(stick, p);
auto p3 = get_payload<GetHOTP>();
@@ -186,20 +186,20 @@ TEST_CASE("authorize user TOTP", "[pronew]") {
strcpyT(p2.temporary_admin_password, temporary_password);
p2.setTypeName();
strcpyT(p2.data, "test name TOTP");
- stick10_08::SendOTPData::CommandTransaction::run(stick, p2);
+ NKPro_08::SendOTPData::CommandTransaction::run(stick, p2);
p2 = get_payload<SendOTPData>();
strcpyT(p2.temporary_admin_password, temporary_password);
strcpyT(p2.data, RFC_SECRET);
p2.setTypeSecret();
- stick10_08::SendOTPData::CommandTransaction::run(stick, p2);
+ NKPro_08::SendOTPData::CommandTransaction::run(stick, p2);
auto p = get_payload<WriteToOTPSlot>();
strcpyT(p.temporary_admin_password, temporary_password);
p.use_8_digits = true;
p.slot_number = 0 + 0x20;
p.slot_counter_or_interval = 30;
- stick10_08::WriteToOTPSlot::CommandTransaction::run(stick, p);
+ NKPro_08::WriteToOTPSlot::CommandTransaction::run(stick, p);
auto p_get_totp = get_payload<GetTOTP>();
p_get_totp.slot_number = 0 + 0x20;
diff --git a/unittest/test_HOTP.cc b/unittest/test_HOTP.cc
index a1301ab..7c905dc 100644
--- a/unittest/test_HOTP.cc
+++ b/unittest/test_HOTP.cc
@@ -8,7 +8,7 @@
using namespace std;
using namespace nitrokey::device;
-using namespace nitrokey::proto::stick10;
+using namespace nitrokey::proto::NKPro;
using namespace nitrokey::log;
using namespace nitrokey::misc;