summaryrefslogtreecommitdiffstats
path: root/g10/pubkey-enc.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2017-02-23 19:59:21 +0100
committerWerner Koch <wk@gnupg.org>2017-02-23 19:59:21 +0100
commiteffa80e0b5fd8cf9e31a984afe391c2406edee8b (patch)
tree8d2418a3cf54845fa6ef6ae41ebe761bc4975f4a /g10/pubkey-enc.c
parentspeedo,w32: Install gpg-wks-client. (diff)
downloadgnupg2-effa80e0b5fd8cf9e31a984afe391c2406edee8b.tar.xz
gnupg2-effa80e0b5fd8cf9e31a984afe391c2406edee8b.zip
gpg: Emit new status DECRYPTION_KEY
* common/status.h (STATUS_DECRYPTION_KEY): New. * g10/pubkey-enc.c (get_it): Emit that status. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to '')
-rw-r--r--g10/pubkey-enc.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/g10/pubkey-enc.c b/g10/pubkey-enc.c
index de98d99c9..177293619 100644
--- a/g10/pubkey-enc.c
+++ b/g10/pubkey-enc.c
@@ -335,9 +335,11 @@ get_it (PKT_pubkey_enc *enc, DEK *dek, PKT_public_key *sk, u32 *keyid)
if (DBG_CRYPTO)
log_printhex ("DEK is:", dek->key, dek->keylen);
- /* Check that the algo is in the preferences and whether it has expired. */
+ /* Check that the algo is in the preferences and whether it has
+ * expired. Also print a status line with the key's fingerprint. */
{
PKT_public_key *pk = NULL;
+ PKT_public_key *mainpk = NULL;
KBNODE pkb = get_pubkeyblock (keyid);
if (!pkb)
@@ -351,9 +353,11 @@ get_it (PKT_pubkey_enc *enc, DEK *dek, PKT_public_key *sk, u32 *keyid)
&& !is_algo_in_prefs (pkb, PREFTYPE_SYM, dek->algo))
log_info (_("WARNING: cipher algorithm %s not found in recipient"
" preferences\n"), openpgp_cipher_algo_name (dek->algo));
+
if (!err)
{
- KBNODE k;
+ kbnode_t k;
+ int first = 1;
for (k = pkb; k; k = k->next)
{
@@ -361,8 +365,14 @@ get_it (PKT_pubkey_enc *enc, DEK *dek, PKT_public_key *sk, u32 *keyid)
|| k->pkt->pkttype == PKT_PUBLIC_SUBKEY)
{
u32 aki[2];
- keyid_from_pk (k->pkt->pkt.public_key, aki);
+ if (first)
+ {
+ first = 0;
+ mainpk = k->pkt->pkt.public_key;
+ }
+
+ keyid_from_pk (k->pkt->pkt.public_key, aki);
if (aki[0] == keyid[0] && aki[1] == keyid[1])
{
pk = k->pkt->pkt.public_key;
@@ -386,6 +396,19 @@ get_it (PKT_pubkey_enc *enc, DEK *dek, PKT_public_key *sk, u32 *keyid)
show_revocation_reason (pk, 1);
}
+ if (is_status_enabled () && pk && mainpk)
+ {
+ char pkhex[MAX_FINGERPRINT_LEN*2+1];
+ char mainpkhex[MAX_FINGERPRINT_LEN*2+1];
+
+ hexfingerprint (pk, pkhex, sizeof pkhex);
+ hexfingerprint (mainpk, mainpkhex, sizeof mainpkhex);
+
+ write_status_printf (STATUS_DECRYPTION_KEY, "%s %s %c",
+ pkhex, mainpkhex, get_ownertrust_info (mainpk));
+
+ }
+
release_kbnode (pkb);
err = 0;
}