/[gpgoe]/trunk/src/OECrypto.c
ViewVC logotype

Diff of /trunk/src/OECrypto.c

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

revision 18 by twoaday, Thu Apr 13 07:41:30 2006 UTC revision 23 by twoaday, Sat Aug 18 10:55:14 2007 UTC
# Line 12  Line 12 
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU General Public License for more details.   * GNU General Public License for more details.
  *  
  * You should have received a copy of the GNU Lesser General Public License  
  * along with GPGOE; if not, write to the Free Software Foundation,  
  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA  
15   */   */
16    
17  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
# Line 382  sign_msg (plugin_ctx_t ctx, char **r_msg Line 378  sign_msg (plugin_ctx_t ctx, char **r_msg
378  }  }
379    
380    
381    static void
382    start_verify_dialog (HWND main_wnd, gpgme_signature_t sig, gpgme_data_t text)
383    {
384        struct verify_ctx_s ctx;
385    
386        if (!sig)
387            return;
388        memset (&ctx, 0, sizeof (ctx));
389        ctx.sig = sig;
390        ctx.text = text;
391        DialogBoxParam (mod_hinst_dll, (LPCTSTR)IDD_VERIFY, main_wnd,
392                                verify_dlg_proc, (LPARAM)&ctx);
393    }
394    
395    
396  /* Sign and encrypt the message @r_msg. */  /* Sign and encrypt the message @r_msg. */
397  static gpgme_error_t  static gpgme_error_t
398  sign_encrypt_msg (plugin_ctx_t ctx, char **r_msg)  sign_encrypt_msg (plugin_ctx_t ctx, char **r_msg)
# Line 448  verify_msg (plugin_ctx_t ctx, char **r_m Line 459  verify_msg (plugin_ctx_t ctx, char **r_m
459      if (!err) {      if (!err) {
460          res = gpgme_op_verify_result (gctx);          res = gpgme_op_verify_result (gctx);
461          if (res && res->signatures)          if (res && res->signatures)
462              DialogBoxParam (mod_hinst_dll, (LPCTSTR)IDD_VERIFY, ctx->main_wnd,              start_verify_dialog (ctx->main_wnd, res->signatures, out);
                             verify_dlg_proc, (LPARAM)res->signatures);  
463      }      }
464    
465      gpgme_release (gctx);      gpgme_release (gctx);
# Line 542  oe_decrypt_msg (HWND main_wnd, char **r_ Line 552  oe_decrypt_msg (HWND main_wnd, char **r_
552  /* Decrypt the message @r_msg. If the type @type is actually a signature,  /* Decrypt the message @r_msg. If the type @type is actually a signature,
553     the verify function is called instead of decryption. */     the verify function is called instead of decryption. */
554  static gpgme_error_t  static gpgme_error_t
555  decrypt_msg (plugin_ctx_t ctx, char **r_msg, int type, int *r_cancel)  decrypt_msg (plugin_ctx_t ctx, char **r_msg, int *type, int *r_cancel)
556  {  {
557      gpgme_ctx_t gctx = NULL;      gpgme_ctx_t gctx = NULL;
558      gpgme_data_t in = NULL, out = NULL;      gpgme_data_t in = NULL, out = NULL;
# Line 551  decrypt_msg (plugin_ctx_t ctx, char **r_ Line 561  decrypt_msg (plugin_ctx_t ctx, char **r_
561      pass_cb_t cb_val;      pass_cb_t cb_val;
562      char *msg = *r_msg;      char *msg = *r_msg;
563    
564      if ((type & PGP_SIG) || (type & PGP_CLEARSIG))      if ((*type & PGP_SIG) || (*type & PGP_CLEARSIG))
565          return verify_msg (ctx, r_msg);          return verify_msg (ctx, r_msg);
566    
567      cb_val = new_pass_cb (ctx->main_wnd);      cb_val = new_pass_cb (ctx->main_wnd);
# Line 565  decrypt_msg (plugin_ctx_t ctx, char **r_ Line 575  decrypt_msg (plugin_ctx_t ctx, char **r_
575          gpgme_set_passphrase_cb (gctx, passphrase_cb, cb_val);          gpgme_set_passphrase_cb (gctx, passphrase_cb, cb_val);
576          err = gpgme_op_decrypt_verify (gctx, in, out);          err = gpgme_op_decrypt_verify (gctx, in, out);
577          res = gpgme_op_verify_result (gctx);          res = gpgme_op_verify_result (gctx);
578          if (res && res->signatures)          if (res && res->signatures) {
579              DialogBoxParam (mod_hinst_dll, (LPCTSTR)IDD_VERIFY, ctx->main_wnd,              start_verify_dialog (ctx->main_wnd, res->signatures, out);
580                              verify_dlg_proc, (LPARAM)res->signatures);              *type |= PGP_SIG;
581            }
582      }      }
583      *r_cancel = pass_cb_cancelled (cb_val);      *r_cancel = pass_cb_cancelled (cb_val);
584    
# Line 621  winpt_key_import (void) Line 632  winpt_key_import (void)
632  }  }
633    
634    
635    #if 0
636  /* Try to decrypt a PGP/MIME message. */  /* Try to decrypt a PGP/MIME message. */
637  static gpgme_error_t  static gpgme_error_t
638  oe_handle_pgp_mime_mail (plugin_ctx_t ctx)  oe_handle_pgp_mime_mail (plugin_ctx_t ctx)
# Line 647  oe_handle_pgp_mime_mail (plugin_ctx_t ct Line 659  oe_handle_pgp_mime_mail (plugin_ctx_t ct
659    
660      return 0;      return 0;
661  }  }
662    #endif
663    
664    
665  /* This function can be use for all kind of OE messages.  /* This function can be use for all kind of OE messages.
# Line 686  oe_handle_mail (plugin_ctx_t ctx) Line 699  oe_handle_mail (plugin_ctx_t ctx)
699                        _("GPG Plug-in Info"), MB_ICONINFORMATION|MB_OK);                        _("GPG Plug-in Info"), MB_ICONINFORMATION|MB_OK);
700      }      }
701      else if (msg_type) {      else if (msg_type) {
702          rc = decrypt_msg (ctx, &msg, msg_type, &cancel);          rc = decrypt_msg (ctx, &msg, &msg_type, &cancel);
703          SendMessage (ctx->msg_wnd, WM_CLEAR, 0, 0);          SendMessage (ctx->msg_wnd, WM_CLEAR, 0, 0);
704          SendMessage (ctx->msg_wnd, WM_UNDO, 0, 0);          SendMessage (ctx->msg_wnd, WM_UNDO, 0, 0);
705          if (!cancel && !rc && (msg_type & PGP_MESSAGE)          if (!cancel && !rc && (msg_type & PGP_MESSAGE) && !(msg_type & PGP_SIG)
706              && msg && strlen (msg) > 0) {              && msg && strlen (msg) > 0) {
707              struct viewer_ctx_s viewer;              struct viewer_ctx_s viewer;
708              viewer.msg = msg;              viewer.msg = msg;

Legend:
Removed from v.18  
changed lines
  Added in v.23

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26