diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-30 18:00:11 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-30 18:00:11 +0000 |
commit | 28018959b9afc2a8259f35e074869fd88b31b03e (patch) | |
tree | 5e779c55eab35f3887a82103fa0a0178117dfc27 /src/include/gnunet_revocation_service.h | |
parent | 5aa6d40f357879fa5048161c8d8c689688c4c254 (diff) | |
download | gnunet-28018959b9afc2a8259f35e074869fd88b31b03e.tar.gz gnunet-28018959b9afc2a8259f35e074869fd88b31b03e.zip |
adding skeleton for revocation service
Diffstat (limited to 'src/include/gnunet_revocation_service.h')
-rw-r--r-- | src/include/gnunet_revocation_service.h | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/src/include/gnunet_revocation_service.h b/src/include/gnunet_revocation_service.h new file mode 100644 index 000000000..772dbbe75 --- /dev/null +++ b/src/include/gnunet_revocation_service.h | |||
@@ -0,0 +1,143 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | (C) 2013 Christian Grothoff (and other contributing authors) | ||
4 | |||
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. | ||
9 | |||
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. | ||
14 | |||
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. | ||
19 | */ | ||
20 | |||
21 | #ifndef GNUNET_REVOCATION_SERVICE_H_ | ||
22 | #define GNUNET_REVOCATION_SERVICE_H_ | ||
23 | |||
24 | /** | ||
25 | * @file include/gnunet_revocation_service.h | ||
26 | * @brief API to perform and access key revocations | ||
27 | * @defgroup revocation key revocation service | ||
28 | * @{ | ||
29 | */ | ||
30 | |||
31 | #ifdef __cplusplus | ||
32 | extern "C" | ||
33 | { | ||
34 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
35 | } | ||
36 | #endif | ||
37 | #endif | ||
38 | |||
39 | #include "gnunet_util_lib.h" | ||
40 | |||
41 | /** | ||
42 | * Version of the key revocation API. | ||
43 | */ | ||
44 | #define GNUNET_REVOCATION_VERSION 0x00000000 | ||
45 | |||
46 | /** | ||
47 | * Handle for the key revocation query. | ||
48 | */ | ||
49 | struct GNUNET_REVOCATION_Query; | ||
50 | |||
51 | /** | ||
52 | * Callback to call with the result of a key revocation query. | ||
53 | * | ||
54 | * @param cls closure | ||
55 | * @param is_valid #GNUNET_NO of the key is/was revoked, | ||
56 | * #GNUNET_YES if the key is still valid | ||
57 | * | ||
58 | */ | ||
59 | typedef void (*GNUNET_REVOCATION_Callback) (void *cls, | ||
60 | int is_valid); | ||
61 | |||
62 | |||
63 | /** | ||
64 | * Check if a key was revoked. | ||
65 | * | ||
66 | * @param cfg the configuration to use | ||
67 | * @param key key to check for revocation | ||
68 | * @param func funtion to call with the result of the check | ||
69 | * @param func_cls closure to pass to @a func | ||
70 | * @return handle to use in #GNUNET_REVOCATION_query_cancel to stop REVOCATION from invoking the callback | ||
71 | */ | ||
72 | struct GNUNET_REVOCATION_Query * | ||
73 | GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
74 | const struct GNUNET_CRYPTO_EccPublicSignKey *key, | ||
75 | GNUNET_REVOCATION_Callback func, void *func_cls); | ||
76 | |||
77 | |||
78 | /** | ||
79 | * Cancel key revocation check. | ||
80 | * | ||
81 | * @param q query to cancel | ||
82 | */ | ||
83 | void | ||
84 | GNUNET_REVOCATION_query_cancel (struct GNUNET_REVOCATION_Query *q); | ||
85 | |||
86 | |||
87 | /** | ||
88 | * Handle for the key revocation operation. | ||
89 | */ | ||
90 | struct GNUNET_REVOCATION_Handle; | ||
91 | |||
92 | |||
93 | /** | ||
94 | * Perform key revocation. | ||
95 | * | ||
96 | * @param cfg the configuration to use | ||
97 | * @param key key to revoke | ||
98 | * @param pow proof of work to use | ||
99 | * @param func funtion to call with the result of the check | ||
100 | * (called with `is_valid` being #GNUNET_NO if | ||
101 | * the revocation worked). | ||
102 | * @param func_cls closure to pass to @a func | ||
103 | * @return handle to use in #GNUNET_REVOCATION_cancel to stop REVOCATION from invoking the callback | ||
104 | */ | ||
105 | struct GNUNET_REVOCATION_Handle * | ||
106 | GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
107 | const struct GNUNET_CRYPTO_EccPrivateKey *key, | ||
108 | uint64_t pow, | ||
109 | GNUNET_REVOCATION_Callback func, void *func_cls); | ||
110 | |||
111 | |||
112 | /** | ||
113 | * Cancel key revocation. | ||
114 | * | ||
115 | * @param h operation to cancel | ||
116 | */ | ||
117 | void | ||
118 | GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h); | ||
119 | |||
120 | |||
121 | /** | ||
122 | * Check if the given proof-of-work value | ||
123 | * would be acceptable for revoking the given key. | ||
124 | * | ||
125 | * @param key key to check for | ||
126 | * @param pow proof of work value | ||
127 | * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not | ||
128 | */ | ||
129 | int | ||
130 | GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EccPublicSignKey *key, | ||
131 | uint64_t pow); | ||
132 | |||
133 | |||
134 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
135 | { | ||
136 | #endif | ||
137 | #ifdef __cplusplus | ||
138 | } | ||
139 | #endif | ||
140 | |||
141 | /** @} */ /* end of group revocation */ | ||
142 | |||
143 | #endif /* GNUNET_REVOCATION_SERVICE_H_ */ | ||