Move sq toolbox keyring to sq keyring.

- Make `sq keyring` a top-level subcommand.

  - See #326.
This commit is contained in:
Neal H. Walfield 2024-11-16 09:20:01 +01:00
parent 050bba99f8
commit e1a4fa656c
No known key found for this signature in database
GPG Key ID: 6863C9AD5B4D22D3
15 changed files with 91 additions and 92 deletions

1
NEWS
View File

@ -83,6 +83,7 @@
- Drop `sq pki lookup --email`'s flag, and replace it with the
`--userid` and `--email` positional arguments, which match on
user IDs.
- `sq toolbox keyring` is now just `sq keyring`.
* Changes in 0.39.0
** Notable changes

View File

@ -570,12 +570,12 @@ then stdout contains "-----END PGP PUBLIC KEY BLOCK-----"
~~~
# Keyring management: `sq toolbox keyring`
# Keyring management: `sq keyring`
This chapter verifies that the various subcommands to manage keyring
files work: subcommands of the `sq toolbox keyring` command.
files work: subcommands of the `sq keyring` command.
## Joining keys into a keyring: `sq toolbox keyring merge`
## Joining keys into a keyring: `sq keyring merge`
The scenarios in this section verify that various ways of joining keys
into a keyring work.
@ -591,8 +591,8 @@ This is for secret keys, with the output going to stdout in text form.
given an installed sq
when I run sq key generate --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev
when I run sq key generate --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev
when I run sq toolbox keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq toolbox keyring list ring.pgp
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq keyring list ring.pgp
then stdout contains "Alice"
then stdout contains "Bob"
~~~
@ -608,7 +608,7 @@ This is for secret keys, with the output going to a file in text form.
given an installed sq
when I run sq key generate --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev
when I run sq key generate --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev
when I run sq toolbox keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp
then file ring.pgp contains "-----BEGIN PGP PRIVATE KEY BLOCK-----"
then file ring.pgp contains "-----END PGP PRIVATE KEY BLOCK-----"
when I run sq inspect ring.pgp
@ -625,7 +625,7 @@ _Requirement: we can join two keys into a keyring in binary form._
given an installed sq
when I run sq key generate --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev
when I run sq key generate --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev
when I run sq toolbox keyring merge alice.pgp bob.pgp --output ring.pgp --binary
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp --binary
when I try to run grep PGP ring.pgp
then command fails
when I run sq inspect ring.pgp
@ -648,7 +648,7 @@ when I run sq key generate --without-password --userid Alice --output alice.pgp
when I run sq key generate --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev
when I run sq toolbox extract-cert alice.pgp --output alice-cert.pgp
when I run sq toolbox extract-cert bob.pgp --output bob-cert.pgp
when I run sq toolbox keyring merge alice-cert.pgp bob-cert.pgp --output ring.pgp
when I run sq keyring merge alice-cert.pgp bob-cert.pgp --output ring.pgp
when I run cat ring.pgp
then stdout contains "-----BEGIN PGP PUBLIC KEY BLOCK-----"
then stdout contains "-----END PGP PUBLIC KEY BLOCK-----"
@ -660,10 +660,10 @@ then stdout contains "Bob"
~~~
## Filter a keyring: `sq toolbox keyring filter`
## Filter a keyring: `sq keyring filter`
The scenarios in this section verify that various ways of filtering
the contents of a keyring work: the `sq toolbox keyring filter` subcommand
the contents of a keyring work: the `sq keyring filter` subcommand
variants.
@ -676,8 +676,8 @@ certificates._
given an installed sq
when I run sq key generate --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev
when I run sq key generate --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev
when I run sq toolbox keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq toolbox keyring filter --to-cert ring.pgp --output filtered.pgp
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq keyring filter --to-cert ring.pgp --output filtered.pgp
when I run sq inspect filtered.pgp
then stdout contains "OpenPGP Certificate."
then stdout doesn't contain "Transferable Secret Key."
@ -694,8 +694,8 @@ file._
given an installed sq
when I run sq key generate --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev
when I run sq key generate --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev
when I run sq toolbox keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq toolbox keyring filter --to-cert ring.pgp
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq keyring filter --to-cert ring.pgp
then stdout contains "-----BEGIN PGP PUBLIC KEY BLOCK-----"
then stdout contains "-----END PGP PUBLIC KEY BLOCK-----"
~~~
@ -708,8 +708,8 @@ _Requirement: we can get filter output in binary form._
given an installed sq
when I run sq key generate --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev
when I run sq key generate --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev
when I run sq toolbox keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq toolbox keyring filter --binary --to-cert ring.pgp
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq keyring filter --binary --to-cert ring.pgp
then stdout doesn't contain "-----BEGIN PGP PUBLIC KEY BLOCK-----"
~~~
@ -721,7 +721,7 @@ criteria._
~~~scenario
given an installed sq
when I run sq key generate --without-password --userid Alice --userid Bob --output alice.pgp --rev-cert alice.pgp.rev
when I run sq toolbox keyring filter --prune-certs --name Alice alice.pgp --output filtered.pgp
when I run sq keyring filter --prune-certs --name Alice alice.pgp --output filtered.pgp
when I run sq inspect filtered.pgp
then stdout contains "Alice"
then stdout doesn't contain "Bob"
@ -736,8 +736,8 @@ specific user id._
given an installed sq
when I run sq key generate --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev
when I run sq key generate --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev
when I run sq toolbox keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq toolbox keyring filter --userid Alice ring.pgp --output filtered.pgp
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq keyring filter --userid Alice ring.pgp --output filtered.pgp
when I run sq inspect filtered.pgp
then stdout contains "Alice"
then stdout doesn't contain "Bob"
@ -752,8 +752,8 @@ specific user ids._
given an installed sq
when I run sq key generate --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev
when I run sq key generate --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev
when I run sq toolbox keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq toolbox keyring filter --userid Alice --userid Bob ring.pgp --output filtered.pgp
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq keyring filter --userid Alice --userid Bob ring.pgp --output filtered.pgp
when I run sq inspect filtered.pgp
then stdout contains "Alice"
then stdout contains "Bob"
@ -768,8 +768,8 @@ part of a user ids._
given an installed sq
when I run sq key generate --without-password --userid 'Alice <alice@example.com>' --output alice.pgp --rev-cert alice.pgp.rev
when I run sq key generate --without-password --userid 'Bob <bob@example.com>' --output bob.pgp --rev-cert bob.pgp.rev
when I run sq toolbox keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq toolbox keyring filter --name Alice ring.pgp --output filtered.pgp
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq keyring filter --name Alice ring.pgp --output filtered.pgp
when I run sq inspect filtered.pgp
then stdout contains "Alice"
then stdout doesn't contain "Bob"
@ -784,8 +784,8 @@ several names as part of the user id._
given an installed sq
when I run sq key generate --without-password --userid 'Alice <alice@example.com>' --output alice.pgp --rev-cert alice.pgp.rev
when I run sq key generate --without-password --userid 'Bob <bob@example.com>' --output bob.pgp --rev-cert bob.pgp.rev
when I run sq toolbox keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq toolbox keyring filter --name Alice --name Bob ring.pgp --output filtered.pgp
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq keyring filter --name Alice --name Bob ring.pgp --output filtered.pgp
when I run sq inspect filtered.pgp
then stdout contains "Alice"
then stdout contains "Bob"
@ -800,8 +800,8 @@ part of a user ids._
given an installed sq
when I run sq key generate --without-password --userid 'Alice <alice@example.com>' --output alice.pgp --rev-cert alice.pgp.rev
when I run sq key generate --without-password --userid 'Bob <bob@sequoia-pgp.org>' --output bob.pgp --rev-cert bob.pgp.rev
when I run sq toolbox keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq toolbox keyring filter --domain example.com ring.pgp --output filtered.pgp
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq keyring filter --domain example.com ring.pgp --output filtered.pgp
when I run sq inspect filtered.pgp
then stdout contains "Alice"
then stdout doesn't contain "Bob"
@ -816,15 +816,15 @@ several names as part of the user id._
given an installed sq
when I run sq key generate --without-password --userid 'Alice <alice@example.com>' --output alice.pgp --rev-cert alice.pgp.rev
when I run sq key generate --without-password --userid 'Bob <bob@sequoia-pgp.org>' --output bob.pgp --rev-cert bob.pgp.rev
when I run sq toolbox keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq toolbox keyring filter --domain example.com --domain sequoia-pgp.org ring.pgp --output filtered.pgp
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq keyring filter --domain example.com --domain sequoia-pgp.org ring.pgp --output filtered.pgp
when I run sq inspect filtered.pgp
then stdout contains "Alice"
then stdout contains "Bob"
~~~
## Listing contents of a keyring: `sq toolbox keyring list`
## Listing contents of a keyring: `sq keyring list`
The scenarios in this section verify the contents of a keyring can be listed.
@ -836,8 +836,8 @@ _Requirement: we can list the keys in a keyring._
given an installed sq
when I run sq key generate --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev
when I run sq key generate --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev
when I run sq toolbox keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq toolbox keyring list ring.pgp
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq keyring list ring.pgp
then stdout contains "Alice"
then stdout contains "Bob"
~~~
@ -849,7 +849,7 @@ _Requirement: we can list the keys in a key file._
~~~scenario
given an installed sq
when I run sq key generate --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev
when I run sq toolbox keyring list alice.pgp
when I run sq keyring list alice.pgp
then stdout contains "Alice"
then stdout doesn't contain "Bob"
~~~
@ -861,7 +861,7 @@ _Requirement: we can list all user ids._
~~~scenario
given an installed sq
when I run sq key generate --without-password --userid Alice --userid Bob --output alice.pgp --rev-cert alice.pgp.rev
when I run sq toolbox keyring list alice.pgp --all-userids
when I run sq keyring list alice.pgp --all-userids
then stdout contains "Alice"
then stdout contains "Bob"
~~~
@ -875,10 +875,10 @@ redirecting stdin to come from a file first.
## Split a keyring: `sq toolbox keyring split`
## Split a keyring: `sq keyring split`
The scenarios in this section verify that splitting a keyring into
individual files, one per key: the `sq toolbox keyring split` subcommand.
individual files, one per key: the `sq keyring split` subcommand.
Or rather, there will be such scenarios here when Subplot provides
tools for dealing with randomly named files. Until then, this section
@ -888,8 +888,8 @@ is a placeholder.
given an installed sq
when I run sq key generate --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev
when I run sq key generate --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev
when I run sq toolbox keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq toolbox keyring split ring.pgp
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp
when I run sq keyring split ring.pgp
then the resulting files match alice,pgp and bob.pgp
~~~

