Fix resolving --signer-self.

- Fixes 25e99e5afb1e2f382e138a4502c9e00641dd903b.

  - Fixes #475.
This commit is contained in:
Justus Winter 2024-12-03 10:39:52 +01:00
parent 169da29c09
commit 84928e39d0
No known key found for this signature in database
GPG Key ID: 686F55B4AB2B3386

View File

@ -2141,14 +2141,23 @@ impl<'store: 'rstore, 'rstore> Sq<'store, 'rstore> {
},
cert_designator::CertDesignator::Self_ => {
if self.config.encrypt_for_self().is_empty() {
let (certs, config) = match Prefix::name() {
"for" => (self.config.encrypt_for_self(),
cli::encrypt::ENCRYPT_FOR_SELF),
"signer" => (self.config.sign_signer_self(),
cli::sign::SIGNER_SELF),
_ => return Err(anyhow::anyhow!(
"self designator used with unexpected prefix")),
};
if certs.is_empty() {
return Err(anyhow::anyhow!(
"`--for-self` is given but the list of \
certificates in `{}` is empty",
cli::encrypt::ENCRYPT_FOR_SELF));
config));
}
for fp in self.config.encrypt_for_self() {
for fp in certs {
let cert = self.resolve_cert(
&openpgp::KeyHandle::from(fp.clone()).into(), 0)?.0;
ret(designator,