~ubuntu-branches/ubuntu/maverick/mutt/maverick-updates

1.1.2 by Martin Pitt
Import upstream version 1.5.11+cvs20060403
1
/* 
2
 * Copyright (C) 2004 g10 Code GmbH
3
 *
4
 *     This program is free software; you can redistribute it and/or modify
5
 *     it under the terms of the GNU General Public License as published by
6
 *     the Free Software Foundation; either version 2 of the License, or
7
 *     (at your option) any later version.
8
 * 
9
 *     This program is distributed in the hope that it will be useful,
10
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 *     GNU General Public License for more details.
13
 * 
14
 *     You should have received a copy of the GNU General Public License
15
 *     along with this program; if not, write to the Free Software
16
 *     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17
 */
18
19
/* 
20
    This is a crytpo module wrapping the gpgme based pgp code.
21
 */
22
23
#if HAVE_CONFIG_H
24
# include "config.h"
25
#endif
26
27
#ifdef CRYPT_BACKEND_GPGME
28
29
#include "crypt-mod.h"
30
#include "crypt-gpgme.h"
31
32
static void crypt_mod_pgp_init (void)
33
{
34
  pgp_gpgme_init ();
35
}
36
37
static void crypt_mod_pgp_void_passphrase (void)
38
{
39
  /* Handled by gpg-agent.  */
40
}
41
42
static int crypt_mod_pgp_valid_passphrase (void)
43
{
44
  /* Handled by gpg-agent.  */
45
  return 1;
46
}
47
48
static int crypt_mod_pgp_decrypt_mime (FILE *a, FILE **b, BODY *c, BODY **d)
49
{
50
  return pgp_gpgme_decrypt_mime (a, b, c, d);
51
}
52
53
static int crypt_mod_pgp_application_handler (BODY *m, STATE *s)
54
{
55
  return pgp_gpgme_application_handler (m, s);
56
}
57
58
static int crypt_mod_pgp_encrypted_handler (BODY *m, STATE *s)
59
{
60
  return pgp_gpgme_encrypted_handler (m, s);
61
}
62
63
static int crypt_mod_pgp_check_traditional (FILE *fp, BODY *b, int tagged_only)
64
{
65
  return pgp_gpgme_check_traditional (fp, b, tagged_only);
66
}
67
68
static char *crypt_mod_pgp_findkeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc)
69
{
70
  return pgp_gpgme_findkeys (to, cc, bcc);
71
}
72
73
static BODY *crypt_mod_pgp_sign_message (BODY *a)
74
{
75
  return pgp_gpgme_sign_message (a);
76
}
77
78
static int crypt_mod_pgp_verify_one (BODY *sigbdy, STATE *s, const char *tempf)
79
{
80
  return pgp_gpgme_verify_one (sigbdy, s, tempf);
81
}
82
83
static int crypt_mod_pgp_send_menu (HEADER *msg, int *redraw)
84
{
85
  return pgp_gpgme_send_menu (msg, redraw);
86
}
87
88
static BODY *crypt_mod_pgp_encrypt_message (BODY *a, char *keylist, int sign)
89
{
90
  return pgp_gpgme_encrypt_message (a, keylist, sign);
91
}
92
1.1.5 by Christoph Berg
Import upstream version 1.5.15+20070412
93
static void crypt_mod_pgp_set_sender (const char *sender)
94
{
95
  gpgme_set_sender (sender);
96
}
97
1.1.2 by Martin Pitt
Import upstream version 1.5.11+cvs20060403
98
struct crypt_module_specs crypt_mod_pgp_gpgme =
99
  { APPLICATION_PGP,
100
    {
101
      /* Common.  */
102
      crypt_mod_pgp_init,
103
      crypt_mod_pgp_void_passphrase,
104
      crypt_mod_pgp_valid_passphrase,
105
      crypt_mod_pgp_decrypt_mime,
106
      crypt_mod_pgp_application_handler,
107
      crypt_mod_pgp_encrypted_handler,
108
      crypt_mod_pgp_findkeys,
109
      crypt_mod_pgp_sign_message,
110
      crypt_mod_pgp_verify_one,
111
      crypt_mod_pgp_send_menu,
1.1.5 by Christoph Berg
Import upstream version 1.5.15+20070412
112
      crypt_mod_pgp_set_sender,
1.1.2 by Martin Pitt
Import upstream version 1.5.11+cvs20060403
113
114
      /* PGP specific.  */
115
      crypt_mod_pgp_encrypt_message,
116
      NULL,			/* pgp_make_key_attachment, */
117
      crypt_mod_pgp_check_traditional,
118
      NULL, 			/* pgp_traditional_encryptsign  */
119
      NULL, /* pgp_invoke_getkeys  */
120
      NULL, /* pgp_invoke_import  */
121
      NULL, /* pgp_extract_keys_from_attachment_list  */
122
123
      NULL,			/* smime_getkeys */
124
      NULL,			/* smime_verify_sender */
125
      NULL,			/* smime_build_smime_entity */
126
      NULL,			/* smime_invoke_import */
127
    }
128
  };
129
130
#endif