24 |
#endif |
#endif |
25 |
|
|
26 |
#include <windows.h> |
#include <windows.h> |
|
#include <windows.h> |
|
27 |
#include <commctrl.h> |
#include <commctrl.h> |
28 |
|
|
29 |
#include "../resource.h" |
#include "resource.h" |
30 |
#include "wptTypes.h" |
#include "wptTypes.h" |
31 |
#include "wptAgent.h" |
#include "wptAgent.h" |
32 |
#include "wptNLS.h" |
#include "wptNLS.h" |
89 |
|
|
90 |
|
|
91 |
/* This function is used when only one secret key is available. |
/* This function is used when only one secret key is available. |
92 |
* it doesn't make sense to offer a dialog for this case. |
it doesn't make sense to offer a dialog for this case. */ |
|
*/ |
|
93 |
void |
void |
94 |
one_key_proc (HWND dlg) |
one_key_proc (HWND dlg) |
95 |
{ |
{ |
96 |
char * signer; |
char *signer; |
97 |
gpgme_ctx_t ctx; |
gpgme_ctx_t ctx; |
98 |
gpgme_error_t err; |
gpgme_error_t err; |
99 |
passphrase_cb_s pwd; |
passphrase_cb_s pwd; |
|
int rc = 0; |
|
100 |
int n = reg_prefs.word_wrap; |
int n = reg_prefs.word_wrap; |
101 |
|
|
102 |
signer = get_gnupg_default_key (); |
signer = get_gnupg_default_key (); |
110 |
BUG (dlg); |
BUG (dlg); |
111 |
|
|
112 |
set_gpg_passphrase_cb (&pwd, ctx, GPG_CMD_SIGN, dlg, _("Signing")); |
set_gpg_passphrase_cb (&pwd, ctx, GPG_CMD_SIGN, dlg, _("Signing")); |
113 |
err = gpg_clip_sign (ctx, signer, n ); |
err = gpg_clip_sign (ctx, signer, n); |
|
wipememory (pwd.pwd, sizeof (pwd.pwd)); |
|
114 |
if (gpgme_err_code (err) == GPG_ERR_BAD_PASSPHRASE) |
if (gpgme_err_code (err) == GPG_ERR_BAD_PASSPHRASE) |
115 |
agent_del_cache (pwd.keyid); |
agent_del_cache (pwd.keyid); |
116 |
if (err) |
if (err) |
119 |
show_msg (dlg, 1500, _("GnuPG Status: Finished")); |
show_msg (dlg, 1500, _("GnuPG Status: Finished")); |
120 |
gpgme_release (ctx); |
gpgme_release (ctx); |
121 |
free_if_alloc (signer); |
free_if_alloc (signer); |
122 |
|
release_gpg_passphrase_cb (&pwd); |
123 |
} |
} |
124 |
|
|
125 |
|
|
171 |
notify = (NMHDR *)lparam; |
notify = (NMHDR *)lparam; |
172 |
if( notify && notify->code == NM_DBLCLK |
if( notify && notify->code == NM_DBLCLK |
173 |
&& notify->idFrom == IDC_SIGN_KEYLIST ) |
&& notify->idFrom == IDC_SIGN_KEYLIST ) |
174 |
PostMessage( dlg, WM_COMMAND, MAKEWPARAM(IDOK, 0), NULL ); |
PostMessage (dlg, WM_COMMAND, MAKEWPARAM(IDOK, 0), 0); |
175 |
return TRUE; |
return TRUE; |
176 |
|
|
177 |
case WM_SYSCOMMAND: |
case WM_SYSCOMMAND: |
242 |
|
|
243 |
return FALSE; |
return FALSE; |
244 |
} |
} |
|
|
|