From 33fb8848dcfa90bc9fa66f8810082fa7da80c0a5 Mon Sep 17 00:00:00 2001 From: Nora Widdecke Date: Thu, 1 Dec 2022 11:57:32 +0100 Subject: sq: Improve error message for key userid add. - To add a userid to a key, private key material is needed. - State this explicitly in the error message. - Fixes #952. --- sq/src/commands/key.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sq/src/commands/key.rs b/sq/src/commands/key.rs index f6f8b729..d428ceb0 100644 --- a/sq/src/commands/key.rs +++ b/sq/src/commands/key.rs @@ -340,7 +340,9 @@ fn userid_add(config: Config, command: sq_cli::key::UseridAddCommand) -> Result< // If a password is needed to use the key, the user will be prompted. let pk = get_primary_keys(&[key.clone()], &config.policy, command.private_key_store.as_deref(), - creation_time, None)?; + creation_time, None); + + let pk = pk.context("Adding a User ID requires the private key")?; assert_eq!(pk.len(), 1, "Expect exactly one result from get_primary_keys()"); let mut pk = pk.into_iter().next().unwrap(); -- cgit v1.2.3