gpg: confirm deletion of each key individually
Needs ReviewPublic

Authored by matheusmoreira on Apr 30 2019, 3:32 PM.
This revision needs review, but there are no reviewers specified.

Details

Summary
  • g10/delkey.c (confirm_deletion): New.

(do_delete_key): Confirm deletion of each individual key.

When asked to delete a key, gpg confirms the deletion once
no matter how many keys have been targeted for deletion.

Now it confirms the deletion of each individual key.

Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>

Test Plan

Given a temporary gpg home with primary and subordinate keys:

$ agent/gpg-agent --daemon --homedir $XDG_RUNTIME_DIR/gnupg-git
$ g10/gpg --homedir $XDG_RUNTIME_DIR/gnupg-git --batch --passphrase '' --default-new-key-algo 'rsa1024/cert+rsa1024/sign' --quick-gen-key test
$ SUBKEY=$(g10/gpg --homedir $XDG_RUNTIME_DIR/gnupg-git -K --with-subkey-fingerprint --with-colons | awk -F: '/fpr/ { print $10 }' | tail -1)

Attempting to delete keys should result in:

  1. The correct secret key fingerprints being printed in the confirmation prompts.
  2. The deletion of every secret key being confirmed if the key specification is not exact.

Diff Detail

Repository
rG GnuPG
Lint
Lint Skipped
Unit
Unit Tests Skipped
matheusmoreira retitled this revision from Confirm the deletion of every secret key to gpg: confirm deletion of each secret key.May 2 2019, 4:04 AM
matheusmoreira edited the summary of this revision. (Show Details)
matheusmoreira edited the test plan for this revision. (Show Details)
matheusmoreira updated this revision to Diff 1378.EditedMay 22 2019, 2:14 AM

Rebased on top of master: 4c7d63cd5b02
Add the if (okay) conditional back to the code

matheusmoreira retitled this revision from gpg: confirm deletion of each secret key to gpg: confirm deletion of each key individually.
matheusmoreira edited the summary of this revision. (Show Details)
matheusmoreira edited the summary of this revision. (Show Details)

Add confirmation prompt for exactly-specified public subkeys.