2 This file is part of GNUnet
3 Copyright (C) 2013 Christian Grothoff (and other contributing authors)
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.
38 #if 0 /* keep Emacsens' auto-indent happy */
43 #include "gnunet_util_lib.h"
46 * Version of the key revocation API.
48 #define GNUNET_REVOCATION_VERSION 0x00000000
51 * Handle for the key revocation query.
53 struct GNUNET_REVOCATION_Query;
56 * Callback to call with the result of a key revocation query.
59 * @param is_valid #GNUNET_NO of the key is/was revoked,
60 * #GNUNET_YES if the key is still valid,
61 * #GNUNET_SYSERR if we had trouble querying the service
64 typedef void (*GNUNET_REVOCATION_Callback) (void *cls,
69 * Check if a key was revoked.
71 * @param cfg the configuration to use
72 * @param key key to check for revocation
73 * @param func funtion to call with the result of the check
74 * @param func_cls closure to pass to @a func
75 * @return handle to use in #GNUNET_REVOCATION_query_cancel to stop REVOCATION from invoking the callback
77 struct GNUNET_REVOCATION_Query *
78 GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg,
79 const struct GNUNET_CRYPTO_EcdsaPublicKey *key,
80 GNUNET_REVOCATION_Callback func, void *func_cls);
84 * Cancel key revocation check.
86 * @param q query to cancel
89 GNUNET_REVOCATION_query_cancel (struct GNUNET_REVOCATION_Query *q);
93 * Handle for the key revocation operation.
95 struct GNUNET_REVOCATION_Handle;
99 * Perform key revocation.
101 * @param cfg the configuration to use
102 * @param key public key of the key to revoke
103 * @param sig signature to use on the revocation (should have been
104 * created using #GNUNET_REVOCATION_sign_revocation).
105 * @param pow proof of work to use (should have been created by
106 * iteratively calling #GNUNET_REVOCATION_check_pow)
107 * @param func funtion to call with the result of the check
108 * (called with `is_valid` being #GNUNET_NO if
109 * the revocation worked).
110 * @param func_cls closure to pass to @a func
111 * @return handle to use in #GNUNET_REVOCATION_revoke_cancel to stop REVOCATION from invoking the callback
113 struct GNUNET_REVOCATION_Handle *
114 GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
115 const struct GNUNET_CRYPTO_EcdsaPublicKey *key,
116 const struct GNUNET_CRYPTO_EcdsaSignature *sig,
118 GNUNET_REVOCATION_Callback func, void *func_cls);
122 * Cancel key revocation.
124 * @param h operation to cancel
127 GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h);
131 * Check if the given proof-of-work value
132 * would be acceptable for revoking the given key.
134 * @param key key to check for
135 * @param pow proof of work value
136 * @param matching_bits how many bits must match (configuration)
137 * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not
140 GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EcdsaPublicKey *key,
142 unsigned int matching_bits);
146 * Create a revocation signature.
148 * @param key private key of the key to revoke
149 * @param sig where to write the revocation signature
152 GNUNET_REVOCATION_sign_revocation (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
153 struct GNUNET_CRYPTO_EcdsaSignature *sig);
156 #if 0 /* keep Emacsens' auto-indent happy */
163 #endif /* GNUNET_REVOCATION_SERVICE_H_ */
165 /** @} */ /* end of group revocation */