3 * @brief Structures for OpenPGP keys
5 * Copyright 2002 Jonathan McDowell <noodles@earth.li>
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; version 2 of the License.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc., 51
18 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef __KEYSTRUCTS_H__
22 #define __KEYSTRUCTS_H__
30 /* v3 MD5 fingerprint is 16 characters, v4 SHA-1 fingerprint is 20 */
31 #define MAX_FINGERPRINT_LEN 20
34 * @brief Stores an OpenPGP packet.
36 * This structure holds any form of OpenPGP packet with minimum common
37 * details decoded out.
39 struct openpgp_packet {
40 /** The packet tag (i.e. type). */
42 /** Indicates if this is a new format packet. */
44 /** The length of the packet. */
46 /** The actual packet data. */
51 * @brief A linked list of OpenPGP packets.
53 * This structure is used to hold a linked list of packets, for example
54 * all the signatures of a public key's UID.
56 struct openpgp_packet_list {
57 /** The actual packet structure. */
58 struct openpgp_packet *packet;
59 /** A pointer to the next packet in the list. */
60 struct openpgp_packet_list *next;
64 * @brief A packet with signatures.
66 * This structure holds an OpenPGP packet along with signatures that are
67 * over this packet. It also links to the next signed packet. It's usually
68 * used to hold a UID or subkey with their associated signatures.
70 struct openpgp_signedpacket_list {
71 /** The OpenPGP packet that's signed. */
72 struct openpgp_packet *packet;
73 /** A linked list of sigs for the packet. */
74 struct openpgp_packet_list *sigs;
75 /** Pointer to the last sig in the sigs linked list */
76 struct openpgp_packet_list *last_sig;
77 /** A pointer to the next packet with signatures. */
78 struct openpgp_signedpacket_list *next;
82 * @brief An OpenPGP public key complete with sigs.
84 struct openpgp_publickey {
85 /** The OpenPGP packet for the public key. */
86 struct openpgp_packet *publickey;
87 /** True if the key is revoked. */
89 /** Any signatures directly on the @a publickey packet. */
90 struct openpgp_packet_list *sigs;
91 /** Pointer to the end of the @a sigs list */
92 struct openpgp_packet_list *last_sig;
93 /** The list of UIDs with signatures for this key. */
94 struct openpgp_signedpacket_list *uids;
95 /** Pointer to the end of the @a uids list */
96 struct openpgp_signedpacket_list *last_uid;
97 /** The list of subkeys with signatures for this key. */
98 struct openpgp_signedpacket_list *subkeys;
99 /** Pointer to the end of the @a subkey list */
100 struct openpgp_signedpacket_list *last_subkey;
101 /** The next public key. */
102 struct openpgp_publickey *next;
106 * @brief Holds an SKS key hash (md5 over sorted packet list)
109 /** The 128 bit MD5 hash of the sorted packet list from the key */
113 #endif /* __KEYSTRUCTS_H__ */