diff options
Diffstat (limited to '')
-rw-r--r-- | g10/delkey.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/g10/delkey.c b/g10/delkey.c index 3de705dfa..063de78e6 100644 --- a/g10/delkey.c +++ b/g10/delkey.c @@ -111,6 +111,15 @@ do_delete_key( const char *username, int secret, int force, int *r_sec_avail ) err = 0; } + if (secret && !have_secret_key_with_kid (keyid)) + { + err = gpg_error (GPG_ERR_NOT_FOUND); + log_error (_("key \"%s\" not found: %s\n"), username, gpg_strerror (err)); + write_status_text (STATUS_DELETE_PROBLEM, "1"); + goto leave; + } + + if (opt.batch && exactmatch) okay++; else if (opt.batch && secret) |