2 * cleankey.h - Routines to look for common key problems and clean them up.
4 * Copyright 2004 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, see <https://www.gnu.org/licenses/>.
19 #ifndef __CLEANKEY_H__
20 #define __CLEANKEY_H__
23 #include "keystructs.h"
25 #define ONAK_CLEAN_CHECK_SIGHASH (1 << 0)
26 #define ONAK_CLEAN_LARGE_PACKETS (1 << 1)
27 #define ONAK_CLEAN_DROP_V3_KEYS (1 << 2)
28 #define ONAK_CLEAN_UPDATE_ONLY (1 << 3)
29 #define ONAK_CLEAN_VERIFY_SIGNATURES (1 << 4)
30 #define ONAK_CLEAN_NEED_OTHER_SIG (1 << 5)
31 #define ONAK_CLEAN_ALL (uint64_t) -1
34 * cleankeys - Apply all available cleaning options on a list of keys.
35 * @dbctx: A database context suitable for looking up signing keys
36 * @publickey: The list of keys to clean.
37 * @policies: The cleaning policies to apply.
39 * Applies the requested cleaning policies to a list of keys. These are
40 * specified from the ONAK_CLEAN_* set of flags, or ONAK_CLEAN_ALL to
41 * apply all available cleaning options. Returns 0 if no changes were
42 * made, otherwise the number of keys cleaned. Note that some options
43 * may result in keys being removed entirely from the list.
45 int cleankeys(struct onak_dbctx *dbctx, struct openpgp_publickey **keys,