68 |
passphrase_callback_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
passphrase_callback_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
69 |
{ |
{ |
70 |
static passphrase_cb_s * c; |
static passphrase_cb_s * c; |
71 |
gpgme_decrypt_result_t res; |
gpgme_decrypt_result_t res = NULL; |
72 |
gpgme_sign_result_t res_sig; |
gpgme_sign_result_t res_sig = NULL; |
73 |
gpgme_key_t key; |
gpgme_key_t key; |
74 |
gpgme_recipient_t recip, r; |
gpgme_recipient_t recip=NULL, r; |
75 |
void *ctx = NULL, *item; |
void *item; |
76 |
const char *id; |
const char *id; |
77 |
char *info; |
char *info; |
78 |
int n; |
int n; |
257 |
char *uid, *p; |
char *uid, *p; |
258 |
int n=0; |
int n=0; |
259 |
|
|
260 |
|
algo = (gpgme_pubkey_algo_t)0; |
261 |
/* Each uid_hint contains a long key-ID so it is at least 16 bytes. */ |
/* Each uid_hint contains a long key-ID so it is at least 16 bytes. */ |
262 |
if (strlen (uid_hint) < 17) { |
if (strlen (uid_hint) < 17) { |
263 |
*desc = 0; |
*desc = 0; |
317 |
passphrase_cb_s *c = (passphrase_cb_s*)hook; |
passphrase_cb_s *c = (passphrase_cb_s*)hook; |
318 |
HANDLE hd = (HANDLE)fd; |
HANDLE hd = (HANDLE)fd; |
319 |
void *item; |
void *item; |
320 |
const char *keyid, *pass; |
const char *keyid=NULL, *pass; |
321 |
DWORD n; |
DWORD n; |
322 |
int rc; |
int rc=0; |
323 |
|
|
324 |
if (!c) |
if (!c) |
325 |
return gpg_error (GPG_ERR_INV_ARG); |
return gpg_error (GPG_ERR_INV_ARG); |
335 |
if (strlen (passphrase_info) < 16 && |
if (strlen (passphrase_info) < 16 && |
336 |
!strstr (passphrase_info, "OPENPGP")) { |
!strstr (passphrase_info, "OPENPGP")) { |
337 |
/* assume symetric encryption. */ |
/* assume symetric encryption. */ |
338 |
int n=2; |
int pos=2; |
339 |
c->sym.sym_algo = atoi (passphrase_info); |
c->sym.sym_algo = atoi (passphrase_info); |
340 |
if (c->sym.sym_algo > 9) |
if (c->sym.sym_algo > 9) |
341 |
n++; |
pos++; |
342 |
/* XXX: be more strict. */ |
/* XXX: be more strict. */ |
343 |
c->sym.s2k_mode = atoi (passphrase_info+n); |
c->sym.s2k_mode = atoi (passphrase_info+pos); |
344 |
c->sym.s2k_hash = atoi (passphrase_info+n+2); |
c->sym.s2k_hash = atoi (passphrase_info+pos+2); |
345 |
} |
} |
346 |
|
|
347 |
keyid = parse_gpg_keyid (passphrase_info); |
keyid = parse_gpg_keyid (passphrase_info); |