~ubuntu-branches/ubuntu/lucid/mutt/lucid-updates

1.1.2 by Martin Pitt
Import upstream version 1.5.11+cvs20060403
1
/*
2
 * Copyright (C) 1996,1997 Michael R. Elkins <me@mutt.org>
3
 * Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
4
 *
5
 *     This program is free software; you can redistribute it and/or modify
6
 *     it under the terms of the GNU General Public License as published by
7
 *     the Free Software Foundation; either version 2 of the License, or
8
 *     (at your option) any later version.
9
 * 
10
 *     This program is distributed in the hope that it will be useful,
11
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *     GNU General Public License for more details.
14
 * 
15
 *     You should have received a copy of the GNU General Public License
16
 *     along with this program; if not, write to the Free Software
17
 *     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
 */
19
20
#ifdef CRYPT_BACKEND_CLASSIC_PGP
21
22
#include "mutt_crypt.h"
23
24
25
typedef struct pgp_signature
26
{
27
  struct pgp_signature *next;
28
  unsigned char sigtype;
29
  unsigned long sid1;
30
  unsigned long sid2;
31
}
32
pgp_sig_t;
33
34
struct pgp_keyinfo
35
{
36
  char *keyid;
37
  struct pgp_uid *address;
38
  int flags;
39
  short keylen;
40
  time_t gen_time;
41
  int numalg;
42
  const char *algorithm;
43
  struct pgp_keyinfo *parent;
44
  struct pgp_signature *sigs;
45
  struct pgp_keyinfo *next;
46
47
  short fp_len;			  /* length of fingerprint.
48
				   * 20 for sha-1, 16 for md5.
49
				   */
50
  unsigned char fingerprint[20];  /* large enough to hold SHA-1 and RIPEMD160
51
                                     hashes (20 bytes), MD5 hashes just use the
52
                                     first 16 bytes */
53
};
54
/* Note, that pgp_key_t is now pointer and declared in crypt.h */
55
56
typedef struct pgp_uid
57
{
58
  char *addr;
59
  short trust;
60
  int flags;
61
  struct pgp_keyinfo *parent;
62
  struct pgp_uid *next;
63
  struct pgp_signature *sigs;
64
}
65
pgp_uid_t;
66
67
enum pgp_version
68
{
69
  PGP_V2,
70
  PGP_V3,
71
  PGP_GPG,
72
  PGP_UNKNOWN
73
};
74
75
/* prototypes */
76
77
const char *pgp_pkalgbytype (unsigned char);
78
79
pgp_key_t pgp_remove_key (pgp_key_t *, pgp_key_t );
80
pgp_uid_t *pgp_copy_uids (pgp_uid_t *, pgp_key_t );
81
82
short pgp_canencrypt (unsigned char);
83
short pgp_cansign (unsigned char);
84
short pgp_get_abilities (unsigned char);
85
86
void pgp_free_key (pgp_key_t *kpp);
87
88
#define pgp_new_keyinfo() safe_calloc (sizeof *((pgp_key_t)0), 1)
89
90
#endif /* CRYPT_BACKEND_CLASSIC_PGP */