gpg: add the --delete-secret-key-stubs command
Needs ReviewPublic

Authored by matheusmoreira on Wed, May 8, 11:53 PM.
This revision needs review, but there are no reviewers specified.


  • g10/gpg.c (cmd_and_opt_values): Add delete-secret-key-stubs command.

(opts): Add delete-secret-key-stubs argparse option.
(main): Parse and invoke the delete-secret-key-stubs command.

  • g10/main.h (delete_keys): Add the stubs_only parameter.
  • g10/delkey.c (delete_keys): Likewise.

(do_delete_key): Likewise.
(gpg_agent_delete_secret_key): Likewise.

  • g10/call-agent.h (agent_delete_key): Likewise.
  • g10/call-agent.c (agent_delete_key): Pass --stub-only to gpg agent.

The new --delete-secret-key-stubs command provides access to
the --stub-only option of the gpg agent's DELETE_KEY command.

Signed-off-by: Matheus Afonso Martins Moreira <>

Test Plan

The --delete-secret-key-stubs command should delete key stubs and fail when invoked on any normal key.

Diff Detail

rG GnuPG
Lint Skipped
Unit Tests Skipped