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 it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your 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 Affero General Public License for more details.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef GNUNET_REVOCATION_SERVICE_H_
20 #define GNUNET_REVOCATION_SERVICE_H_
23 * @author Christian Grothoff
26 * API to perform and access key revocations
28 * @defgroup revocation Revocation service
29 * Perform and access key revocations.
31 * @see [Documentation](https://gnunet.org/revocation-subsystem)
39 #if 0 /* keep Emacsens' auto-indent happy */
44 #include "gnunet_util_lib.h"
47 * Version of the key revocation API.
49 #define GNUNET_REVOCATION_VERSION 0x00000000
52 * Handle for the key revocation query.
54 struct GNUNET_REVOCATION_Query;
57 * Callback to call with the result of a key revocation query.
60 * @param is_valid #GNUNET_NO of the key is/was revoked,
61 * #GNUNET_YES if the key is still valid,
62 * #GNUNET_SYSERR if we had trouble querying the service
65 typedef void (*GNUNET_REVOCATION_Callback) (void *cls,
70 * Check if a key was revoked.
72 * @param cfg the configuration to use
73 * @param key key to check for revocation
74 * @param func funtion to call with the result of the check
75 * @param func_cls closure to pass to @a func
76 * @return handle to use in #GNUNET_REVOCATION_query_cancel to stop REVOCATION from invoking the callback
78 struct GNUNET_REVOCATION_Query *
79 GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg,
80 const struct GNUNET_CRYPTO_EcdsaPublicKey *key,
81 GNUNET_REVOCATION_Callback func, void *func_cls);
85 * Cancel key revocation check.
87 * @param q query to cancel
90 GNUNET_REVOCATION_query_cancel (struct GNUNET_REVOCATION_Query *q);
94 * Handle for the key revocation operation.
96 struct GNUNET_REVOCATION_Handle;
100 * Perform key revocation.
102 * @param cfg the configuration to use
103 * @param key public key of the key to revoke
104 * @param sig signature to use on the revocation (should have been
105 * created using #GNUNET_REVOCATION_sign_revocation).
106 * @param pow proof of work to use (should have been created by
107 * iteratively calling #GNUNET_REVOCATION_check_pow)
108 * @param func funtion to call with the result of the check
109 * (called with `is_valid` being #GNUNET_NO if
110 * the revocation worked).
111 * @param func_cls closure to pass to @a func
112 * @return handle to use in #GNUNET_REVOCATION_revoke_cancel to stop REVOCATION from invoking the callback
114 struct GNUNET_REVOCATION_Handle *
115 GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
116 const struct GNUNET_CRYPTO_EcdsaPublicKey *key,
117 const struct GNUNET_CRYPTO_EcdsaSignature *sig,
119 GNUNET_REVOCATION_Callback func, void *func_cls);
123 * Cancel key revocation.
125 * @param h operation to cancel
128 GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h);
132 * Check if the given proof-of-work value
133 * would be acceptable for revoking the given key.
135 * @param key key to check for
136 * @param pow proof of work value
137 * @param matching_bits how many bits must match (configuration)
138 * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not
141 GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EcdsaPublicKey *key,
143 unsigned int matching_bits);
147 * Create a revocation signature.
149 * @param key private key of the key to revoke
150 * @param sig where to write the revocation signature
153 GNUNET_REVOCATION_sign_revocation (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
154 struct GNUNET_CRYPTO_EcdsaSignature *sig);
157 #if 0 /* keep Emacsens' auto-indent happy */
164 #endif /* GNUNET_REVOCATION_SERVICE_H_ */
166 /** @} */ /* end of group revocation */