summaryrefslogtreecommitdiff
path: root/src/include/gnunet_credential_service.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_credential_service.h')
-rw-r--r--src/include/gnunet_credential_service.h109
1 files changed, 64 insertions, 45 deletions
diff --git a/src/include/gnunet_credential_service.h b/src/include/gnunet_credential_service.h
index 9e1672ba3..05cdb7c9f 100644
--- a/src/include/gnunet_credential_service.h
+++ b/src/include/gnunet_credential_service.h
@@ -58,14 +58,15 @@ struct GNUNET_CREDENTIAL_Request;
58/* 58/*
59 * Enum used for checking whether the issuer has the authority to issue credentials or is just a subject 59 * Enum used for checking whether the issuer has the authority to issue credentials or is just a subject
60 */ 60 */
61enum GNUNET_CREDENTIAL_CredentialFlags { 61enum GNUNET_CREDENTIAL_CredentialFlags
62 //Subject had credentials before, but have been revoked now 62{
63 // Subject had credentials before, but have been revoked now
63 GNUNET_CREDENTIAL_FLAG_REVOKED=0, 64 GNUNET_CREDENTIAL_FLAG_REVOKED=0,
64 65
65 //Subject flag indicates that the subject is a holder of this credential and may present it as such 66 // Subject flag indicates that the subject is a holder of this credential and may present it as such
66 GNUNET_CREDENTIAL_FLAG_SUBJECT=1, 67 GNUNET_CREDENTIAL_FLAG_SUBJECT=1,
67 68
68 //Issuer flag is used to signify that the subject is allowed to issue this credential and delegate issuance 69 // Issuer flag is used to signify that the subject is allowed to issue this credential and delegate issuance
69 GNUNET_CREDENTIAL_FLAG_ISSUER=2 70 GNUNET_CREDENTIAL_FLAG_ISSUER=2
70}; 71};
71 72
@@ -73,7 +74,8 @@ GNUNET_NETWORK_STRUCT_BEGIN
73/** 74/**
74 * The attribute delegation record 75 * The attribute delegation record
75 */ 76 */
76struct GNUNET_CREDENTIAL_DelegationRecord { 77struct GNUNET_CREDENTIAL_DelegationRecord
78{
77 /** 79 /**
78 * Number of delegation sets in this record 80 * Number of delegation sets in this record
79 */ 81 */
@@ -92,7 +94,8 @@ struct GNUNET_CREDENTIAL_DelegationRecord {
92/** 94/**
93 * The attribute delegation record 95 * The attribute delegation record
94 */ 96 */
95struct GNUNET_CREDENTIAL_DelegationRecordSet { 97struct GNUNET_CREDENTIAL_DelegationRecordSet
98{
96 /** 99 /**
97 * Public key of the subject this attribute was delegated to 100 * Public key of the subject this attribute was delegated to
98 */ 101 */
@@ -110,7 +113,8 @@ GNUNET_NETWORK_STRUCT_END
110/** 113/**
111 * The attribute delegation record 114 * The attribute delegation record
112 */ 115 */
113struct GNUNET_CREDENTIAL_DelegationSet { 116struct GNUNET_CREDENTIAL_DelegationSet
117{
114 /** 118 /**
115 * Public key of the subject this attribute was delegated to 119 * Public key of the subject this attribute was delegated to
116 */ 120 */
@@ -128,7 +132,8 @@ struct GNUNET_CREDENTIAL_DelegationSet {
128/** 132/**
129 * A delegation 133 * A delegation
130 */ 134 */
131struct GNUNET_CREDENTIAL_Delegation { 135struct GNUNET_CREDENTIAL_Delegation
136{
132 /** 137 /**
133 * The issuer of the delegation 138 * The issuer of the delegation
134 */ 139 */
@@ -164,7 +169,8 @@ struct GNUNET_CREDENTIAL_Delegation {
164/** 169/**
165 * A credential 170 * A credential
166 */ 171 */
167struct GNUNET_CREDENTIAL_Credential { 172struct GNUNET_CREDENTIAL_Credential
173{
168 /** 174 /**
169 * The issuer of the credential 175 * The issuer of the credential
170 */ 176 */
@@ -205,7 +211,7 @@ struct GNUNET_CREDENTIAL_Credential {
205 * @return handle to the Credential service, or NULL on error 211 * @return handle to the Credential service, or NULL on error
206 */ 212 */
207struct GNUNET_CREDENTIAL_Handle * 213struct GNUNET_CREDENTIAL_Handle *
208GNUNET_CREDENTIAL_connect(const struct GNUNET_CONFIGURATION_Handle *cfg); 214GNUNET_CREDENTIAL_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
209 215
210 216
211/** 217/**
@@ -214,7 +220,7 @@ GNUNET_CREDENTIAL_connect(const struct GNUNET_CONFIGURATION_Handle *cfg);
214 * @param handle connection to shut down 220 * @param handle connection to shut down
215 */ 221 */
216void 222void
217GNUNET_CREDENTIAL_disconnect(struct GNUNET_CREDENTIAL_Handle *handle); 223GNUNET_CREDENTIAL_disconnect (struct GNUNET_CREDENTIAL_Handle *handle);
218 224
219 225
220/** 226/**
@@ -227,10 +233,16 @@ GNUNET_CREDENTIAL_disconnect(struct GNUNET_CREDENTIAL_Handle *handle);
227 * @param credential the credentials 233 * @param credential the credentials
228 */ 234 */
229typedef void (*GNUNET_CREDENTIAL_CredentialResultProcessor) (void *cls, 235typedef void (*GNUNET_CREDENTIAL_CredentialResultProcessor) (void *cls,
230 unsigned int d_count, 236 unsigned int
231 struct GNUNET_CREDENTIAL_Delegation *delegation_chain, 237 d_count,
232 unsigned int c_count, 238 struct
233 struct GNUNET_CREDENTIAL_Credential *credential); 239 GNUNET_CREDENTIAL_Delegation
240 *delegation_chain,
241 unsigned int
242 c_count,
243 struct
244 GNUNET_CREDENTIAL_Credential
245 *credential);
234 246
235/** 247/**
236 * Iterator called on obtained result for an attribute delegation. 248 * Iterator called on obtained result for an attribute delegation.
@@ -250,7 +262,8 @@ typedef void (*GNUNET_CREDENTIAL_DelegateResultProcessor) (void *cls,
250 * @param result the record data that can be handed to the subject 262 * @param result the record data that can be handed to the subject
251 */ 263 */
252typedef void (*GNUNET_CREDENTIAL_RemoveDelegateResultProcessor) (void *cls, 264typedef void (*GNUNET_CREDENTIAL_RemoveDelegateResultProcessor) (void *cls,
253 uint32_t success); 265 uint32_t
266 success);
254 267
255 268
256/** 269/**
@@ -272,23 +285,27 @@ typedef void (*GNUNET_CREDENTIAL_RemoveDelegateResultProcessor) (void *cls,
272 * @return handle to the queued request 285 * @return handle to the queued request
273 */ 286 */
274struct GNUNET_CREDENTIAL_Request* 287struct GNUNET_CREDENTIAL_Request*
275GNUNET_CREDENTIAL_verify(struct GNUNET_CREDENTIAL_Handle *handle, 288GNUNET_CREDENTIAL_verify (struct GNUNET_CREDENTIAL_Handle *handle,
276 const struct GNUNET_CRYPTO_EcdsaPublicKey *issuer_key,
277 const char *issuer_attribute,
278 const struct GNUNET_CRYPTO_EcdsaPublicKey *subject_key,
279 uint32_t credential_count,
280 const struct GNUNET_CREDENTIAL_Credential *credentials,
281 GNUNET_CREDENTIAL_CredentialResultProcessor proc,
282 void *proc_cls);
283
284struct GNUNET_CREDENTIAL_Request*
285GNUNET_CREDENTIAL_collect(struct GNUNET_CREDENTIAL_Handle *handle,
286 const struct GNUNET_CRYPTO_EcdsaPublicKey *issuer_key, 289 const struct GNUNET_CRYPTO_EcdsaPublicKey *issuer_key,
287 const char *issuer_attribute, 290 const char *issuer_attribute,
288 const struct GNUNET_CRYPTO_EcdsaPrivateKey *subject_key, 291 const struct
292 GNUNET_CRYPTO_EcdsaPublicKey *subject_key,
293 uint32_t credential_count,
294 const struct
295 GNUNET_CREDENTIAL_Credential *credentials,
289 GNUNET_CREDENTIAL_CredentialResultProcessor proc, 296 GNUNET_CREDENTIAL_CredentialResultProcessor proc,
290 void *proc_cls); 297 void *proc_cls);
291 298
299struct GNUNET_CREDENTIAL_Request*
300GNUNET_CREDENTIAL_collect (struct GNUNET_CREDENTIAL_Handle *handle,
301 const struct
302 GNUNET_CRYPTO_EcdsaPublicKey *issuer_key,
303 const char *issuer_attribute,
304 const struct
305 GNUNET_CRYPTO_EcdsaPrivateKey *subject_key,
306 GNUNET_CREDENTIAL_CredentialResultProcessor proc,
307 void *proc_cls);
308
292/** 309/**
293 * Delegate an attribute 310 * Delegate an attribute
294 * 311 *
@@ -302,13 +319,13 @@ GNUNET_CREDENTIAL_collect(struct GNUNET_CREDENTIAL_Handle *handle,
302 * @return handle to the queued request 319 * @return handle to the queued request
303 */ 320 */
304struct GNUNET_CREDENTIAL_Request * 321struct GNUNET_CREDENTIAL_Request *
305GNUNET_CREDENTIAL_add_delegation(struct GNUNET_CREDENTIAL_Handle *handle, 322GNUNET_CREDENTIAL_add_delegation (struct GNUNET_CREDENTIAL_Handle *handle,
306 struct GNUNET_IDENTITY_Ego *issuer, 323 struct GNUNET_IDENTITY_Ego *issuer,
307 const char *attribute, 324 const char *attribute,
308 struct GNUNET_CRYPTO_EcdsaPublicKey *subject, 325 struct GNUNET_CRYPTO_EcdsaPublicKey *subject,
309 const char *delegated_attribute, 326 const char *delegated_attribute,
310 GNUNET_CREDENTIAL_DelegateResultProcessor proc, 327 GNUNET_CREDENTIAL_DelegateResultProcessor proc,
311 void *proc_cls); 328 void *proc_cls);
312 329
313/** 330/**
314 * Remove a delegation 331 * Remove a delegation
@@ -321,11 +338,12 @@ GNUNET_CREDENTIAL_add_delegation(struct GNUNET_CREDENTIAL_Handle *handle,
321 * @return handle to the queued request 338 * @return handle to the queued request
322 */ 339 */
323struct GNUNET_CREDENTIAL_Request * 340struct GNUNET_CREDENTIAL_Request *
324GNUNET_CREDENTIAL_remove_delegation(struct GNUNET_CREDENTIAL_Handle *handle, 341GNUNET_CREDENTIAL_remove_delegation (struct GNUNET_CREDENTIAL_Handle *handle,
325 struct GNUNET_IDENTITY_Ego *issuer, 342 struct GNUNET_IDENTITY_Ego *issuer,
326 const char *attribute, 343 const char *attribute,
327 GNUNET_CREDENTIAL_RemoveDelegateResultProcessor proc, 344 GNUNET_CREDENTIAL_RemoveDelegateResultProcessor
328 void *proc_cls); 345 proc,
346 void *proc_cls);
329 347
330 348
331 349
@@ -339,10 +357,11 @@ GNUNET_CREDENTIAL_remove_delegation(struct GNUNET_CREDENTIAL_Handle *handle,
339 * @return handle to the queued request 357 * @return handle to the queued request
340 */ 358 */
341struct GNUNET_CREDENTIAL_Credential* 359struct GNUNET_CREDENTIAL_Credential*
342GNUNET_CREDENTIAL_credential_issue(const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, 360GNUNET_CREDENTIAL_credential_issue (const struct
343 struct GNUNET_CRYPTO_EcdsaPublicKey *subject, 361 GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
344 const char *attribute, 362 struct GNUNET_CRYPTO_EcdsaPublicKey *subject,
345 struct GNUNET_TIME_Absolute *expiration); 363 const char *attribute,
364 struct GNUNET_TIME_Absolute *expiration);
346 365
347 366
348 367
@@ -352,7 +371,7 @@ GNUNET_CREDENTIAL_credential_issue(const struct GNUNET_CRYPTO_EcdsaPrivateKey *i
352 * @param lr the lookup request to cancel 371 * @param lr the lookup request to cancel
353 */ 372 */
354void 373void
355GNUNET_CREDENTIAL_request_cancel(struct GNUNET_CREDENTIAL_Request *lr); 374GNUNET_CREDENTIAL_request_cancel (struct GNUNET_CREDENTIAL_Request *lr);
356 375
357 376
358#if 0 /* keep Emacsens' auto-indent happy */ 377#if 0 /* keep Emacsens' auto-indent happy */