61 |
gpgme_data_t clipdat; |
gpgme_data_t clipdat; |
62 |
|
|
63 |
rc = gpgme_data_new_from_clipboard (&clipdat); |
rc = gpgme_data_new_from_clipboard (&clipdat); |
64 |
if( !rc ) |
if (!rc) |
65 |
rc = gpgme_op_list_keys (clipdat, NULL, r_rset); |
rc = gpgme_op_list_keys (clipdat, NULL, r_rset); |
66 |
gpgme_data_release( clipdat ); |
gpgme_data_release (clipdat); |
67 |
return rc; |
return rc; |
68 |
} /* list_recipients */ |
} /* list_recipients */ |
69 |
|
|
74 |
void * ctx = NULL; |
void * ctx = NULL; |
75 |
const char * s; |
const char * s; |
76 |
|
|
77 |
gpgme_recipients_enum_open( rset, &ctx ); |
gpgme_recipients_enum_open (rset, &ctx); |
78 |
while( (s = gpgme_recipients_enum_read( rset, &ctx )) ) { |
while ((s = gpgme_recipients_enum_read (rset, &ctx))) { |
79 |
if( !strcmp( s+1, keyid ) ) |
if (!strcmp( s+1, keyid)) |
80 |
return *s; |
return *s; |
81 |
} |
} |
82 |
return 0; |
return 0; |
122 |
|
|
123 |
if (rc == GPGME_Bad_Passphrase) |
if (rc == GPGME_Bad_Passphrase) |
124 |
agent_del_cache (pwd.keyid); |
agent_del_cache (pwd.keyid); |
125 |
gpgme_decrypt_get_status( ctx, keyid, &flags ); |
gpgme_decrypt_get_status (ctx, keyid, &flags); |
126 |
if (rc == GPGME_No_Seckey && (flags & GPGME_OPFLAG_NOSECKEY)) { |
if (rc == GPGME_No_Seckey && (flags & GPGME_OPFLAG_NOSECKEY)) { |
127 |
char * p = get_key_userid( keyid+8 ); |
char * p = get_key_userid (keyid+8); |
128 |
int pkalgo = algo_from_list( keys, keyid ); |
int pkalgo = algo_from_list (keys, keyid); |
129 |
log_box( _("Decryption"), MB_ERR, |
log_box (_("Decryption"), MB_ERR, |
130 |
_("Encrypted with %s key, ID %s.%s\n" |
_("Encrypted with %s key, ID %s.%s\n" |
131 |
"Decryption failed: secret key not available."), |
"Decryption failed: secret key not available."), |
132 |
gpgme_key_expand_attr( GPGME_ATTR_ALGO, pkalgo ), |
gpgme_key_expand_attr( GPGME_ATTR_ALGO, pkalgo), |
133 |
keyid+8, p ); |
keyid+8, p); |
134 |
free_if_alloc( p ); |
free_if_alloc (p); |
135 |
goto leave; |
goto leave; |
136 |
} |
} |
137 |
else if (rc) { |
else if (rc) { |
140 |
if (rc == GPGME_No_Data && (pgp_type & GPGME_CLIP_MESSAGE)) |
if (rc == GPGME_No_Data && (pgp_type & GPGME_CLIP_MESSAGE)) |
141 |
msg_box (hwnd, _("Broken OpenPGP message (maybe: quoted printable character in armor)."), _("Decryption"), MB_INFO); |
msg_box (hwnd, _("Broken OpenPGP message (maybe: quoted printable character in armor)."), _("Decryption"), MB_INFO); |
142 |
else |
else |
143 |
gpgme_show_error( hwnd, rc, ctx, _("Decryption"), MB_ERR ); |
gpgme_show_error (hwnd, rc, ctx, _("Decryption"), MB_ERR); |
144 |
goto leave; |
goto leave; |
145 |
} |
} |
146 |
|
|
147 |
if( flags & GPGME_OPFLAG_BADMDC ) { |
if (flags & GPGME_OPFLAG_BADMDC) { |
148 |
const char *s; |
const char *s; |
149 |
s = _("WARNING: encrypted message has been manipulated!\n" |
s = _("WARNING: encrypted message has been manipulated!\n" |
150 |
"\n" |
"\n" |
151 |
"Do *NOT* trust any text or data output from this file!\n" |
"Do *NOT* trust any text or data output from this file!\n" |
152 |
"It is likely, the data was corrupted during the transport\n" |
"It is likely, the data was corrupted during the transport\n" |
153 |
"but it might be also possible that this is part of an attack."); |
"but it might be also possible that this is part of an attack."); |
154 |
msg_box( hwnd, s, _("*** IMPORTANT ***"), MB_INFO ); |
msg_box (hwnd, s, _("*** IMPORTANT ***"), MB_INFO); |
155 |
} |
} |
156 |
|
|
157 |
show_msg( hwnd, 1500, _("GnuPG Status: Finished") ); |
show_msg (hwnd, 1500, _("GnuPG Status: Finished")); |
158 |
gpgme_decrypt_get_sig_ctx( ctx, &sig ); |
gpgme_decrypt_get_sig_ctx (ctx, &sig); |
159 |
sigstat = gpgme_sig_get_ulong_attr( sig, 0, GPGME_ATTR_VALIDITY ); |
sigstat = gpgme_sig_get_ulong_attr (sig, 0, GPGME_ATTR_VALIDITY); |
160 |
if( sig && sigstat != GPGME_SIG_STAT_ERROR ) { |
if (sig && sigstat != GPGME_SIG_STAT_ERROR) { |
161 |
gpgme_key_t key; |
gpgme_key_t key; |
162 |
const char * val; |
const char * val; |
163 |
char keyid[16+1]; |
char keyid[16+1]; |