GNUnet  0.11.x
gnunet_abd_service.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2012-2014 GNUnet e.V.
4 
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.
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  Affero General Public License for more details.
14 
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/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
32 #ifndef GNUNET_ABD_SERVICE_H
33 #define GNUNET_ABD_SERVICE_H
34 
35 #include "gnunet_util_lib.h"
36 #include "gnunet_gns_service.h"
38 
39 #ifdef __cplusplus
40 extern "C"
41 {
42 #if 0 /* keep Emacsens' auto-indent happy */
43 }
44 #endif
45 #endif
46 
47 
51 struct GNUNET_ABD_Handle;
52 
56 struct GNUNET_ABD_Request;
57 
58 /*
59 * Enum used for checking whether the issuer has the authority to issue credentials or is just a subject
60 */
62 
63  //Subject had credentials before, but have been revoked now
65 
66  //Subject flag indicates that the subject is a holder of this credential and may present it as such
68 
69  //Issuer flag is used to signify that the subject is allowed to issue this credential and delegate issuance
71 
72 };
73 
79 
83  uint32_t set_count;
84 
88  uint64_t data_size;
93 };
94 
99 
103  struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
104 
109 };
110 
111 
113 
118 
122  struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
123 
125 
129  const char *subject_attribute;
130 };
131 
132 
137 
142 
146  struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
147 
152 
156  const char *issuer_attribute;
157 
162 
166  const char *subject_attribute;
167 };
168 
169 
174 
179 
183  struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
184 
189 
194 
199 
203  const char *issuer_attribute;
204 
209 
213  const char *subject_attribute;
214 
215 };
216 
217 /*
218 * Enum used for checking whether the issuer has the authority to issue credentials or is just a subject
219 */
221 
222  //Subject had credentials before, but have been revoked now
224 
225  //Subject flag indicates that the subject is a holder of this credential and may present it as such
227 
228 };
229 
236 struct GNUNET_ABD_Handle *
238 
239 
245 void
247 
248 
258 typedef void (*GNUNET_ABD_CredentialResultProcessor) (void *cls,
259  unsigned int d_count,
260  struct GNUNET_ABD_Delegation *delegation_chain,
261  unsigned int c_count,
262  struct GNUNET_ABD_Delegate *delegte);
263 
264 typedef void (*GNUNET_ABD_IntermediateResultProcessor) (void *cls,
265  struct GNUNET_ABD_Delegation *delegation,
266  bool is_bw);
267 
275 typedef void (*GNUNET_ABD_DelegateResultProcessor) (void *cls,
276  uint32_t success);
277 
285 typedef void (*GNUNET_ABD_RemoveDelegateResultProcessor) (void *cls,
286  uint32_t success);
287 
288 
307 struct GNUNET_ABD_Request*
310  const char *issuer_attribute,
311  const struct GNUNET_CRYPTO_EcdsaPublicKey *subject_key,
312  uint32_t delegate_count,
313  const struct GNUNET_ABD_Delegate *delegates,
316  void *proc_cls,
318  void *proc2_cls);
319 
320 struct GNUNET_ABD_Request*
323  const char *issuer_attribute,
324  const struct GNUNET_CRYPTO_EcdsaPrivateKey *subject_key,
327  void *proc_cls,
329  void *proc2_cls);
330 
343 struct GNUNET_ABD_Request *
345  struct GNUNET_IDENTITY_Ego *issuer,
346  const char *attribute,
348  const char *delegated_attribute,
350  void *proc_cls);
351 
362 struct GNUNET_ABD_Request *
364  struct GNUNET_IDENTITY_Ego *issuer,
365  const char *attribute,
367  void *proc_cls);
368 
369 
370 
380 struct GNUNET_ABD_Delegate*
383  const char *iss_attr,
384  const char *sub_attr,
386 
387 
393 void
395 
396 
397 #if 0 /* keep Emacsens' auto-indent happy */
398 {
399 #endif
400 #ifdef __cplusplus
401 }
402 #endif
403 
404 #endif
405  /* end of group */
struct GNUNET_ABD_Handle * GNUNET_ABD_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize the connection with the Credential service.
Definition: abd_api.c:350
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static struct GNUNET_GNS_LookupWithTldRequest * lr
Handle to lookup request.
Definition: gnunet-gns.c:75
uint32_t issuer_attribute_len
Length of the attribute.
uint32_t subject_attribute_len
Length of attribute, may be 0.
void(* GNUNET_ABD_IntermediateResultProcessor)(void *cls, struct GNUNET_ABD_Delegation *delegation, bool is_bw)
void * proc2_cls
verify_proc2 closure
Definition: abd_api.c:79
GNUNET_ABD_AlgoDirectionFlags
struct GNUNET_ABD_Delegate * GNUNET_ABD_delegate_issue(const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, struct GNUNET_CRYPTO_EcdsaPublicKey *subject, const char *iss_attr, const char *sub_attr, struct GNUNET_TIME_Absolute *expiration)
Issue an attribute to a subject.
The attribute delegation record.
struct GNUNET_ABD_Request * GNUNET_ABD_collect(struct GNUNET_ABD_Handle *handle, const struct GNUNET_CRYPTO_EcdsaPublicKey *issuer_key, const char *issuer_attribute, const struct GNUNET_CRYPTO_EcdsaPrivateKey *subject_key, enum GNUNET_ABD_AlgoDirectionFlags direction, GNUNET_ABD_CredentialResultProcessor proc, void *proc_cls, GNUNET_ABD_IntermediateResultProcessor, void *proc2_cls)
Performs attribute collection.
Definition: abd_api.c:419
Private ECC key encoded for transmission.
Handle to a verify request.
Definition: abd_api.c:43
void * proc_cls
verify_proc closure
Definition: abd_api.c:69
#define GNUNET_NETWORK_STRUCT_BEGIN
Define as empty, GNUNET_PACKED should suffice, but this won&#39;t work on W32.
enum GNUNET_ABD_AlgoDirectionFlags direction
API enum, filled and passed for collect/verify.
Definition: gnunet-abd.c:172
void(* GNUNET_ABD_DelegateResultProcessor)(void *cls, uint32_t success)
Iterator called on obtained result for an attribute delegation.
void(* GNUNET_ABD_CredentialResultProcessor)(void *cls, unsigned int d_count, struct GNUNET_ABD_Delegation *delegation_chain, unsigned int c_count, struct GNUNET_ABD_Delegate *delegte)
Iterator called on obtained result for an attribute verification.
Handle for an ego.
Definition: identity.h:245
uint32_t subject_attribute_len
Length of the subject attribute.
an ECC signature using ECDSA
uint64_t data_size
Length of delegation sets.
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
const char * subject_attribute
The subject attribute.
The attribute delegation record.
static char * expiration
Credential TTL.
Definition: gnunet-abd.c:96
GNUNET_ABD_CredentialFlags
struct GNUNET_ABD_Request * GNUNET_ABD_add_delegation(struct GNUNET_ABD_Handle *handle, struct GNUNET_IDENTITY_Ego *issuer, const char *attribute, struct GNUNET_CRYPTO_EcdsaPublicKey *subject, const char *delegated_attribute, GNUNET_ABD_DelegateResultProcessor proc, void *proc_cls)
Delegate an attribute.
static char * issuer_key
Issuer pubkey string.
Definition: gnunet-abd.c:112
uint32_t issuer_attribute_len
Length of the issuer attribute.
Connection to the ABD service.
Definition: abd_api.c:96
const char * subject_attribute
The attribute.
const char * subject_attribute
The subject attribute.
#define GNUNET_NETWORK_STRUCT_END
Define as empty, GNUNET_PACKED should suffice, but this won&#39;t work on W32;.
static char * subject
Subject pubkey string.
Definition: gnunet-abd.c:86
void GNUNET_ABD_request_cancel(struct GNUNET_ABD_Request *lr)
Cancel pending lookup request.
Definition: abd_api.c:395
The attribute delegation record.
configuration data
Definition: configuration.c:85
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDS...
void(* GNUNET_ABD_RemoveDelegateResultProcessor)(void *cls, uint32_t success)
Iterator called on obtained result for an attribute delegation removal.
struct GNUNET_ABD_Request * GNUNET_ABD_remove_delegation(struct GNUNET_ABD_Handle *handle, struct GNUNET_IDENTITY_Ego *issuer, const char *attribute, GNUNET_ABD_RemoveDelegateResultProcessor proc, void *proc_cls)
Remove a delegation.
Time for absolute times used by GNUnet, in microseconds.
uint32_t set_count
Number of delegation sets in this record.
void GNUNET_ABD_disconnect(struct GNUNET_ABD_Handle *handle)
Shutdown connection with the Credentail service.
Definition: abd_api.c:372
const char * issuer_attribute
The attribute.
const char * issuer_attribute
The issuer attribute.
struct GNUNET_ABD_Request * GNUNET_ABD_verify(struct GNUNET_ABD_Handle *handle, const struct GNUNET_CRYPTO_EcdsaPublicKey *issuer_key, const char *issuer_attribute, const struct GNUNET_CRYPTO_EcdsaPublicKey *subject_key, uint32_t delegate_count, const struct GNUNET_ABD_Delegate *delegates, enum GNUNET_ABD_AlgoDirectionFlags direction, GNUNET_ABD_CredentialResultProcessor proc, void *proc_cls, GNUNET_ABD_IntermediateResultProcessor, void *proc2_cls)
Performs attribute verification.
Definition: abd_api.c:491
uint32_t subject_attribute_len
Length of the attribute.