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

Diff of /trunk/Src/wptClipDecryptDlg.cpp

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

revision 48 by werner, Mon Oct 31 21:14:11 2005 UTC revision 129 by twoaday, Fri Dec 30 13:56:10 2005 UTC
# Line 37  Line 37 
37  #include "wptDlgs.h"  #include "wptDlgs.h"
38  #include "wptKeylist.h"  #include "wptKeylist.h"
39  #include "wptFileManager.h"  #include "wptFileManager.h"
40  #include "wptCrypto.h"  #include "wptUTF8.h"
41  #include "resource.h"  #include "resource.h"
42    
43  bool secret_key_available (gpgme_recipient_t rset);  bool secret_key_available (gpgme_recipient_t rset);
# Line 48  char* Line 48  char*
48  get_key_userid (const char *keyid)  get_key_userid (const char *keyid)
49  {  {
50      gpgme_key_t key;      gpgme_key_t key;
51      const char *s;      char *p, *uid;
     char *p;  
52    
53      if (get_pubkey (keyid, &key))      if (get_pubkey (keyid, &key))
54          return m_strdup (_("user ID not found"));          return m_strdup (_("user ID not found"));
55      s = key->uids->uid;      uid = utf8_to_wincp2 (key->uids->uid);
56      if (!s)      if (!uid)
57          s = _("user ID not found");          uid = strdup (_("user ID not found"));
58      p = new char[strlen (s) + 4 + 8];      p = new char[strlen (uid) + 4 + 8];
59      if (!p)      if (!p)
60          BUG (NULL);          BUG (NULL);
61      sprintf (p, "\n    \"%s\"", s);      sprintf (p, "\n    \"%s\"", uid);
62        safe_free (uid);
63      return p;      return p;
64  }  }
65    
# Line 141  clip_decrypt_dlg (HWND hwnd) Line 141  clip_decrypt_dlg (HWND hwnd)
141      else if (err) {      else if (err) {
142          int pgp_type;          int pgp_type;
143          gpg_clip_get_pgptype (&pgp_type);          gpg_clip_get_pgptype (&pgp_type);
144          if (gpgme_err_code (err) == GPG_ERR_NO_DATA          if (gpgme_err_code (err) == GPG_ERR_NO_DATA && (pgp_type & PGP_MESSAGE))
             && (pgp_type & PGP_MESSAGE))  
145              msg_box (hwnd, _("Broken OpenPGP message (maybe: quoted printable "              msg_box (hwnd, _("Broken OpenPGP message (maybe: quoted printable "
146                               "character in armor)."),                               "character in armor)."), _("Decryption"), MB_INFO);
                      _("Decryption"), MB_INFO);  
147          else          else
148              msg_box (hwnd, gpgme_strerror (err), _("Decryption"), MB_ERR);              msg_box (hwnd, gpgme_strerror (err), _("Decryption"), MB_ERR);
149          goto leave;          goto leave;
# Line 169  clip_decrypt_dlg (HWND hwnd) Line 167  clip_decrypt_dlg (HWND hwnd)
167      if (sigres && sigres->signatures) {      if (sigres && sigres->signatures) {
168          gpgme_key_t key=NULL;          gpgme_key_t key=NULL;
169          const char *keyid;          const char *keyid;
170          const char *uid;          char *uid;
171    
172          sig = sigres->signatures;          sig = sigres->signatures;
173          if (!sig->fpr)          if (!sig->fpr)
174              BUG (NULL);              BUG (NULL);
175          keyid = strlen (sig->fpr) == 40? sig->fpr+24 : sig->fpr+16;          if (strlen (sig->fpr) > 16)
176                keyid = strlen (sig->fpr) == 40? sig->fpr+24 : sig->fpr+16;
177            else
178                keyid = sig->fpr;
179    
180          get_pubkey (keyid, &key);          get_pubkey (keyid, &key);
181          if (key) {          if (key) {
# Line 192  clip_decrypt_dlg (HWND hwnd) Line 193  clip_decrypt_dlg (HWND hwnd)
193          }          }
194          else          else
195              s = "";              s = "";
196            
197          if (key)          if (key)
198              uid = key->uids->uid;              uid = utf8_to_wincp2 (key->uids->uid);
199          else          else
200              uid = _("user ID not found");              uid = strdup (_("user ID not found"));
201          log_box (_("WinPT Verify"), MB_OK,          log_box (_("WinPT Verify"), MB_OK,
202                   _("%s\n"                   _("%s\n"
203                     "%s\n"                     "%s\n"
204                     "Signature made %s\n"                     "Signature made: %s\n"
205                     "From \"%s\" using key ID 0x%s"                     "From \"%s\" using key ID 0x%s"
206                     "%s %s"),                     "%s %s"),
207                     s, get_gpg_sigstat (sig->summary),                     s, get_gpg_sigstat (sig->summary),
# Line 208  clip_decrypt_dlg (HWND hwnd) Line 209  clip_decrypt_dlg (HWND hwnd)
209                     uid, keyid+8,                     uid, keyid+8,
210                     novalid? "\nPrimary key fingerprint: " : "",                     novalid? "\nPrimary key fingerprint: " : "",
211                     novalid? get_key_fpr (key) : "");                     novalid? get_key_fpr (key) : "");
212            safe_free (uid);
213      }      }
214            
215  leave:  leave:

Legend:
Removed from v.48  
changed lines
  Added in v.129

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26