47 |
|
|
48 |
#include "openpgp.h" |
#include "openpgp.h" |
49 |
|
|
50 |
|
#define op_begin() SetCursor (LoadCursor (NULL, IDC_WAIT)) |
51 |
|
#define op_end() SetCursor (LoadCursor (NULL, IDC_ARROW)) |
52 |
|
|
53 |
void progress_cleanup (progress_filter_s *pfx); |
void progress_cleanup (progress_filter_s *pfx); |
54 |
BOOL CALLBACK file_secdel_confirm_dlg_proc (HWND dlg, UINT msg, |
BOOL CALLBACK file_secdel_confirm_dlg_proc (HWND dlg, UINT msg, |
55 |
WPARAM wparam, LPARAM lparam); |
WPARAM wparam, LPARAM lparam); |
1018 |
c->dlg, _("Signing")); |
c->dlg, _("Signing")); |
1019 |
c->init_cb = 1; |
c->init_cb = 1; |
1020 |
} |
} |
1021 |
|
op_begin (); |
1022 |
err = gpgme_op_encrypt_sign (ctx, c->recp, GPGME_ENCRYPT_ALWAYS_TRUST, |
err = gpgme_op_encrypt_sign (ctx, c->recp, GPGME_ENCRYPT_ALWAYS_TRUST, |
1023 |
in->dat, out->dat); |
in->dat, out->dat); |
1024 |
|
op_end (); |
1025 |
if (!c->cache_cb) |
if (!c->cache_cb) |
1026 |
release_gpg_passphrase_cb (&c->pass_cb); |
release_gpg_passphrase_cb (&c->pass_cb); |
1027 |
if (c->pass_cb.cancel) { |
if (c->pass_cb.cancel) { |
1037 |
} |
} |
1038 |
} |
} |
1039 |
else { |
else { |
1040 |
|
op_begin (); |
1041 |
err = gpgme_op_encrypt (ctx, c->recp, GPGME_ENCRYPT_ALWAYS_TRUST, |
err = gpgme_op_encrypt (ctx, c->recp, GPGME_ENCRYPT_ALWAYS_TRUST, |
1042 |
in->dat, out->dat); |
in->dat, out->dat); |
1043 |
|
op_end (); |
1044 |
if (err) { |
if (err) { |
1045 |
msg_box (c->dlg, gpgme_strerror (err), _("Encrypt"), MB_ERR); |
msg_box (c->dlg, gpgme_strerror (err), _("Encrypt"), MB_ERR); |
1046 |
rc = WPTERR_GENERAL; |
rc = WPTERR_GENERAL; |
1096 |
if (err) |
if (err) |
1097 |
goto leave; |
goto leave; |
1098 |
|
|
1099 |
err = gpgme_op_encrypt (ctx, NULL, GPGME_ENCRYPT_ALWAYS_TRUST, in->dat, out->dat); |
op_begin (); |
1100 |
|
err = gpgme_op_encrypt (ctx, NULL, GPGME_ENCRYPT_ALWAYS_TRUST, |
1101 |
|
in->dat, out->dat); |
1102 |
|
op_end (); |
1103 |
if (err) { |
if (err) { |
1104 |
msg_box (c->dlg, gpgme_strerror (err), _("Symmetric"), MB_ERR); |
msg_box (c->dlg, gpgme_strerror (err), _("Symmetric"), MB_ERR); |
1105 |
rc = WPTERR_GENERAL; |
rc = WPTERR_GENERAL; |
1218 |
if (err) |
if (err) |
1219 |
goto leave; |
goto leave; |
1220 |
|
|
1221 |
|
op_begin (); |
1222 |
err = gpgme_op_decrypt_verify (ctx, in->dat, out->dat); |
err = gpgme_op_decrypt_verify (ctx, in->dat, out->dat); |
1223 |
|
op_end (); |
1224 |
if (!c->cache_cb) |
if (!c->cache_cb) |
1225 |
release_gpg_passphrase_cb (&c->pass_cb); |
release_gpg_passphrase_cb (&c->pass_cb); |
1226 |
if (c->pass_cb.cancel) { |
if (c->pass_cb.cancel) { |
1302 |
if (err) |
if (err) |
1303 |
goto leave; |
goto leave; |
1304 |
|
|
1305 |
|
op_begin (); |
1306 |
err = gpgme_op_sign (ctx, in->dat, out->dat, c->sigmode); |
err = gpgme_op_sign (ctx, in->dat, out->dat, c->sigmode); |
1307 |
|
op_end (); |
1308 |
if( !c->cache_cb ) |
if( !c->cache_cb ) |
1309 |
release_gpg_passphrase_cb (&c->pass_cb); |
release_gpg_passphrase_cb (&c->pass_cb); |
1310 |
if( c->pass_cb.cancel ) { |
if( c->pass_cb.cancel ) { |
1506 |
if (err) |
if (err) |
1507 |
goto leave; |
goto leave; |
1508 |
|
|
1509 |
|
op_begin (); |
1510 |
if (c->sigmode == GPGME_SIG_MODE_DETACH) |
if (c->sigmode == GPGME_SIG_MODE_DETACH) |
1511 |
err = gpgme_op_verify (ctx, in->dat, out->dat, NULL); |
err = gpgme_op_verify (ctx, in->dat, out->dat, NULL); |
1512 |
else |
else |
1513 |
err = gpgme_op_verify (ctx, in->dat, in->dat, out->dat); |
err = gpgme_op_verify (ctx, in->dat, in->dat, out->dat); |
1514 |
|
op_end (); |
1515 |
if (err) { |
if (err) { |
1516 |
msg_box (c->dlg, gpgme_strerror (err), _("Verify"), MB_ERR); |
msg_box (c->dlg, gpgme_strerror (err), _("Verify"), MB_ERR); |
1517 |
rc = WPTERR_GENERAL; |
rc = WPTERR_GENERAL; |
1555 |
if (err) |
if (err) |
1556 |
goto leave; |
goto leave; |
1557 |
|
|
1558 |
|
op_begin (); |
1559 |
err = gpgme_op_import (ctx, keydata->dat); |
err = gpgme_op_import (ctx, keydata->dat); |
1560 |
|
op_end (); |
1561 |
if (err) { |
if (err) { |
1562 |
msg_box (c->dlg, gpgme_strerror (err), _("Import"), MB_ERR); |
msg_box (c->dlg, gpgme_strerror (err), _("Import"), MB_ERR); |
1563 |
rc = WPTERR_GENERAL; |
rc = WPTERR_GENERAL; |
1620 |
if (err) |
if (err) |
1621 |
goto leave; |
goto leave; |
1622 |
|
|
1623 |
|
op_begin (); |
1624 |
err = gpgme_op_export (ctx, patt, 0, keydata->dat); |
err = gpgme_op_export (ctx, patt, 0, keydata->dat); |
1625 |
|
op_end (); |
1626 |
if (err) { |
if (err) { |
1627 |
msg_box (c->dlg, gpgme_strerror (err), _("Export"), MB_ERR); |
msg_box (c->dlg, gpgme_strerror (err), _("Export"), MB_ERR); |
1628 |
rc = WPTERR_GENERAL; |
rc = WPTERR_GENERAL; |
1672 |
else |
else |
1673 |
fn = m_strdup (p); |
fn = m_strdup (p); |
1674 |
s = fm_get_file_type (fn, &type); |
s = fm_get_file_type (fn, &type); |
|
log_box ("debug", MB_OK, "%s %d", s, type); |
|
1675 |
if (!s || !strcmp (s, "UNKNOWN")) |
if (!s || !strcmp (s, "UNKNOWN")) |
1676 |
s = gnupg_check_file_ext (fn, &type); |
s = gnupg_check_file_ext (fn, &type); |
1677 |
if (type == PGP_NONE) { |
if (type == PGP_NONE) { |
1680 |
free_if_alloc (fn); |
free_if_alloc (fn); |
1681 |
return count; |
return count; |
1682 |
} |
} |
|
|
|
|
log_box ("debug", MB_OK, "type=%d", type); /*XXX: debug*/ |
|
1683 |
switch (type) { |
switch (type) { |
1684 |
case PGP_MESSAGE: |
case PGP_MESSAGE: |
1685 |
fm_decrypt (ctx, fn); |
fm_decrypt (ctx, fn); |