/[winpt]/trunk/Src/wptPassphraseCB.cpp
ViewVC logotype

Diff of /trunk/Src/wptPassphraseCB.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 229 by twoaday, Mon Jun 19 14:04:31 2006 UTC revision 255 by twoaday, Tue Aug 1 16:37:23 2006 UTC
# Line 1  Line 1 
1  /* wptPassphraseCB.cpp - GPGME Passphrase Callback  /* wptPassphraseCB.cpp - GPGME Passphrase Callback
2   *      Copyright (C) 2001, 2002, 2003, 2005, 2006 Timo Schulz   *      Copyright (C) 2001, 2002-2006 Timo Schulz
3   *      Copyright (C) 2005 g10 Code GmbH   *      Copyright (C) 2005 g10 Code GmbH
4   *   *
5   * This file is part of WinPT.   * This file is part of WinPT.
# Line 41  Line 41 
41  #include "wptRegistry.h"  #include "wptRegistry.h"
42  #include "wptUTF8.h"  #include "wptUTF8.h"
43    
 const char* get_symkey_algo (int algo);  
44    
45    /* Return the control ID dependent on the mode (sign or decrypt). */
46  #define item_ctrl_id(cmd) \  #define item_ctrl_id(cmd) \
47      ((cmd) == GPG_CMD_DECRYPT? IDC_DECRYPT_PWD : IDC_DECRYPT_SIGN_PWD)      ((cmd) == GPG_CMD_DECRYPT? IDC_DECRYPT_PWD : IDC_DECRYPT_SIGN_PWD)
48    
49  #define item_ctrl_id2(cmd) \  #define item_ctrl_id2(cmd) \
50      ((cmd) == GPG_CMD_DECRYPT? IDC_DECRYPT_HIDE : IDC_DECRYPT_SIGN_HIDE)      ((cmd) == GPG_CMD_DECRYPT? IDC_DECRYPT_HIDE : IDC_DECRYPT_SIGN_HIDE)
51    
52    const char* get_symkey_algo (int algo);
53  void ListBox_AddString_utf8 (HWND lb, const char *txt);  void ListBox_AddString_utf8 (HWND lb, const char *txt);
54    
55    
56  /* Overwrite passphrase and free memory. */  /* Overwrite passphrase and free memory. */
57  static void  static void
58  burn_passphrase (char **pwd)  burn_passphrase (char **pwd)
# Line 179  passphrase_callback_proc (HWND dlg, UINT Line 180  passphrase_callback_proc (HWND dlg, UINT
180    
181          case WM_SYSCOMMAND:          case WM_SYSCOMMAND:
182              if (LOWORD (wparam) == SC_CLOSE) {              if (LOWORD (wparam) == SC_CLOSE) {
                 SetDlgItemText (dlg, item_ctrl_id (c->gpg_cmd), "");  
183                  c->cancel = 1;                  c->cancel = 1;
184                  EndDialog (dlg, TRUE);                  EndDialog (dlg, TRUE);
185              }              }
# Line 225  passphrase_callback_proc (HWND dlg, UINT Line 225  passphrase_callback_proc (HWND dlg, UINT
225                  res = gpgme_op_decrypt_result (c->gpg);                  res = gpgme_op_decrypt_result (c->gpg);
226                  if (!res)                  if (!res)
227                      res_sig = gpgme_op_sign_result (c->gpg);                                  res_sig = gpgme_op_sign_result (c->gpg);            
228                  if (reg_prefs.cache_time > 0 && !c->is_card &&                  if (!c->is_card && reg_prefs.cache_time > 0 &&
229                      (res || res_sig)) {                      (res || res_sig)) {
230                      if (agent_get_cache (c->keyid, &item))                                            if (agent_get_cache (c->keyid, &item))
231                          agent_unlock_cache_entry (&item);                          agent_unlock_cache_entry (&item);
232                      else                      else
233                          agent_put_cache (c->keyid, c->pwd, reg_prefs.cache_time);                          agent_put_cache (c->keyid, c->pwd, reg_prefs.cache_time);
# Line 303  parse_gpg_description (const char *uid_h Line 303  parse_gpg_description (const char *uid_h
303      uid = utf8_to_native (uid_hint);      uid = utf8_to_native (uid_hint);
304      if (strcmp (usedkey, mainkey))      if (strcmp (usedkey, mainkey))
305          _snprintf (desc, size-1,          _snprintf (desc, size-1,
306                     _("You need a passphrase to unlock the secret key for\n"                     _("You need a passphrase to unlock the secret key for user:\n"
307                       "user: \"%s\"\n"                       "\"%s\"\n"
308                       "%s key, ID %s (main key ID %s)\n"),                       "%s key, ID 0x%s (main key ID 0x%s)\n"),
309                     uid, get_key_pubalgo (algo), usedkey+8, mainkey+8);                     uid, get_key_pubalgo (algo), usedkey+8, mainkey+8);
310      else if (!strcmp (usedkey, mainkey))      else if (!strcmp (usedkey, mainkey))
311          _snprintf (desc, size-1,          _snprintf (desc, size-1,
312                     _("You need a passphrase to unlock the secret key for\n"                     _("You need a passphrase to unlock the secret key for user:\n"
313                       "user: \"%s\"\n"                       "\"%s\"\n"
314                       "%s key, ID %s\n"),                       "%s key, ID 0x%s\n"),
315                       uid, get_key_pubalgo (algo), usedkey+8);                       uid, get_key_pubalgo (algo), usedkey+8);
316      safe_free (uid);      safe_free (uid);
317      return 0;      return 0;

Legend:
Removed from v.229  
changed lines
  Added in v.255

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26