View File

@ -79,7 +79,7 @@ const EXAMPLES: Actions = Actions {
actions: &[
Action::Setup(Setup {
command: &[
"sq", "toolbox", "keyring", "merge",
"sq", "keyring", "merge",
"--output=certs.pgp",
"bob.pgp", "romeo.pgp",
],

View File

@ -1,4 +1,4 @@
//! Command-line parser for `sq toolbox keyring`.
//! Command-line parser for `sq keyring`.
use std::path::PathBuf;
@ -159,7 +159,7 @@ const FILTER_EXAMPLES: Actions = Actions {
actions: &[
Action::Setup(Setup {
command: &[
"sq", "toolbox", "keyring", "merge",
"sq", "keyring", "merge",
"--output=certs.pgp",
"bob.pgp", "romeo.pgp",
],
@ -169,7 +169,7 @@ const FILTER_EXAMPLES: Actions = Actions {
comment: "\
Convert all keys to certificates (i.e. remove any secret key material).",
command: &[
"sq", "toolbox", "keyring", "filter",
"sq", "keyring", "filter",
"--to-cert",
"certs.pgp",
],
@ -179,7 +179,7 @@ Convert all keys to certificates (i.e. remove any secret key material).",
comment: "\
Get all certificates with a user ID on example.org.",
command: &[
"sq", "toolbox", "keyring", "filter",
"sq", "keyring", "filter",
"--domain=example.org",
"certs.pgp",
],
@ -189,7 +189,7 @@ Get all certificates with a user ID on example.org.",
comment: "\
Get all certificates with a user ID on example.org or example.net.",
command: &[
"sq", "toolbox", "keyring", "filter",
"sq", "keyring", "filter",
"--domain=example.org",
"--domain=example.net",
"certs.pgp",
@ -200,7 +200,7 @@ Get all certificates with a user ID on example.org or example.net.",
comment: "\
Get all certificates with a name user ID matching Romeo.",
command: &[
"sq", "toolbox", "keyring", "filter",
"sq", "keyring", "filter",
"--name=Romeo",
"certs.pgp",
],
@ -210,10 +210,10 @@ Get all certificates with a name user ID matching Romeo.",
comment: "\
Get all certificates with a name user ID matching Romeo on example.org.",
command: &[
"sq", "toolbox", "keyring", "filter",
"sq", "keyring", "filter",
"--domain=example.org",
"certs.pgp",
"|", "sq", "toolbox", "keyring", "filter",
"|", "sq", "keyring", "filter",
"--name=Romeo",
],
}),
@ -222,7 +222,7 @@ Get all certificates with a name user ID matching Romeo on example.org.",
comment: "\
Get all certificates with a user ID on example.org, pruning other user IDs.",
command: &[
"sq", "toolbox", "keyring", "filter",
"sq", "keyring", "filter",
"--domain=example.org",
"--prune-certs",
"certs.pgp",
@ -230,7 +230,7 @@ Get all certificates with a user ID on example.org, pruning other user IDs.",
}),
],
};
test_examples!(sq_toolbox_keyring_filter, FILTER_EXAMPLES);
test_examples!(sq_keyring_filter, FILTER_EXAMPLES);
#[derive(Debug, Args)]
#[clap(
@ -275,13 +275,13 @@ const MERGE_EXAMPLES: Actions = Actions {
Action::Example(Example {
comment: "Merge certificate updates.",
command: &[
"sq", "toolbox", "keyring", "merge",
"sq", "keyring", "merge",
"bob.pgp", "bob-updates.pgp",
],
}),
],
};
test_examples!(sq_toolbox_keyring_merge, MERGE_EXAMPLES);
test_examples!(sq_keyring_merge, MERGE_EXAMPLES);
#[derive(Debug, Args)]
#[clap(
@ -315,7 +315,7 @@ const LIST_EXAMPLES: Actions = Actions {
actions: &[
Action::Setup(Setup {
command: &[
"sq", "toolbox", "keyring", "merge",
"sq", "keyring", "merge",
"--output=certs.pgp",
"bob.pgp", "romeo.pgp",
],
@ -324,7 +324,7 @@ const LIST_EXAMPLES: Actions = Actions {
Action::Example(Example {
comment: "List all certificates.",
command: &[
"sq", "toolbox", "keyring", "list",
"sq", "keyring", "list",
"certs.pgp",
],
}),
@ -333,15 +333,15 @@ const LIST_EXAMPLES: Actions = Actions {
comment: "\
List all certificates with a user ID on example.org.",
command: &[
"sq", "toolbox", "keyring", "filter",
"sq", "keyring", "filter",
"--domain=example.org",
"certs.pgp",
"|", "sq", "toolbox", "keyring", "list",
"|", "sq", "keyring", "list",
],
}),
],
};
test_examples!(sq_toolbox_keyring_list, LIST_EXAMPLES);
test_examples!(sq_keyring_list, LIST_EXAMPLES);
#[derive(Debug, Args)]
#[clap(
@ -352,7 +352,7 @@ test_examples!(sq_toolbox_keyring_list, LIST_EXAMPLES);
Splitting up a keyring into individual keys helps with curating a \
keyring.
The converse operation is `sq toolbox keyring merge`.
The converse operation is `sq keyring merge`.
",
after_help = SPLIT_EXAMPLES,
)]
@ -381,7 +381,7 @@ const SPLIT_EXAMPLES: Actions = Actions {
actions: &[
Action::Setup(Setup {
command: &[
"sq", "toolbox", "keyring", "merge",
"sq", "keyring", "merge",
"--output=certs.pgp",
"bob.pgp", "romeo.pgp",
],
@ -390,7 +390,7 @@ const SPLIT_EXAMPLES: Actions = Actions {
Action::Example(Example {
comment: "Split all certificates.",
command: &[
"sq", "toolbox", "keyring", "split",
"sq", "keyring", "split",
"certs.pgp",
],
}),
@ -400,11 +400,11 @@ const SPLIT_EXAMPLES: Actions = Actions {
comment: "\
Split all certificates, merging them first to avoid duplicates.",
command: &[
"sq", "toolbox", "keyring", "merge",
"sq", "keyring", "merge",
"certs.pgp",
"|", "sq", "toolbox", "keyring", "split",
"|", "sq", "keyring", "split",
],
}),
],
};
test_examples!(sq_toolbox_keyring_split, SPLIT_EXAMPLES);
test_examples!(sq_keyring_split, SPLIT_EXAMPLES);

View File

@ -98,6 +98,7 @@ pub mod download;
pub mod encrypt;
pub mod inspect;
pub mod key;
pub mod keyring;
pub mod network;
pub mod output;
pub mod pki;
@ -558,6 +559,7 @@ pub enum SqSubcommands {
Network(network::Command),
Keyring(keyring::Command),
Toolbox(toolbox::Command),
Version(version::Command),

View File

@ -5,7 +5,6 @@ use clap::{Parser, Subcommand};
pub mod armor;
pub mod dearmor;
pub mod extract_cert;
pub mod keyring;
pub mod packet;
pub mod strip_userid;
@ -30,7 +29,6 @@ pub struct Command {
#[derive(Debug, Subcommand)]
pub enum Subcommands {
Keyring(keyring::Command),
ExtractCert(extract_cert::Command),
StripUserid(strip_userid::Command),
Packet(packet::Command),

View File

@ -19,6 +19,7 @@ pub mod cert;
pub mod decrypt;
pub mod download;
pub mod encrypt;
pub mod keyring;
pub mod sign;
pub mod inspect;
pub mod key;
@ -56,6 +57,8 @@ pub fn dispatch(sq: Sq, command: SqCommand) -> Result<()>
SqSubcommands::Network(command) =>
network::dispatch(sq, command),
SqSubcommands::Keyring(command) =>
keyring::dispatch(sq, command),
SqSubcommands::Toolbox(command) =>
toolbox::dispatch(sq, command),

View File

@ -42,7 +42,7 @@ use crate::{
output::KeyringListItem,
};
use crate::cli::toolbox::keyring;
use crate::cli::keyring;
use crate::cli::types::StdinWarning;
pub fn dispatch(sq: Sq, c: keyring::Command) -> Result<()> {

View File

@ -9,15 +9,12 @@ use crate::{
pub mod armor;
pub mod dearmor;
pub mod extract_cert;
pub mod keyring;
pub mod packet;
pub mod strip_userid;
pub fn dispatch(sq: Sq, command: Command) -> Result<()>
{
match command.subcommand {
Subcommands::Keyring(command) =>
keyring::dispatch(sq, command),
Subcommands::Packet(command) =>
packet::dispatch(sq, command),
Subcommands::ExtractCert(command) =>

View File

@ -38,7 +38,7 @@ impl Model {
v.unwrap_or(DEFAULT_OUTPUT_VERSION)
}
/// Create a model for the output of the `sq toolbox keyring list`
/// Create a model for the output of the `sq keyring list`
/// subcommand.
pub fn keyring_list(certs: Vec<keyring::ListItem>, all_uids: bool) -> Result<Self> {
let version = Self::version(None);

View File

@ -22,14 +22,14 @@ mod integration {
mod sq_key_subkey_password;
mod sq_key_userid;
mod sq_key_userid_revoke;
mod sq_keyring_filter;
mod sq_keyring_merge;
mod sq_pki;
mod sq_pki_link;
mod sq_pki_link_authorize;
mod sq_pki_vouch_certify;
mod sq_pki_vouch_authorize;
mod sq_sign;
mod sq_toolbox_keyring_filter;
mod sq_toolbox_keyring_merge;
mod sq_toolbox_packet_decrypt;
mod sq_toolbox_packet_dump;
mod sq_verify;

View File

@ -2004,10 +2004,10 @@ impl Sq {
}
// Merges the certificates.
pub fn toolbox_keyring_merge_maybe<'a, P, Q>(&self,
input_files: &[P],
input_bytes: Option<&[u8]>,
output_file: Q)
pub fn keyring_merge_maybe<'a, P, Q>(&self,
input_files: &[P],
input_bytes: Option<&[u8]>,
output_file: Q)
-> Result<Vec<Cert>>
where P: AsRef<Path>,
Q: Into<Option<&'a Path>>,
@ -2015,7 +2015,7 @@ impl Sq {
let output_file = output_file.into();
let mut cmd = self.command();
cmd.args([ "toolbox", "keyring", "merge" ]);
cmd.args([ "keyring", "merge" ]);
for input_file in input_files.into_iter() {
cmd.arg(input_file.as_ref());
@ -2054,15 +2054,15 @@ impl Sq {
}
// Merges the certificates.
pub fn toolbox_keyring_merge<'a, P, Q>(&self,
input_files: &[P],
input_bytes: Option<&[u8]>,
output_file: Q)
pub fn keyring_merge<'a, P, Q>(&self,
input_files: &[P],
input_bytes: Option<&[u8]>,
output_file: Q)
-> Vec<Cert>
where P: AsRef<Path>,
Q: Into<Option<&'a Path>>,
{
self.toolbox_keyring_merge_maybe(input_files, input_bytes, output_file)
self.keyring_merge_maybe(input_files, input_bytes, output_file)
.expect("success")
}
}

View File

@ -34,7 +34,7 @@ fn update_files() -> Result<()> {
.unwrap_or(OsStr::new(""))
.to_str().unwrap_or("")));
sq.toolbox_keyring_merge(
sq.keyring_merge(
&[ public, &alice_pgp ][..], None,
&*priv_file);

View File

@ -23,8 +23,7 @@ fn build_keyring(sq: &Sq) {
.serialize(&mut File::create(&bob).unwrap()).unwrap();
let mut cmd = sq.command();
cmd.arg("toolbox")
.arg("keyring")
cmd.arg("keyring")
.arg("merge")
.arg("--output=keys.pgp")
.arg(artifact("examples").join("alice-secret.pgp"))
@ -68,8 +67,7 @@ fn read_certs(source: &mut (dyn Read + Sync + Send)) -> Vec<Cert> {
/// Filters the keyring, then reads all certs in.
fn filter(sq: &Sq, args: &[&str]) -> Vec<Cert> {
let mut cmd = sq.command();
cmd.arg("toolbox")
.arg("keyring")
cmd.arg("keyring")
.arg("filter")
.arg("--output=-")
.args(args)

View File

@ -11,7 +11,7 @@ use super::common::Sq;
use super::common::STANDARD_POLICY;
#[test]
fn toolbox_keyring_merge_revocation() -> Result<()> {
fn keyring_merge_revocation() -> Result<()> {
let sq = Sq::new();
// Generate a key. (We don't use sq on purpose: we want to make
@ -33,7 +33,7 @@ fn toolbox_keyring_merge_revocation() -> Result<()> {
= sq.key_generate(&[], &["bob"]);
// "Merge" a single cert.
let certs = sq.toolbox_keyring_merge(
let certs = sq.keyring_merge(
&[ &alice_cert_file ][..],
None, None);
assert_eq!(certs.len(), 1);
@ -42,7 +42,7 @@ fn toolbox_keyring_merge_revocation() -> Result<()> {
RevocationStatus::Revoked(_)));
// "Merge" two certs.
let certs = sq.toolbox_keyring_merge(
let certs = sq.keyring_merge(
&[ &alice_cert_file, &bob_cert_file ][..],
None, None);
assert_eq!(certs.len(), 2);
@ -51,7 +51,7 @@ fn toolbox_keyring_merge_revocation() -> Result<()> {
RevocationStatus::Revoked(_)));
// "Merge" a single cert and its revocation certificate.
let certs = sq.toolbox_keyring_merge(
let certs = sq.keyring_merge(
&[ &alice_rev_file, &alice_cert_file ][..],
None, None);
assert_eq!(certs.len(), 1);
@ -61,13 +61,13 @@ fn toolbox_keyring_merge_revocation() -> Result<()> {
// Merging a revocation certificate without the certificate should
// result in an error.
assert!(sq.toolbox_keyring_merge_maybe(
assert!(sq.keyring_merge_maybe(
&[ &alice_rev_file ][..],
None, None).is_err());
// Merging a revocation certificate without the certificate should
// result in an error.
assert!(sq.toolbox_keyring_merge_maybe(
assert!(sq.keyring_merge_maybe(
&[ &alice_rev_file, &bob_cert_file ][..],
None, None).is_err());