cscvs to tla changeset 1
[onak.git] / keystructs.h
1 /*
2  * keystructs.h - Structures for OpenPGP keys
3  *
4  * Jonathan McDowell <noodles@earth.li>
5  *
6  * Copyright 2002 Project Purple
7  */
8
9 #ifndef __KEYSTRUCTS_H__
10 #define __KEYSTRUCTS_H__
11
12 #include <stdbool.h>
13
14 /**
15  *      struct openpgp_packet - Stores an OpenPGP packet.
16  *      @tag: The packet tag (ie type).
17  *      @newformat: Indicates if this is a new format packet.
18  *      @length: The length of the packet.
19  *      @data: The actual packet
20  *
21  *      This structure holds any form of OpenPGP packet with minimum common
22  *      details decoded out.
23  */
24 struct openpgp_packet {
25         unsigned int tag;
26         bool newformat;
27         size_t length;
28         unsigned char *data;
29 };
30
31 /**
32  *      struct openpgp_packet_list - A linked list of OpenPGP packets.
33  *      @packet: The actual packet structure.
34  *      @next: A pointer to the next packet in the list.
35  *
36  *      This structure is used to hold a linked list of packets, for example
37  *      all the signatures of a public key's UID.
38  */
39 struct openpgp_packet_list {
40         struct openpgp_packet *packet;
41         struct openpgp_packet_list *next;
42 };
43
44 /**
45  *      struct openpgp_signedpacket_list - A packet with signatures.
46  *      @uid: The OpenPGP packet that's signed.
47  *      @sigs: A list of sigs for the packet.
48  *      @next: A pointer to the next packet with signatures.
49  *
50  *      This structure holds an OpenPGP packet along with signatures that are
51  *      over this packet. It also links to the next signed packet. It's usually
52  *      used to hold a UID or subkey with their associated signatures.
53  */
54 struct openpgp_signedpacket_list {
55         struct openpgp_packet *packet;
56         struct openpgp_packet_list *sigs;
57         struct openpgp_packet_list *last_sig;
58         struct openpgp_signedpacket_list *next;
59 };
60
61 /**
62  *      struct openpgp_publickey - An OpenPGP public key complete with sigs.
63  *      @publickey: The OpenPGP packet for the public key.
64  *      @revocation: The OpenPGP packet for the revocation [optional]
65  *      @uids: The list of UIDs with signatures for this key.
66  *      @subkeys: The list of subkeys with signatures for this key.
67  *      @next: The next public key.
68  */
69 struct openpgp_publickey {
70         struct openpgp_packet                   *publickey;
71         struct openpgp_packet_list              *revocations;
72         struct openpgp_packet_list              *last_revocation;
73         struct openpgp_signedpacket_list        *uids;
74         struct openpgp_signedpacket_list        *last_uid;
75         struct openpgp_signedpacket_list        *subkeys;
76         struct openpgp_signedpacket_list        *last_subkey;
77         struct openpgp_publickey                *next;
78 };
79
80 #endif /* __KEYSTRUCTS_H__ */