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., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
21 #ifndef GNUNET_REVOCATION_SERVICE_H_
22 #define GNUNET_REVOCATION_SERVICE_H_
25 * @file include/gnunet_revocation_service.h
26 * @brief API to perform and access key revocations
27 * @author Christian Grothoff
28 * @defgroup revocation key revocation service
35 #if 0 /* keep Emacsens' auto-indent happy */
40 #include "gnunet_util_lib.h"
43 * Version of the key revocation API.
45 #define GNUNET_REVOCATION_VERSION 0x00000000
48 * Handle for the key revocation query.
50 struct GNUNET_REVOCATION_Query;
53 * Callback to call with the result of a key revocation query.
56 * @param is_valid #GNUNET_NO of the key is/was revoked,
57 * #GNUNET_YES if the key is still valid,
58 * #GNUNET_SYSERR if we had trouble querying the service
61 typedef void (*GNUNET_REVOCATION_Callback) (void *cls,
66 * Check if a key was revoked.
68 * @param cfg the configuration to use
69 * @param key key to check for revocation
70 * @param func funtion to call with the result of the check
71 * @param func_cls closure to pass to @a func
72 * @return handle to use in #GNUNET_REVOCATION_query_cancel to stop REVOCATION from invoking the callback
74 struct GNUNET_REVOCATION_Query *
75 GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg,
76 const struct GNUNET_CRYPTO_EcdsaPublicKey *key,
77 GNUNET_REVOCATION_Callback func, void *func_cls);
81 * Cancel key revocation check.
83 * @param q query to cancel
86 GNUNET_REVOCATION_query_cancel (struct GNUNET_REVOCATION_Query *q);
90 * Handle for the key revocation operation.
92 struct GNUNET_REVOCATION_Handle;
96 * Perform key revocation.
98 * @param cfg the configuration to use
99 * @param key public key of the key to revoke
100 * @param sig signature to use on the revocation (should have been
101 * created using #GNUNET_REVOCATION_sign_revocation).
102 * @param pow proof of work to use (should have been created by
103 * iteratively calling #GNUNET_REVOCATION_check_pow)
104 * @param func funtion to call with the result of the check
105 * (called with `is_valid` being #GNUNET_NO if
106 * the revocation worked).
107 * @param func_cls closure to pass to @a func
108 * @return handle to use in #GNUNET_REVOCATION_revoke_cancel to stop REVOCATION from invoking the callback
110 struct GNUNET_REVOCATION_Handle *
111 GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
112 const struct GNUNET_CRYPTO_EcdsaPublicKey *key,
113 const struct GNUNET_CRYPTO_EcdsaSignature *sig,
115 GNUNET_REVOCATION_Callback func, void *func_cls);
119 * Cancel key revocation.
121 * @param h operation to cancel
124 GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h);
128 * Check if the given proof-of-work value
129 * would be acceptable for revoking the given key.
131 * @param key key to check for
132 * @param pow proof of work value
133 * @param matching_bits how many bits must match (configuration)
134 * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not
137 GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EcdsaPublicKey *key,
139 unsigned int matching_bits);
143 * Create a revocation signature.
145 * @param key private key of the key to revoke
146 * @param sig where to write the revocation signature
149 GNUNET_REVOCATION_sign_revocation (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
150 struct GNUNET_CRYPTO_EcdsaSignature *sig);
153 #if 0 /* keep Emacsens' auto-indent happy */
160 /** @} */ /* end of group revocation */
162 #endif /* GNUNET_REVOCATION_SERVICE_H_ */