2 This file is part of GNUnet
3 Copyright (C) 2013 GNUnet e.V.
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public Licerevocation as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public Licerevocation for more details.
15 You should have received a copy of the GNU General Public Licerevocation
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
21 #ifndef GNUNET_REVOCATION_SERVICE_H_
22 #define GNUNET_REVOCATION_SERVICE_H_
25 * @author Christian Grothoff
28 * API to perform and access key revocations
30 * @defgroup revocation Revocation service
31 * Perform and access key revocations.
33 * @see [Documentation](https://gnunet.org/revocation-subsystem)
41 #if 0 /* keep Emacsens' auto-indent happy */
46 #include "gnunet_util_lib.h"
49 * Version of the key revocation API.
51 #define GNUNET_REVOCATION_VERSION 0x00000000
54 * Handle for the key revocation query.
56 struct GNUNET_REVOCATION_Query;
59 * Callback to call with the result of a key revocation query.
62 * @param is_valid #GNUNET_NO of the key is/was revoked,
63 * #GNUNET_YES if the key is still valid,
64 * #GNUNET_SYSERR if we had trouble querying the service
67 typedef void (*GNUNET_REVOCATION_Callback) (void *cls,
72 * Check if a key was revoked.
74 * @param cfg the configuration to use
75 * @param key key to check for revocation
76 * @param func funtion to call with the result of the check
77 * @param func_cls closure to pass to @a func
78 * @return handle to use in #GNUNET_REVOCATION_query_cancel to stop REVOCATION from invoking the callback
80 struct GNUNET_REVOCATION_Query *
81 GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg,
82 const struct GNUNET_CRYPTO_EcdsaPublicKey *key,
83 GNUNET_REVOCATION_Callback func, void *func_cls);
87 * Cancel key revocation check.
89 * @param q query to cancel
92 GNUNET_REVOCATION_query_cancel (struct GNUNET_REVOCATION_Query *q);
96 * Handle for the key revocation operation.
98 struct GNUNET_REVOCATION_Handle;
102 * Perform key revocation.
104 * @param cfg the configuration to use
105 * @param key public key of the key to revoke
106 * @param sig signature to use on the revocation (should have been
107 * created using #GNUNET_REVOCATION_sign_revocation).
108 * @param pow proof of work to use (should have been created by
109 * iteratively calling #GNUNET_REVOCATION_check_pow)
110 * @param func funtion to call with the result of the check
111 * (called with `is_valid` being #GNUNET_NO if
112 * the revocation worked).
113 * @param func_cls closure to pass to @a func
114 * @return handle to use in #GNUNET_REVOCATION_revoke_cancel to stop REVOCATION from invoking the callback
116 struct GNUNET_REVOCATION_Handle *
117 GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
118 const struct GNUNET_CRYPTO_EcdsaPublicKey *key,
119 const struct GNUNET_CRYPTO_EcdsaSignature *sig,
121 GNUNET_REVOCATION_Callback func, void *func_cls);
125 * Cancel key revocation.
127 * @param h operation to cancel
130 GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h);
134 * Check if the given proof-of-work value
135 * would be acceptable for revoking the given key.
137 * @param key key to check for
138 * @param pow proof of work value
139 * @param matching_bits how many bits must match (configuration)
140 * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not
143 GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EcdsaPublicKey *key,
145 unsigned int matching_bits);
149 * Create a revocation signature.
151 * @param key private key of the key to revoke
152 * @param sig where to write the revocation signature
155 GNUNET_REVOCATION_sign_revocation (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
156 struct GNUNET_CRYPTO_EcdsaSignature *sig);
159 #if 0 /* keep Emacsens' auto-indent happy */
166 #endif /* GNUNET_REVOCATION_SERVICE_H_ */
168 /** @} */ /* end of group revocation */