aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/utils/encrypt_file.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--utils/encrypt_file.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/utils/encrypt_file.cpp b/utils/encrypt_file.cpp
index 9a4ee5c..007ed18 100644
--- a/utils/encrypt_file.cpp
+++ b/utils/encrypt_file.cpp
@@ -30,27 +30,24 @@ namespace
void encrypt_file(const Settings& settings)
{
- const auto algorithm = settings.get_algorithm();
- const auto mode = settings.get_mode();
-
- const auto& plaintext_path = settings.get_input_path();
- const auto& ciphertext_path = settings.get_output_path();
+ const auto& algorithm = settings.algorithm;
+ const auto& mode = settings.mode;
aes::Box::Key key;
- aes::Box::parse_key(key, algorithm, settings.get_key_string());
+ aes::Box::parse_key(key, algorithm, settings.key);
- if (aes::mode_requires_initialization_vector(mode))
+ if (aes::mode_requires_init_vector(mode))
{
aes::Box::Block iv;
- aes::Box::parse_block(iv, algorithm, settings.get_iv_string());
- aes::Box box{algorithm, key, mode, iv};
+ aes::Box::parse_block(iv, algorithm, settings.iv);
- encrypt_file(box, plaintext_path, ciphertext_path);
+ aes::Box box{algorithm, key, mode, iv};
+ encrypt_file(box, settings.input_path, settings.output_path);
}
else
{
aes::Box box{algorithm, key};
- encrypt_file(box, plaintext_path, ciphertext_path);
+ encrypt_file(box, settings.input_path, settings.output_path);
}
}
}
@@ -59,11 +56,10 @@ int main(int argc, char** argv)
{
try
{
- CommandLineParser cmd_parser(argv[0]);
+ CommandLineParser cmd_parser{argv[0]};
try
{
- Settings settings;
- cmd_parser.parse(settings, argc, argv);
+ const auto settings = cmd_parser.parse(argc, argv);
if (cmd_parser.exit_with_usage())
{