Update Debian Vcs-* fields to point to git repository
[onak.git] / decodekey.h
1 /*
2  * keyindex.h - Routines to list an OpenPGP key.
3  *
4  * Copyright 2002-2008 Jonathan McDowell <noodles@earth.li>
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the Free
8  * Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Software Foundation, Inc., 51
17  * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19
20 #ifndef __DECODEKEY_H__
21 #define __DECODEKEY_H__
22
23 #include <inttypes.h>
24 #include <time.h>
25 #include "keystructs.h"
26 #include "ll.h"
27
28 /**
29  *      keysigs - Return the sigs on a given OpenPGP signature packet list.
30  *      @curll: The current linked list. Can be NULL to create a new list.
31  *      @sigs: The signature list we want the sigs on.
32  *
33  *      Returns a linked list of stats_key elements containing the sigs for the
34  *      supplied OpenPGP signature packet list.
35  */
36 struct ll *keysigs(struct ll *curll,
37                 struct openpgp_packet_list *sigs);
38
39 /**
40  *      sig_info - Get info on a given OpenPGP signature packet
41  *      @packet: The signature packet
42  *      @keyid: A pointer for where to return the signature keyid
43  *      @creation: A pointer for where to return the signature creation time
44  *
45  *      Gets any info about a signature packet; parses the subpackets for a v4
46  *      key or pulls the data directly from v2/3. NULL can be passed for any
47  *      values which aren't cared about.
48  */
49 void sig_info(struct openpgp_packet *packet, uint64_t *keyid, time_t *creation);
50
51 /**
52  *      sig_keyid - Return the keyid for a given OpenPGP signature packet.
53  *      @packet: The signature packet.
54  *
55  *      Returns the keyid for the supplied signature packet.
56  */
57 uint64_t sig_keyid(struct openpgp_packet *packet);
58
59 /**
60  *      keyuids - Takes a key and returns an array of its UIDs
61  *      @key: The key to get the uids of.
62  *      @primary: A pointer to store the primary UID in.
63  *
64  *      keyuids takes a public key structure and builds an array of the UIDs 
65  *      on the key. It also attempts to work out the primary UID and returns a
66  *      separate pointer to that particular element of the array.
67  */
68 char **keyuids(struct openpgp_publickey *key, char **primary);
69
70 /**
71  *      keysubkeys - Takes a key and returns an array of its subkey keyids.
72  *      @key: The key to get the subkeys of.
73  *
74  *      keysubkeys takes a public key structure and returns an array of the
75  *      subkey keyids for that key.
76  */
77 uint64_t *keysubkeys(struct openpgp_publickey *key);
78
79 #endif