From b0412c73b8ff129183f570a4eed72bdafd9f55d3 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Tue, 25 Oct 2016 18:41:59 +0200 Subject: Handle FillSDCardWithRandomChars command and test it Signed-off-by: Szczepan Zalega --- include/stick20_commands.h | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/stick20_commands.h b/include/stick20_commands.h index 5679681..a335809 100644 --- a/include/stick20_commands.h +++ b/include/stick20_commands.h @@ -139,7 +139,43 @@ namespace nitrokey { CommandTransaction; }; - class FillSDCardWithRandomChars : public PasswordCommand {}; +// class FillSDCardWithRandomChars : public PasswordCommand {}; + + + class FillSDCardWithRandomChars : Command { + public: + enum class ChosenVolumes : uint8_t { + all_volumes = 0, + encrypted_volume = 1 + }; + + struct CommandPayload { + uint8_t volume_flag; + uint8_t kind; + uint8_t password[20]; + + std::string dissect() const { + std::stringstream ss; + print_to_ss( (int) volume_flag ); + print_to_ss( kind ); + print_to_ss(password); + return ss.str(); + } + void set_kind_user() { + kind = (uint8_t) 'P'; + } + void set_defaults(){ + set_kind_user(); + volume_flag = static_cast(ChosenVolumes::encrypted_volume); + } + + } __packed; + + typedef Transaction::command_id(), + struct CommandPayload, struct EmptyPayload> + CommandTransaction; + }; + class SetupHiddenVolume : Command { public: -- cgit v1.2.3