1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

gpg: Store Link attributes for composite keys.

* g10/call-agent.c (agent_crosslink_keys): New.
* g10/keygen.c (common_gen): Store the Link attribute.
--

The Link attribute may be useful to quickly find the other part of a
composite private key.

GnuPG-bug-id: 6638
This commit is contained in:
Werner Koch 2025-02-07 11:10:09 +01:00
parent 00c31f8b04
commit 3738b0a99a
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
3 changed files with 57 additions and 0 deletions

View file

@ -2673,6 +2673,30 @@ agent_genkey (ctrl_t ctrl, char **cache_nonce_addr, char **passwd_nonce_addr,
}
/* Add the Link attribute to both given keys. */
gpg_error_t
agent_crosslink_keys (ctrl_t ctrl, const char *hexgrip1, const char *hexgrip2)
{
gpg_error_t err;
char line[ASSUAN_LINELENGTH];
err = start_agent (ctrl, 0);
if (err)
goto leave;
snprintf (line, sizeof line, "KEYATTR %s Link: %s", hexgrip1, hexgrip2);
err = assuan_transact (agent_ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
if (err)
goto leave;
snprintf (line, sizeof line, "KEYATTR %s Link: %s", hexgrip2, hexgrip1);
err = assuan_transact (agent_ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
leave:
return err;
}
/* Call the agent to read the public key part for a given keygrip.
* Values from FROMCARD: