diff options
-rw-r--r-- | sq/src/commands/keyring.rs (renamed from sq/src/commands/certring.rs) | 28 | ||||
-rw-r--r-- | sq/src/commands/mod.rs | 2 | ||||
-rw-r--r-- | sq/src/sq-usage.rs | 65 | ||||
-rw-r--r-- | sq/src/sq.rs | 2 | ||||
-rw-r--r-- | sq/src/sq_cli.rs | 30 |
5 files changed, 65 insertions, 62 deletions
diff --git a/sq/src/commands/certring.rs b/sq/src/commands/keyring.rs index db8eb25c..5ebeb7aa 100644 --- a/sq/src/commands/certring.rs +++ b/sq/src/commands/keyring.rs @@ -166,7 +166,7 @@ pub fn dispatch(m: &clap::ArgMatches, force: bool) -> Result<()> { } } -/// Joins cert(ring)s into a certring, applying a filter. +/// Joins certificates and keyrings into a keyring, applying a filter. fn filter<F>(inputs: Option<clap::Values>, output: &mut dyn io::Write, mut filter: F) -> Result<()> @@ -176,28 +176,28 @@ fn filter<F>(inputs: Option<clap::Values>, output: &mut dyn io::Write, for name in inputs { for cert in CertParser::from_file(name)? { let cert = cert.context( - format!("Malformed certificate in certring {:?}", name))?; + format!("Malformed certificate in keyring {:?}", name))?; if let Some(cert) = filter(cert) { - cert.serialize(output)?; + cert.as_tsk().serialize(output)?; } } } } else { for cert in CertParser::from_reader(io::stdin())? { - let cert = cert.context("Malformed certificate in certring")?; + let cert = cert.context("Malformed certificate in keyring")?; if let Some(cert) = filter(cert) { - cert.serialize(output)?; + cert.as_tsk().serialize(output)?; } } } Ok(()) } -/// Lists certs in a certring. +/// Lists certs in a keyring. fn list(input: &mut (dyn io::Read + Sync + Send)) -> Result<()> { for (i, cert) in CertParser::from_reader(input)?.enumerate() { - let cert = cert.context("Malformed certificate in certring")?; + let cert = cert.context("Malformed certificate in keyring")?; print!("{}. {:X}", i, cert.fingerprint()); // Try to be more helpful by including the first userid in the // listing. @@ -211,11 +211,11 @@ fn list(input: &mut (dyn io::Read + Sync + Send)) Ok(()) } -/// Splits a certring into individual certs. +/// Splits a keyring into individual certs. fn split(input: &mut (dyn io::Read + Sync + Send), prefix: &str, binary: bool) -> Result<()> { for (i, cert) in CertParser::from_reader(input)?.enumerate() { - let cert = cert.context("Malformed certificate in certring")?; + let cert = cert.context("Malformed certificate in keyring")?; let filename = format!( "{}{}-{:X}", prefix, @@ -243,15 +243,15 @@ fn split(input: &mut (dyn io::Read + Sync + Send), prefix: &str, binary: bool) }; if binary { - cert.serialize(&mut sink)?; + cert.as_tsk().serialize(&mut sink)?; } else { - cert.armored().serialize(&mut sink)?; + cert.as_tsk().armored().serialize(&mut sink)?; } } Ok(()) } -/// Merge multiple certrings. +/// Merge multiple keyrings. fn merge(inputs: Option<clap::Values>, output: &mut dyn io::Write) -> Result<()> { @@ -261,7 +261,7 @@ fn merge(inputs: Option<clap::Values>, output: &mut dyn io::Write) for name in inputs { for cert in CertParser::from_file(name)? { let cert = cert.context( - format!("Malformed certificate in certring {:?}", name))?; + format!("Malformed certificate in keyring {:?}", name))?; match certs.entry(cert.fingerprint()) { e @ Entry::Vacant(_) => { e.or_insert(Some(cert)); @@ -277,7 +277,7 @@ fn merge(inputs: Option<clap::Values>, output: &mut dyn io::Write) } } else { for cert in CertParser::from_reader(io::stdin())? { - let cert = cert.context("Malformed certificate in certring")?; + let cert = cert.context("Malformed certificate in keyring")?; match certs.entry(cert.fingerprint()) { e @ Entry::Vacant(_) => { e.or_insert(Some(cert)); diff --git a/sq/src/commands/mod.rs b/sq/src/commands/mod.rs index 0150441b..7becf237 100644 --- a/sq/src/commands/mod.rs +++ b/sq/src/commands/mod.rs @@ -46,7 +46,7 @@ pub use self::inspect::inspect; pub mod key; pub mod merge_signatures; pub use self::merge_signatures::merge_signatures; -pub mod certring; +pub mod keyring; #[cfg(feature = "net")] pub mod net; pub mod certify; diff --git a/sq/src/sq-usage.rs b/sq/src/sq-usage.rs index 1e214bc0..f83beb33 100644 --- a/sq/src/sq-usage.rs +++ b/sq/src/sq-usage.rs @@ -31,7 +31,7 @@ //! sign Signs messages or data files //! verify Verifies signed messages or detached signatures //! key Manages keys -//! certring Manages collections of certificates +//! keyring Manages collections of certificates //! certify Certifies a User ID for a Certificate //! autocrypt Communicates certificates using Autocrypt //! keyserver Interacts with keyservers @@ -340,13 +340,14 @@ //! <TARGET-KEY> Adds keys to TARGET-KEY //! ``` //! -//! ## Subcommand certring +//! ## Subcommand keyring //! //! ```text -//! Manages collections of certificates (also known as 'keyrings'). +//! Manages collections of certificates (also known as 'keyrings' when they contain +//! secret key material, and 'certrings' when they don't). //! //! USAGE: -//! sq certring <SUBCOMMAND> +//! sq keyring <SUBCOMMAND> //! //! FLAGS: //! -h, --help @@ -354,21 +355,21 @@ //! //! //! SUBCOMMANDS: -//! filter Joins certs into a certring applying a filter +//! filter Joins certs into a keyring applying a filter //! help Prints this message or the help of the given subcommand(s) -//! join Joins certs or certrings into a single certring -//! list Lists certs in a certring -//! merge Merges certs or certrings into a single certring -//! split Splits a certring into individual certs +//! join Joins certs or keyrings into a single keyring +//! list Lists certs in a keyring +//! merge Merges certs or keyrings into a single keyring +//! split Splits a keyring into individual certs //! ``` //! -//! ### Subcommand certring filter +//! ### Subcommand keyring filter //! //! ```text -//! Joins certs into a certring applying a filter +//! Joins certs into a keyring applying a filter //! //! USAGE: -//! sq certring filter [FLAGS] [OPTIONS] [--] [FILE]... +//! sq keyring filter [FLAGS] [OPTIONS] [--] [FILE]... //! //! FLAGS: //! -B, --binary Emits binary data @@ -389,24 +390,24 @@ //! any of the predicates match. To require all predicates to match, chain multiple //! invocations of this command: //! -//! $ cat certs.pgp | sq certring filter --domain example.org | sq certring filter +//! $ cat certs.pgp | sq keyring filter --domain example.org | sq keyring filter //! --name Juliett //! ``` //! -//! ### Subcommand certring join +//! ### Subcommand keyring join //! //! ```text -//! Joins certs or certrings into a single certring. +//! Joins certs or keyrings into a single keyring. //! -//! Unlike 'sq certring merge', multiple versions of the same certificate are not +//! Unlike 'sq keyring merge', multiple versions of the same certificate are not //! merged together. //! //! USAGE: -//! sq certring join [FLAGS] [OPTIONS] [FILE]... +//! sq keyring join [FLAGS] [OPTIONS] [FILE]... //! //! FLAGS: //! -B, --binary -//! Don't ASCII-armor the certring +//! Don't ASCII-armor the keyring //! //! -h, --help //! Prints help information @@ -425,13 +426,13 @@ //! Sets the input files to use //! ``` //! -//! ### Subcommand certring list +//! ### Subcommand keyring list //! //! ```text -//! Lists certs in a certring +//! Lists certs in a keyring //! //! USAGE: -//! sq certring list [FILE] +//! sq keyring list [FILE] //! //! FLAGS: //! -h, --help Prints help information @@ -441,17 +442,17 @@ //! <FILE> Reads from FILE or stdin if omitted //! ``` //! -//! ### Subcommand certring merge +//! ### Subcommand keyring merge //! //! ```text -//! Merges certs or certrings into a single certring. +//! Merges certs or keyrings into a single keyring. //! -//! Unlike 'sq certring join', the certificates are buffered and multiple versions -//! of the same certificate are merged together. Where data is replaced (e.g., -//! secret key material), data from the later certificate is preferred. +//! Unlike 'sq keyring join', the certificates are buffered and multiple versions of +//! the same certificate are merged together. Where data is replaced (e.g., secret +//! key material), data from the later certificate is preferred. //! //! USAGE: -//! sq certring merge [FLAGS] [OPTIONS] [FILE]... +//! sq keyring merge [FLAGS] [OPTIONS] [FILE]... //! //! FLAGS: //! -B, --binary @@ -474,13 +475,13 @@ //! Reads from FILE //! ``` //! -//! ### Subcommand certring split +//! ### Subcommand keyring split //! //! ```text -//! Splits a certring into individual certs +//! Splits a keyring into individual certs //! //! USAGE: -//! sq certring split [FLAGS] [OPTIONS] [FILE] +//! sq keyring split [FLAGS] [OPTIONS] [FILE] //! //! FLAGS: //! -B, --binary Emits binary data @@ -489,8 +490,8 @@ //! //! OPTIONS: //! -p, --prefix <FILE> Writes to files with prefix FILE [defaults to the -//! input filename with a dash, or 'output' if certring -//! is read from stdin] +//! input filename with a dash, or 'output' if keyring is +//! read from stdin] //! //! ARGS: //! <FILE> Reads from FILE or stdin if omitted diff --git a/sq/src/sq.rs b/sq/src/sq.rs index 15bb3f23..d13d6c31 100644 --- a/sq/src/sq.rs +++ b/sq/src/sq.rs @@ -585,7 +585,7 @@ fn main() -> Result<()> { commands::inspect(m, policy, &mut output)?; }, - ("certring", Some(m)) => commands::certring::dispatch(m, force)?, + ("keyring", Some(m)) => commands::keyring::dispatch(m, force)?, ("packet", Some(m)) => match m.subcommand() { ("dump", Some(m)) => { diff --git a/sq/src/sq_cli.rs b/sq/src/sq_cli.rs index f1cc9253..2678445a 100644 --- a/sq/src/sq_cli.rs +++ b/sq/src/sq_cli.rs @@ -442,16 +442,18 @@ pub fn configure(app: App<'static, 'static>) -> App<'static, 'static> { ) .subcommand( - SubCommand::with_name("certring") + SubCommand::with_name("keyring") .display_order(310) .about("Manages collections of certificates") .long_about( "Manages collections of certificates \ - (also known as 'keyrings').") + (also known as 'keyrings' when they contain \ + secret key material, and 'certrings' when they \ + don't).") .setting(AppSettings::SubcommandRequiredElseHelp) .subcommand( SubCommand::with_name("filter") - .about("Joins certs into a certring applying a filter") + .about("Joins certs into a keyring applying a filter") .after_help( "If multiple predicates are given, they are \ or'ed, i.e. a certificate matches if any \ @@ -459,7 +461,7 @@ pub fn configure(app: App<'static, 'static>) -> App<'static, 'static> { predicates to match, chain multiple \ invocations of this command:\n\ \n\ - $ cat certs.pgp | sq certring filter --domain example.org | sq certring filter --name Juliett") + $ cat certs.pgp | sq keyring filter --domain example.org | sq keyring filter --name Juliett") .arg(Arg::with_name("input") .value_name("FILE") .multiple(true) @@ -489,11 +491,11 @@ pub fn configure(app: App<'static, 'static>) -> App<'static, 'static> { ) .subcommand( SubCommand::with_name("join") - .about("Joins certs or certrings into a single certring") + .about("Joins certs or keyrings into a single keyring") .long_about( - "Joins certs or certrings into a single certring.\n\ + "Joins certs or keyrings into a single keyring.\n\ \n\ - Unlike 'sq certring merge', multiple versions \ + Unlike 'sq keyring merge', multiple versions \ of the same certificate are not merged \ together.") .arg(Arg::with_name("input") @@ -505,15 +507,15 @@ pub fn configure(app: App<'static, 'static>) -> App<'static, 'static> { .help("Sets the output file to use")) .arg(Arg::with_name("binary") .short("B").long("binary") - .help("Don't ASCII-armor the certring")) + .help("Don't ASCII-armor the keyring")) ) .subcommand( SubCommand::with_name("merge") - .about("Merges certs or certrings into a single certring") + .about("Merges certs or keyrings into a single keyring") .long_about( - "Merges certs or certrings into a single certring.\n\ + "Merges certs or keyrings into a single keyring.\n\ \n\ - Unlike 'sq certring join', the certificates \ + Unlike 'sq keyring join', the certificates \ are buffered and multiple versions of the same \ certificate are merged together. Where data \ is replaced (e.g., secret key material), data \ @@ -531,14 +533,14 @@ pub fn configure(app: App<'static, 'static>) -> App<'static, 'static> { ) .subcommand( SubCommand::with_name("list") - .about("Lists certs in a certring") + .about("Lists certs in a keyring") .arg(Arg::with_name("input") .value_name("FILE") .help("Reads from FILE or stdin if omitted")) ) .subcommand( SubCommand::with_name("split") - .about("Splits a certring into individual certs") + .about("Splits a keyring into individual certs") .arg(Arg::with_name("input") .value_name("FILE") .help("Reads from FILE or stdin if omitted")) @@ -546,7 +548,7 @@ pub fn configure(app: App<'static, 'static>) -> App<'static, 'static> { .short("p").long("prefix").value_name("FILE") .help("Writes to files with prefix FILE \ [defaults to the input filename with a \ - dash, or 'output' if certring is read \ + dash, or 'output' if keyring is read \ from stdin]")) .arg(Arg::with_name("binary") .short("B").long("binary") |