2 * keyindex.h - Routines to list an OpenPGP key.
4 * Copyright 2002-2008 Jonathan McDowell <noodles@earth.li>
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.
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
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.
20 #ifndef __DECODEKEY_H__
21 #define __DECODEKEY_H__
25 #include "keystructs.h"
30 * keysigs - Return the sigs on a given OpenPGP signature packet list.
31 * @curll: The current linked list. Can be NULL to create a new list.
32 * @sigs: The signature list we want the sigs on.
34 * Returns a linked list of stats_key elements containing the sigs for the
35 * supplied OpenPGP signature packet list.
37 struct ll *keysigs(struct ll *curll,
38 struct openpgp_packet_list *sigs);
41 * sig_info - Get info on a given OpenPGP signature packet
42 * @packet: The signature packet
43 * @keyid: A pointer for where to return the signature keyid
44 * @creation: A pointer for where to return the signature creation time
46 * Gets any info about a signature packet; parses the subpackets for a v4
47 * key or pulls the data directly from v2/3. NULL can be passed for any
48 * values which aren't cared about.
50 onak_status_t sig_info(struct openpgp_packet *packet, uint64_t *keyid,
54 * sig_keyid - Return the keyid for a given OpenPGP signature packet.
55 * @packet: The signature packet.
57 * Returns the keyid for the supplied signature packet.
59 uint64_t sig_keyid(struct openpgp_packet *packet);
62 * keyuids - Takes a key and returns an array of its UIDs
63 * @key: The key to get the uids of.
64 * @primary: A pointer to store the primary UID in.
66 * keyuids takes a public key structure and builds an array of the UIDs
67 * on the key. It also attempts to work out the primary UID and returns a
68 * separate pointer to that particular element of the array.
70 char **keyuids(struct openpgp_publickey *key, char **primary);
73 * keysubkeys - Takes a key & returns an array of its subkey fingerprints
74 * @key: The key to get the subkeys of.
76 * keysubkeys takes a public key structure and returns an array of the
77 * subkey fingerprints for that key.
79 struct openpgp_fingerprint *keysubkeys(struct openpgp_publickey *key);
82 * parse_subpackets - Parse the subpackets of a Type 4 signature.
83 * @data: The subpacket data.
84 * @len: The amount of data available to read.
85 * @parselen: The amount of data that was actually parsed.
86 * @keyid: A pointer to where we should return the keyid.
87 * @creationtime: A pointer to where we should return the creation time.
89 * This function parses the subkey data of a Type 4 signature and fills
90 * in the supplied variables. It also returns the length of the data
91 * processed. If the value of any piece of data is not desired a NULL
92 * can be passed instead of a pointer to a storage area for that value.
94 onak_status_t parse_subpackets(unsigned char *data, size_t len,
95 size_t *parselen, uint64_t *keyid, time_t *creation);