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

Diff of /trunk/Src/wptSymEnc.cpp

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

revision 181 by twoaday, Tue Mar 14 11:01:22 2006 UTC revision 228 by twoaday, Thu Jun 15 11:37:53 2006 UTC
# Line 1  Line 1 
1  /* wptSymEnc.cpp - Symmetric encryption support  /* wptSymEnc.cpp - Symmetric encryption support
2   *      Copyright (C) 2002, 2003, 2004, 2005 Timo Schulz   *      Copyright (C) 2002-2006 Timo Schulz
3   *   *
4   * This file is part of WinPT.   * This file is part of WinPT.
5   *   *
# Line 59  sym_passphrase_cb (void *hook, const cha Line 59  sym_passphrase_cb (void *hook, const cha
59    
60  /* Perform symmetric encryption on the current clipboard data.  /* Perform symmetric encryption on the current clipboard data.
61     Return 0 for success. */     Return 0 for success. */
62  int  gpgme_error_t
63  gpg_encrypt_symmetric (void)  gpg_clip_sym_encrypt (void)
64  {  {
65      gpgme_ctx_t ctx;      gpgme_ctx_t ctx;
66      gpgme_data_t plain=NULL;      gpgme_data_t plain=NULL;
# Line 80  gpg_encrypt_symmetric (void) Line 80  gpg_encrypt_symmetric (void)
80      if (rc)      if (rc)
81          goto leave;          goto leave;
82      rc = gpgme_data_new (&ciph);      rc = gpgme_data_new (&ciph);
83        if (rc)
84            goto leave;
85      gpgme_set_armor (ctx, 1);      gpgme_set_armor (ctx, 1);
86        gpgme_set_textmode (ctx, 1);
87    
88      gpgme_set_passphrase_cb (ctx, sym_passphrase_cb, pass);      gpgme_set_passphrase_cb (ctx, sym_passphrase_cb, pass);
89    
90      rc = gpgme_op_encrypt (ctx, NULL, (gpgme_encrypt_flags_t)0, plain, ciph);          rc = gpgme_op_encrypt (ctx, NULL, (gpgme_encrypt_flags_t)0, plain, ciph);
91      if (rc)      if (rc)
92          msg_box (NULL, gpgme_strerror (rc), _("Symmetric Encryption"), MB_ERR);          msg_box (NULL, gpgme_strerror (rc), _("Symmetric Encryption"), MB_ERR);
93      else {      else {
# Line 100  leave: Line 103  leave:
103          gpgme_data_release (ciph);          gpgme_data_release (ciph);
104      gpgme_release (ctx);      gpgme_release (ctx);
105      sfree_if_alloc (pass);      sfree_if_alloc (pass);
106      return rc? WPTERR_GENERAL : 0;      return rc;
107  }  }

Legend:
Removed from v.181  
changed lines
  Added in v.228

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26