55 |
err = gpg_data_new_from_clipboard (&plain, wraplen); |
err = gpg_data_new_from_clipboard (&plain, wraplen); |
56 |
if (err) |
if (err) |
57 |
return err; |
return err; |
|
gpgme_data_write (plain, "\r\n", 2); |
|
58 |
|
|
59 |
get_pubkey (keyid, &key); |
get_pubkey (keyid, &key); |
60 |
if (key) |
if (key) |
108 |
set_gpg_passphrase_cb (&pwd, ctx, GPG_CMD_SIGN, dlg, _("Signing")); |
set_gpg_passphrase_cb (&pwd, ctx, GPG_CMD_SIGN, dlg, _("Signing")); |
109 |
err = gpg_clip_sign (ctx, signer, n ); |
err = gpg_clip_sign (ctx, signer, n ); |
110 |
memset (pwd.pwd, 0, sizeof pwd.pwd); |
memset (pwd.pwd, 0, sizeof pwd.pwd); |
111 |
if (err == gpg_error (GPG_ERR_BAD_PASSPHRASE)) |
if (gpgme_err_code (err) == GPG_ERR_BAD_PASSPHRASE) |
112 |
agent_del_cache (pwd.keyid); |
agent_del_cache (pwd.keyid); |
113 |
if (err) |
if (err) |
114 |
msg_box (dlg, gpgme_strerror (err), _("Signing"), MB_ERR); |
msg_box (dlg, gpgme_strerror (err), _("Signing"), MB_ERR); |
124 |
clip_sign_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
clip_sign_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
125 |
{ |
{ |
126 |
static listview_ctrl_t lv = NULL; |
static listview_ctrl_t lv = NULL; |
127 |
gpgme_keycache_t kc, sec_kc; |
gpg_keycache_t kc, sec_kc; |
128 |
gpgme_ctx_t ctx; |
gpgme_ctx_t ctx; |
129 |
gpgme_error_t err; |
gpgme_error_t err; |
130 |
passphrase_cb_s pwd; |
passphrase_cb_s pwd; |
143 |
sec_kc = keycache_get_ctx (KEYCACHE_PRV); |
sec_kc = keycache_get_ctx (KEYCACHE_PRV); |
144 |
if (!sec_kc) |
if (!sec_kc) |
145 |
BUG (dlg); |
BUG (dlg); |
146 |
if (gpgme_keycache_count (sec_kc) == 1) { |
if (gpg_keycache_get_size (sec_kc) == 1) { |
147 |
one_key_proc (dlg); |
one_key_proc (dlg); |
148 |
EndDialog (dlg, TRUE); |
EndDialog (dlg, TRUE); |
149 |
return FALSE; |
return FALSE; |
211 |
set_gpg_passphrase_cb (&pwd, ctx, GPG_CMD_SIGN, dlg, _("Signing")); |
set_gpg_passphrase_cb (&pwd, ctx, GPG_CMD_SIGN, dlg, _("Signing")); |
212 |
err = gpg_clip_sign (ctx, signer, reg_prefs.word_wrap); |
err = gpg_clip_sign (ctx, signer, reg_prefs.word_wrap); |
213 |
free_if_alloc (signer); |
free_if_alloc (signer); |
214 |
memset (pwd.pwd, 0, sizeof pwd.pwd); |
release_gpg_passphrase_cb (&pwd); |
215 |
|
|
216 |
if (pwd.cancel && gpgme_err_code(err) == GPG_ERR_BAD_PASSPHRASE) { |
if (pwd.cancel && gpgme_err_code(err) == GPG_ERR_BAD_PASSPHRASE) { |
217 |
/* The user hit the cancel button or bad passphrase */ |
/* The user hit the cancel button or bad passphrase */ |
221 |
} |
} |
222 |
if (err) { |
if (err) { |
223 |
msg_box (dlg, gpgme_strerror (err), _("Signing"), MB_ERR); |
msg_box (dlg, gpgme_strerror (err), _("Signing"), MB_ERR); |
224 |
gpgme_release( ctx ); |
gpgme_release (ctx); |
225 |
return FALSE; |
return FALSE; |
226 |
} |
} |
227 |
else |
else |