aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nitrocli/CHANGELOG.md1
-rw-r--r--nitrocli/README.md2
-rw-r--r--nitrocli/doc/nitrocli.14
-rw-r--r--nitrocli/doc/nitrocli.1.pdfbin18095 -> 18095 bytes
-rw-r--r--nitrocli/src/args.rs26
-rw-r--r--nitrocli/src/commands.rs4
-rw-r--r--nitrocli/src/tests/encrypted.rs (renamed from nitrocli/src/tests/storage.rs)12
-rw-r--r--nitrocli/src/tests/lock.rs2
-rw-r--r--nitrocli/src/tests/mod.rs2
9 files changed, 27 insertions, 26 deletions
diff --git a/nitrocli/CHANGELOG.md b/nitrocli/CHANGELOG.md
index 2840f29..716ebc6 100644
--- a/nitrocli/CHANGELOG.md
+++ b/nitrocli/CHANGELOG.md
@@ -1,6 +1,7 @@
Unreleased
----------
- Changed `storage hidden` subcommand to `hidden` top-level command
+- Renamed `storage` command to `encrypted`
- Removed `storage status` subcommand
- Moved its output into `status` command
diff --git a/nitrocli/README.md b/nitrocli/README.md
index b93119a..0a30696 100644
--- a/nitrocli/README.md
+++ b/nitrocli/README.md
@@ -18,7 +18,7 @@ The following commands are currently supported:
- config: Access the Nitrokey's configuration
- get: Read the current configuration.
- set: Change the configuration.
-- storage: Work with the Nitrokey Storage's storage.
+- encrypted: Work with the Nitrokey Storage's encrypted volume.
- open: Open the encrypted volume. The user PIN needs to be entered.
- close: Close the encrypted volume.
- hidden: Work with the Nitrokey Storage's hidden volume.
diff --git a/nitrocli/doc/nitrocli.1 b/nitrocli/doc/nitrocli.1
index 3c5406d..3c1e1e4 100644
--- a/nitrocli/doc/nitrocli.1
+++ b/nitrocli/doc/nitrocli.1
@@ -63,12 +63,12 @@ this overlay (which is required to achieve plausible deniability of the
existence of hidden volumes), the burden of ensuring that data on the encrypted
volume does not overlap with data on one of the hidden volumes is on the user.
.TP
-\fBnitrocli storage open
+\fBnitrocli encrypted open
Open the encrypted volume on the Nitrokey Storage.
The user PIN that is required to open the volume is queried using
\fBpinentry\fR(1) and cached by \fBgpg\-agent\fR(1).
.TP
-\fBnitrocli storage close
+\fBnitrocli encrypted close
Close the encrypted volume on the Nitrokey Storage.
.TP
\fBnitrocli hidden create \fIslot\fR \fIstart\fR \fIend\fR
diff --git a/nitrocli/doc/nitrocli.1.pdf b/nitrocli/doc/nitrocli.1.pdf
index 81abc31..0384072 100644
--- a/nitrocli/doc/nitrocli.1.pdf
+++ b/nitrocli/doc/nitrocli.1.pdf
Binary files differ
diff --git a/nitrocli/src/args.rs b/nitrocli/src/args.rs
index c37e5d2..c043938 100644
--- a/nitrocli/src/args.rs
+++ b/nitrocli/src/args.rs
@@ -121,6 +121,7 @@ impl From<DeviceModel> for nitrokey::Model {
#[allow(unused_doc_comments)]
Enum! {Command, [
Config => ("config", config),
+ Encrypted => ("encrypted", encrypted),
Hidden => ("hidden", hidden),
Lock => ("lock", lock),
Otp => ("otp", otp),
@@ -128,7 +129,6 @@ Enum! {Command, [
Pws => ("pws", pws),
Reset => ("reset", reset),
Status => ("status", status),
- Storage => ("storage", storage),
]}
Enum! {ConfigCommand, [
@@ -247,18 +247,18 @@ fn reset(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
commands::reset(ctx)
}
-Enum! {StorageCommand, [
- Close => ("close", storage_close),
- Open => ("open", storage_open),
+Enum! {EncryptedCommand, [
+ Close => ("close", encrypted_close),
+ Open => ("open", encrypted_open),
]}
-/// Execute a storage subcommand.
-fn storage(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
- let mut subcommand = StorageCommand::Open;
+/// Execute an encrypted subcommand.
+fn encrypted(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
+ let mut subcommand = EncryptedCommand::Open;
let help = cmd_help!(subcommand);
let mut subargs = vec![];
let mut parser = argparse::ArgumentParser::new();
- parser.set_description("Interacts with the device's storage");
+ parser.set_description("Interacts with the device's encrypted volume");
let _ =
parser
.refer(&mut subcommand)
@@ -272,26 +272,26 @@ fn storage(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
parser.stop_on_first_argument(true);
parse(ctx, parser, args)?;
- subargs.insert(0, format!("nitrocli {} {}", Command::Storage, subcommand));
+ subargs.insert(0, format!("nitrocli {}", subcommand));
subcommand.execute(ctx, subargs)
}
/// Open the encrypted volume on the nitrokey.
-fn storage_open(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
+fn encrypted_open(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
let mut parser = argparse::ArgumentParser::new();
parser.set_description("Opens the encrypted volume on a Nitrokey Storage");
parse(ctx, parser, args)?;
- commands::storage_open(ctx)
+ commands::encrypted_open(ctx)
}
/// Close the previously opened encrypted volume.
-fn storage_close(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
+fn encrypted_close(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
let mut parser = argparse::ArgumentParser::new();
parser.set_description("Closes the encrypted volume on a Nitrokey Storage");
parse(ctx, parser, args)?;
- commands::storage_close(ctx)
+ commands::encrypted_close(ctx)
}
Enum! {HiddenCommand, [
diff --git a/nitrocli/src/commands.rs b/nitrocli/src/commands.rs
index 6374611..0d30bca 100644
--- a/nitrocli/src/commands.rs
+++ b/nitrocli/src/commands.rs
@@ -362,7 +362,7 @@ pub fn reset(ctx: &mut args::ExecCtx<'_>) -> Result<()> {
}
/// Open the encrypted volume on the nitrokey.
-pub fn storage_open(ctx: &mut args::ExecCtx<'_>) -> Result<()> {
+pub fn encrypted_open(ctx: &mut args::ExecCtx<'_>) -> Result<()> {
let device = get_storage_device(ctx)?;
let pin_entry = pinentry::PinEntry::from(pinentry::PinType::User, &device)?;
@@ -376,7 +376,7 @@ pub fn storage_open(ctx: &mut args::ExecCtx<'_>) -> Result<()> {
}
/// Close the previously opened encrypted volume.
-pub fn storage_close(ctx: &mut args::ExecCtx<'_>) -> Result<()> {
+pub fn encrypted_close(ctx: &mut args::ExecCtx<'_>) -> Result<()> {
// Flush all filesystem caches to disk. We are mostly interested in
// making sure that the encrypted volume on the nitrokey we are
// about to close is not closed while not all data was written to
diff --git a/nitrocli/src/tests/storage.rs b/nitrocli/src/tests/encrypted.rs
index a1c6ecf..8aef864 100644
--- a/nitrocli/src/tests/storage.rs
+++ b/nitrocli/src/tests/encrypted.rs
@@ -1,4 +1,4 @@
-// storage.rs
+// encrypted.rs
// *************************************************************************
// * Copyright (C) 2019 Daniel Mueller (deso@posteo.net) *
@@ -48,11 +48,11 @@ $"#,
let out = ncli.handle(&["status"])?;
assert!(make_re(None).is_match(&out), out);
- let _ = ncli.handle(&["storage", "open"])?;
+ let _ = ncli.handle(&["encrypted", "open"])?;
let out = ncli.handle(&["status"])?;
assert!(make_re(Some(true)).is_match(&out), out);
- let _ = ncli.handle(&["storage", "close"])?;
+ let _ = ncli.handle(&["encrypted", "close"])?;
let out = ncli.handle(&["status"])?;
assert!(make_re(Some(false)).is_match(&out), out);
@@ -61,7 +61,7 @@ $"#,
#[test_device]
fn encrypted_open_on_pro(device: nitrokey::Pro) {
- let res = Nitrocli::with_dev(device).handle(&["storage", "open"]);
+ let res = Nitrocli::with_dev(device).handle(&["encrypted", "open"]);
assert_eq!(
res.unwrap_str_err(),
"This command is only available on the Nitrokey Storage",
@@ -71,7 +71,7 @@ fn encrypted_open_on_pro(device: nitrokey::Pro) {
#[test_device]
fn encrypted_open_close(device: nitrokey::Storage) -> crate::Result<()> {
let mut ncli = Nitrocli::with_dev(device);
- let out = ncli.handle(&["storage", "open"])?;
+ let out = ncli.handle(&["encrypted", "open"])?;
assert!(out.is_empty());
let device = nitrokey::Storage::connect()?;
@@ -79,7 +79,7 @@ fn encrypted_open_close(device: nitrokey::Storage) -> crate::Result<()> {
assert!(!device.get_status()?.hidden_volume.active);
drop(device);
- let out = ncli.handle(&["storage", "close"])?;
+ let out = ncli.handle(&["encrypted", "close"])?;
assert!(out.is_empty());
let device = nitrokey::Storage::connect()?;
diff --git a/nitrocli/src/tests/lock.rs b/nitrocli/src/tests/lock.rs
index 1993350..d23d2ae 100644
--- a/nitrocli/src/tests/lock.rs
+++ b/nitrocli/src/tests/lock.rs
@@ -31,7 +31,7 @@ fn lock_pro(device: nitrokey::Pro) -> crate::Result<()> {
#[test_device]
fn lock_storage(device: nitrokey::Storage) -> crate::Result<()> {
let mut ncli = Nitrocli::with_dev(device);
- let _ = ncli.handle(&["storage", "open"])?;
+ let _ = ncli.handle(&["encrypted", "open"])?;
let out = ncli.handle(&["lock"])?;
assert!(out.is_empty());
diff --git a/nitrocli/src/tests/mod.rs b/nitrocli/src/tests/mod.rs
index 2d6f93c..70a3d20 100644
--- a/nitrocli/src/tests/mod.rs
+++ b/nitrocli/src/tests/mod.rs
@@ -37,6 +37,7 @@ const NITROKEY_DEFAULT_USER_PIN: &str = "123456";
fn dummy() {}
mod config;
+mod encrypted;
mod hidden;
mod lock;
mod otp;
@@ -45,7 +46,6 @@ mod pws;
mod reset;
mod run;
mod status;
-mod storage;
/// A trait simplifying checking for expected errors.
pub trait UnwrapError {