GNUnet 0.21.1
plugin_reclaim_credential_pabc.c File Reference

reclaim-credential-plugin-pabc attribute plugin to provide the API for pabc credentials. More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_reclaim_plugin.h"
#include <inttypes.h>
#include <jansson.h>
#include <pabc/pabc.h>
#include "pabc_helper.h"
Include dependency graph for plugin_reclaim_credential_pabc.c:

Go to the source code of this file.

Functions

static char * pabc_value_to_string (void *cls, uint32_t type, const void *data, size_t data_size)
 Convert the 'value' of an credential to a string. More...
 
static int pabc_string_to_value (void *cls, uint32_t type, const char *s, void **data, size_t *data_size)
 Convert human-readable version of a 'value' of an credential to the binary representation. More...
 
static uint32_t pabc_typename_to_number (void *cls, const char *pabc_typename)
 Convert a type name to the corresponding number. More...
 
static const char * pabc_number_to_typename (void *cls, uint32_t type)
 Convert a type number (i.e. More...
 
static void inspect_attrs (char const *const key, char const *const value, void *ctx)
 
struct GNUNET_RECLAIM_AttributeListpabc_parse_attributes (void *cls, const char *data, size_t data_size)
 Parse a pabc and return the respective claim value as Attribute. More...
 
struct GNUNET_RECLAIM_AttributeListpabc_parse_attributes_c (void *cls, const struct GNUNET_RECLAIM_Credential *cred)
 Parse a pabc and return the respective claim value as Attribute. More...
 
struct GNUNET_RECLAIM_AttributeListpabc_parse_attributes_p (void *cls, const struct GNUNET_RECLAIM_Presentation *cred)
 Parse a pabc and return the respective claim value as Attribute. More...
 
char * pabc_get_issuer (void *cls, const char *data, size_t data_size)
 Parse a pabc and return the issuer. More...
 
char * pabc_get_issuer_c (void *cls, const struct GNUNET_RECLAIM_Credential *cred)
 Parse a pabc and return the issuer. More...
 
char * pabc_get_issuer_p (void *cls, const struct GNUNET_RECLAIM_Presentation *cred)
 Parse a pabc and return the issuer. More...
 
enum GNUNET_GenericReturnValue pabc_get_expiration (void *cls, const char *data, size_t data_size, struct GNUNET_TIME_Absolute *exp)
 Parse a pabc and return the expiration. More...
 
enum GNUNET_GenericReturnValue pabc_get_expiration_c (void *cls, const struct GNUNET_RECLAIM_Credential *cred, struct GNUNET_TIME_Absolute *exp)
 Parse a pabc and return the expiration. More...
 
enum GNUNET_GenericReturnValue pabc_get_expiration_p (void *cls, const struct GNUNET_RECLAIM_Presentation *cred, struct GNUNET_TIME_Absolute *exp)
 Parse a pabc and return the expiration. More...
 
int pabc_create_presentation (void *cls, const struct GNUNET_RECLAIM_Credential *credential, const struct GNUNET_RECLAIM_AttributeList *attrs, struct GNUNET_RECLAIM_Presentation **presentation)
 
void * libgnunet_plugin_reclaim_credential_pabc_init (void *cls)
 Entry point for the plugin. More...
 
void * libgnunet_plugin_reclaim_credential_pabc_done (void *cls)
 Exit point from the plugin. More...
 

Variables

struct {
   const char *   name
 
   uint32_t   number
 
pabc_cred_name_map []
 Mapping of credential type numbers to human-readable credential type names. More...
 

Detailed Description

reclaim-credential-plugin-pabc attribute plugin to provide the API for pabc credentials.

Author
Martin Schanzenbach

Definition in file plugin_reclaim_credential_pabc.c.

Function Documentation

◆ pabc_value_to_string()

static char * pabc_value_to_string ( void *  cls,
uint32_t  type,
const void *  data,
size_t  data_size 
)
static

Convert the 'value' of an credential to a string.

Parameters
clsclosure, unused
typetype of the credential
datavalue in binary encoding
data_sizenumber of bytes in data
Returns
NULL on error, otherwise human-readable representation of the value

Definition at line 46 of file plugin_reclaim_credential_pabc.c.

50{
51 switch (type)
52 {
55
56 default:
57 return NULL;
58 }
59}
static char * data
The data to insert into the dht.
static uint32_t type
Type string converted to DNS type value.
static size_t data_size
Number of bytes in data.
#define GNUNET_strndup(a, length)
Wrapper around GNUNET_xstrndup_.
@ GNUNET_RECLAIM_CREDENTIAL_TYPE_PABC
libpabc credential

References data, data_size, GNUNET_RECLAIM_CREDENTIAL_TYPE_PABC, GNUNET_strndup, and type.

Referenced by libgnunet_plugin_reclaim_credential_pabc_init().

Here is the caller graph for this function:

◆ pabc_string_to_value()

static int pabc_string_to_value ( void *  cls,
uint32_t  type,
const char *  s,
void **  data,
size_t *  data_size 
)
static

Convert human-readable version of a 'value' of an credential to the binary representation.

Parameters
clsclosure, unused
typetype of the credential
shuman-readable string
dataset to value in binary encoding (will be allocated)
data_sizeset to number of bytes in data
Returns
GNUNET_OK on success

Definition at line 74 of file plugin_reclaim_credential_pabc.c.

79{
80 if (NULL == s)
81 return GNUNET_SYSERR;
82 switch (type)
83 {
85 *data = GNUNET_strdup (s);
86 *data_size = strlen (s) + 1;
87 return GNUNET_OK;
88
89 default:
90 return GNUNET_SYSERR;
91 }
92}
@ GNUNET_OK
@ GNUNET_SYSERR
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.

References data, data_size, GNUNET_OK, GNUNET_RECLAIM_CREDENTIAL_TYPE_PABC, GNUNET_strdup, GNUNET_SYSERR, and type.

Referenced by libgnunet_plugin_reclaim_credential_pabc_init().

Here is the caller graph for this function:

◆ pabc_typename_to_number()

static uint32_t pabc_typename_to_number ( void *  cls,
const char *  pabc_typename 
)
static

Convert a type name to the corresponding number.

Parameters
clsclosure, unused
pabc_typenamename to convert
Returns
corresponding number, UINT32_MAX on error

Definition at line 114 of file plugin_reclaim_credential_pabc.c.

115{
116 unsigned int i;
117
118 i = 0;
119 while ((NULL != pabc_cred_name_map[i].name) &&
120 (0 != strcasecmp (pabc_typename, pabc_cred_name_map[i].name)))
121 i++;
122 return pabc_cred_name_map[i].number;
123}
const char * name
static struct @43 pabc_cred_name_map[]
Mapping of credential type numbers to human-readable credential type names.

References name, and pabc_cred_name_map.

Referenced by libgnunet_plugin_reclaim_credential_pabc_init().

Here is the caller graph for this function:

◆ pabc_number_to_typename()

static const char * pabc_number_to_typename ( void *  cls,
uint32_t  type 
)
static

Convert a type number (i.e.

1) to the corresponding type string

Parameters
clsclosure, unused
typenumber of a type to convert
Returns
corresponding typestring, NULL on error

Definition at line 134 of file plugin_reclaim_credential_pabc.c.

135{
136 unsigned int i;
137
138 i = 0;
139 while ((NULL != pabc_cred_name_map[i].name) && (type !=
141 number))
142 i++;
143 return pabc_cred_name_map[i].name;
144}

References name, number, pabc_cred_name_map, and type.

Referenced by libgnunet_plugin_reclaim_credential_pabc_init().

Here is the caller graph for this function:

◆ inspect_attrs()

static void inspect_attrs ( char const *const  key,
char const *const  value,
void *  ctx 
)
static

Definition at line 148 of file plugin_reclaim_credential_pabc.c.

151{
152 struct GNUNET_RECLAIM_AttributeList *attrs = ctx;
153
154 if (NULL == value)
155 return;
157 "Found attribute in PABC credential: `%s': `%s'\n",
158 key, value);
159 if (0 == strcmp (key, "expiration"))
160 return;
161 if (0 == strcmp (key, "issuer"))
162 return;
163 if (0 == strcmp (key, "subject"))
164 return;
166 key,
167 NULL,
169 value,
170 strlen (value));
171}
struct GNUNET_HashCode key
The key used in the DHT.
static struct GNUNET_FS_Handle * ctx
static char * value
Value of the record to add/remove.
#define GNUNET_log(kind,...)
@ GNUNET_ERROR_TYPE_DEBUG
void GNUNET_RECLAIM_attribute_list_add(struct GNUNET_RECLAIM_AttributeList *attrs, const char *attr_name, const struct GNUNET_RECLAIM_Identifier *credential, uint32_t type, const void *data, size_t data_size)
Add a new attribute to a claim list.
@ GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING
String attribute.
A list of GNUNET_RECLAIM_Attribute structures.

References ctx, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_RECLAIM_attribute_list_add(), GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING, key, and value.

Referenced by pabc_parse_attributes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pabc_parse_attributes()

struct GNUNET_RECLAIM_AttributeList * pabc_parse_attributes ( void *  cls,
const char *  data,
size_t  data_size 
)

Parse a pabc and return the respective claim value as Attribute.

Parameters
clsthe plugin
credthe pabc credential
Returns
a GNUNET_RECLAIM_Attribute, containing the new value

Definition at line 182 of file plugin_reclaim_credential_pabc.c.

185{
186 struct GNUNET_RECLAIM_AttributeList *attrs;
187
189 "Collecting PABC attributes...\n");
191 GNUNET_assert (PABC_OK ==
192 pabc_cred_inspect_credential (data,
193 &inspect_attrs, attrs));
194 return attrs;
195}
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static void inspect_attrs(char const *const key, char const *const value, void *ctx)

References data, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_new, and inspect_attrs().

Referenced by pabc_parse_attributes_c(), and pabc_parse_attributes_p().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pabc_parse_attributes_c()

struct GNUNET_RECLAIM_AttributeList * pabc_parse_attributes_c ( void *  cls,
const struct GNUNET_RECLAIM_Credential cred 
)

Parse a pabc and return the respective claim value as Attribute.

Parameters
clsthe plugin
credthe pabc credential
Returns
a GNUNET_RECLAIM_Attribute, containing the new value

Definition at line 206 of file plugin_reclaim_credential_pabc.c.

208{
210 return NULL;
211 return pabc_parse_attributes (cls, cred->data, cred->data_size);
212}
struct GNUNET_RECLAIM_AttributeList * pabc_parse_attributes(void *cls, const char *data, size_t data_size)
Parse a pabc and return the respective claim value as Attribute.
uint32_t type
Type/Format of Claim.
const void * data
Binary value stored as credential value.
size_t data_size
Number of bytes in data.

References GNUNET_RECLAIM_Credential::data, GNUNET_RECLAIM_Credential::data_size, GNUNET_RECLAIM_CREDENTIAL_TYPE_PABC, pabc_parse_attributes(), and GNUNET_RECLAIM_Credential::type.

Referenced by libgnunet_plugin_reclaim_credential_pabc_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pabc_parse_attributes_p()

struct GNUNET_RECLAIM_AttributeList * pabc_parse_attributes_p ( void *  cls,
const struct GNUNET_RECLAIM_Presentation cred 
)

Parse a pabc and return the respective claim value as Attribute.

Parameters
clsthe plugin
credthe pabc credential
Returns
a GNUNET_RECLAIM_Attribute, containing the new value

Definition at line 223 of file plugin_reclaim_credential_pabc.c.

225{
227 return NULL;
228 return pabc_parse_attributes (cls, cred->data, cred->data_size);
229}
const void * data
Binary value stored as presentation value.
uint32_t type
Type/Format of Claim.
size_t data_size
Number of bytes in data.

References GNUNET_RECLAIM_Presentation::data, GNUNET_RECLAIM_Presentation::data_size, GNUNET_RECLAIM_CREDENTIAL_TYPE_PABC, pabc_parse_attributes(), and GNUNET_RECLAIM_Presentation::type.

Referenced by libgnunet_plugin_reclaim_credential_pabc_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pabc_get_issuer()

char * pabc_get_issuer ( void *  cls,
const char *  data,
size_t  data_size 
)

Parse a pabc and return the issuer.

Parameters
clsthe plugin
credthe pabc credential
Returns
a string, containing the isser

Definition at line 240 of file plugin_reclaim_credential_pabc.c.

243{
244 char *res;
245 if (PABC_OK != pabc_cred_get_attr_by_name_from_cred (data,
246 "issuer",
247 &res))
248 return NULL;
249 return res;
250}
static char * res
Currently read line or NULL on EOF.

References data, and res.

Referenced by pabc_get_issuer_c(), and pabc_get_issuer_p().

Here is the caller graph for this function:

◆ pabc_get_issuer_c()

char * pabc_get_issuer_c ( void *  cls,
const struct GNUNET_RECLAIM_Credential cred 
)

Parse a pabc and return the issuer.

Parameters
clsthe plugin
credthe pabc credential
Returns
a string, containing the isser

Definition at line 261 of file plugin_reclaim_credential_pabc.c.

263{
265 return NULL;
266 return pabc_get_issuer (cls, cred->data, cred->data_size);
267}
char * pabc_get_issuer(void *cls, const char *data, size_t data_size)
Parse a pabc and return the issuer.

References GNUNET_RECLAIM_Credential::data, GNUNET_RECLAIM_Credential::data_size, GNUNET_RECLAIM_CREDENTIAL_TYPE_PABC, pabc_get_issuer(), and GNUNET_RECLAIM_Credential::type.

Referenced by libgnunet_plugin_reclaim_credential_pabc_init(), and pabc_create_presentation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pabc_get_issuer_p()

char * pabc_get_issuer_p ( void *  cls,
const struct GNUNET_RECLAIM_Presentation cred 
)

Parse a pabc and return the issuer.

Parameters
clsthe plugin
credthe pabc credential
Returns
a string, containing the isser

Definition at line 278 of file plugin_reclaim_credential_pabc.c.

280{
282 return NULL;
283 return pabc_get_issuer (cls, cred->data, cred->data_size);
284}

References GNUNET_RECLAIM_Presentation::data, GNUNET_RECLAIM_Presentation::data_size, GNUNET_RECLAIM_CREDENTIAL_TYPE_PABC, pabc_get_issuer(), and GNUNET_RECLAIM_Presentation::type.

Referenced by libgnunet_plugin_reclaim_credential_pabc_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pabc_get_expiration()

enum GNUNET_GenericReturnValue pabc_get_expiration ( void *  cls,
const char *  data,
size_t  data_size,
struct GNUNET_TIME_Absolute exp 
)

Parse a pabc and return the expiration.

Parameters
clsthe plugin
credthe pabc credential
Returns
a string, containing the isser

Definition at line 295 of file plugin_reclaim_credential_pabc.c.

299{
300 char *exp_str;
301 uint64_t exp_i;
302
303 if (PABC_OK != pabc_cred_get_attr_by_name_from_cred (data,
304 "expiration",
305 &exp_str))
306 return GNUNET_SYSERR;
307
308 if (1 != sscanf (exp_str, "%llu", &exp_i))
309 {
311 "Invalid expiration `%s'\n", exp_str);
312 GNUNET_free (exp_str);
313 return GNUNET_SYSERR;
314 }
316 "Converted expiration string `%s' to %llu",
317 exp_str, exp_i);
318
319 GNUNET_free (exp_str);
320 exp->abs_value_us = exp_i * 1000 * 1000;
321 return GNUNET_OK;
322}
@ GNUNET_ERROR_TYPE_ERROR
#define GNUNET_free(ptr)
Wrapper around free.
uint64_t abs_value_us
The actual value.

References GNUNET_TIME_Absolute::abs_value_us, data, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_OK, and GNUNET_SYSERR.

Referenced by pabc_get_expiration_c(), and pabc_get_expiration_p().

Here is the caller graph for this function:

◆ pabc_get_expiration_c()

enum GNUNET_GenericReturnValue pabc_get_expiration_c ( void *  cls,
const struct GNUNET_RECLAIM_Credential cred,
struct GNUNET_TIME_Absolute exp 
)

Parse a pabc and return the expiration.

Parameters
clsthe plugin
credthe pabc credential
Returns
a string, containing the isser

Definition at line 333 of file plugin_reclaim_credential_pabc.c.

336{
338 return GNUNET_NO;
339 return pabc_get_expiration (cls, cred->data, cred->data_size, exp);
340}
@ GNUNET_NO
enum GNUNET_GenericReturnValue pabc_get_expiration(void *cls, const char *data, size_t data_size, struct GNUNET_TIME_Absolute *exp)
Parse a pabc and return the expiration.

References GNUNET_RECLAIM_Credential::data, GNUNET_RECLAIM_Credential::data_size, GNUNET_NO, GNUNET_RECLAIM_CREDENTIAL_TYPE_PABC, pabc_get_expiration(), and GNUNET_RECLAIM_Credential::type.

Referenced by libgnunet_plugin_reclaim_credential_pabc_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pabc_get_expiration_p()

enum GNUNET_GenericReturnValue pabc_get_expiration_p ( void *  cls,
const struct GNUNET_RECLAIM_Presentation cred,
struct GNUNET_TIME_Absolute exp 
)

Parse a pabc and return the expiration.

Parameters
clsthe plugin
credthe pabc credential
Returns
a string, containing the isser

Definition at line 351 of file plugin_reclaim_credential_pabc.c.

354{
356 return GNUNET_NO;
357 return pabc_get_expiration (cls, cred->data, cred->data_size, exp);
358}

References GNUNET_RECLAIM_Presentation::data, GNUNET_RECLAIM_Presentation::data_size, GNUNET_NO, GNUNET_RECLAIM_CREDENTIAL_TYPE_PABC, pabc_get_expiration(), and GNUNET_RECLAIM_Presentation::type.

Referenced by libgnunet_plugin_reclaim_credential_pabc_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pabc_create_presentation()

int pabc_create_presentation ( void *  cls,
const struct GNUNET_RECLAIM_Credential credential,
const struct GNUNET_RECLAIM_AttributeList attrs,
struct GNUNET_RECLAIM_Presentation **  presentation 
)

Definition at line 362 of file plugin_reclaim_credential_pabc.c.

366{
367 struct pabc_context *ctx = NULL;
368 struct pabc_user_context *usr_ctx = NULL;
369 struct pabc_public_parameters *pp = NULL;
370 struct pabc_credential *cred = NULL;
371 struct pabc_blinded_proof *proof = NULL;
373 char *issuer;
374 char *subject;
375 enum pabc_status status;
376
378 return GNUNET_NO;
379
380
381 PABC_ASSERT (pabc_new_ctx (&ctx));
382 issuer = pabc_get_issuer_c (cls, credential);
383 if (NULL == issuer)
384 {
386 "No issuer found in credential\n");
387 pabc_free_ctx (&ctx);
388 return GNUNET_SYSERR;
389 }
391 "Got issuer for credential: %s\n", issuer);
392 status = PABC_load_public_parameters (ctx, issuer, &pp);
393 if (status != PABC_OK)
394 {
396 "Failed to read public parameters.\n");
397 pabc_free_ctx (&ctx);
398 GNUNET_free (issuer);
399 return GNUNET_SYSERR;
400 }
401 if (PABC_OK != pabc_cred_get_attr_by_name_from_cred (credential->data,
402 "subject",
403 &subject))
404 {
406 "Failed to get subject.\n");
407 pabc_free_ctx (&ctx);
408 GNUNET_free (issuer);
409 return GNUNET_SYSERR;
410 }
411 status = PABC_read_usr_ctx (subject, issuer, ctx, pp, &usr_ctx);
412 GNUNET_free (issuer);
414 if (PABC_OK != status)
415 {
417 "Failed to read user context.\n");
418 pabc_free_public_parameters (ctx, &pp);
419 return GNUNET_SYSERR;
420 }
421
422 status = pabc_new_credential (ctx, pp, &cred);
423 if (status != PABC_OK)
424 {
426 "Failed to allocate credential.\n");
427 pabc_free_user_context (ctx, pp, &usr_ctx);
428 pabc_free_public_parameters (ctx, &pp);
429 return GNUNET_SYSERR;
430 }
431
432 status = pabc_decode_credential (ctx, pp, cred, credential->data);
433 if (status != PABC_OK)
434 {
436 "Failed to decode credential.\n");
437 pabc_free_credential (ctx, pp, &cred);
438 pabc_free_user_context (ctx, pp, &usr_ctx);
439 pabc_free_public_parameters (ctx, &pp);
440 return GNUNET_SYSERR;
441 }
442
443 status = pabc_new_proof (ctx, pp, &proof);
444 if (status != PABC_OK)
445 {
447 "Failed to allocate proof.\n");
448 pabc_free_credential (ctx, pp, &cred);
449 pabc_free_user_context (ctx, pp, &usr_ctx);
450 pabc_free_public_parameters (ctx, &pp);
451 return GNUNET_SYSERR;
452 }
453
454 // now we can parse the attributes to disclose and configure the proof
455 for (ale = attrs->list_head; NULL != ale; ale = ale->next)
456 {
457 status = pabc_set_disclosure_by_attribute_name (ctx, pp, proof,
458 ale->attribute->name,
459 PABC_DISCLOSED, cred);
460 if (status != PABC_OK)
461 {
463 "Failed to configure proof.\n");
464 pabc_free_credential (ctx, pp, &cred);
465 pabc_free_user_context (ctx, pp, &usr_ctx);
466 pabc_free_public_parameters (ctx, &pp);
467 return GNUNET_SYSERR;
468 }
469 }
470
471 // and finally -> sign the proof
472 status = pabc_gen_proof (ctx, usr_ctx, pp, proof, cred);
473 if (status != PABC_OK)
474 {
476 "Failed to sign proof.\n");
477 pabc_free_proof (ctx, pp, &proof);
478 pabc_free_credential (ctx, pp, &cred);
479 pabc_free_user_context (ctx, pp, &usr_ctx);
480 pabc_free_public_parameters (ctx, &pp);
481 return GNUNET_SYSERR;
482 }
483 // print the result
484 char *json = NULL;
485 char *ppid = NULL;
486 char *userid = NULL;
487 GNUNET_assert (PABC_OK == pabc_cred_get_userid_from_cred (credential->data,
488 &userid));
489 GNUNET_assert (PABC_OK == pabc_cred_get_ppid_from_cred (credential->data,
490 &ppid));
491 pabc_cred_encode_proof (ctx, pp, proof, userid, ppid, &json);
492 GNUNET_free (ppid);
493 GNUNET_free (userid);
494 if (PABC_OK != status)
495 {
497 "Failed to serialize proof.\n");
498 pabc_free_proof (ctx, pp, &proof);
499 pabc_free_credential (ctx, pp, &cred);
500 pabc_free_user_context (ctx, pp, &usr_ctx);
501 pabc_free_public_parameters (ctx, &pp);
502 return GNUNET_SYSERR;
503 }
504 char *json_enc;
506 strlen (json) + 1,
507 &json_enc);
509 "Presentation: %s\n", json_enc);
510 // clean up
511 *presentation = GNUNET_RECLAIM_presentation_new (
513 json_enc,
514 strlen (json_enc) + 1);
515 GNUNET_free (json_enc);
516 PABC_FREE_NULL (json);
517 pabc_free_proof (ctx, pp, &proof);
518 pabc_free_credential (ctx, pp, &cred);
519 pabc_free_user_context (ctx, pp, &usr_ctx);
520 pabc_free_public_parameters (ctx, &pp);
521 return GNUNET_OK;
522}
static char * subject
Subject pubkey string.
Definition: gnunet-abd.c:86
static int status
The program status; 0 for success.
Definition: gnunet-nse.c:39
static struct GNUNET_RECLAIM_Identifier credential
Credential ID.
static uint64_t proof
Definition: gnunet-scrypt.c:49
struct GNUNET_RECLAIM_Presentation * GNUNET_RECLAIM_presentation_new(uint32_t type, const void *data, size_t data_size)
size_t GNUNET_STRINGS_base64_encode(const void *in, size_t len, char **output)
Encode into Base64.
Definition: strings.c:1622
enum GNUNET_GenericReturnValue PABC_load_public_parameters(struct pabc_context *const ctx, char const *const pp_name, struct pabc_public_parameters **pp)
Definition: pabc_helper.c:135
enum GNUNET_GenericReturnValue PABC_read_usr_ctx(char const *const usr_name, char const *const pp_name, struct pabc_context const *const ctx, struct pabc_public_parameters const *const pp, struct pabc_user_context **usr_ctx)
Definition: pabc_helper.c:301
char * pabc_get_issuer_c(void *cls, const struct GNUNET_RECLAIM_Credential *cred)
Parse a pabc and return the issuer.
struct GNUNET_RECLAIM_Attribute * attribute
The attribute claim.
struct GNUNET_RECLAIM_AttributeListEntry * next
DLL.
struct GNUNET_RECLAIM_AttributeListEntry * list_head
List head.
const char * name
The name of the attribute.

References GNUNET_RECLAIM_AttributeListEntry::attribute, credential, ctx, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_NO, GNUNET_OK, GNUNET_RECLAIM_CREDENTIAL_TYPE_PABC, GNUNET_RECLAIM_presentation_new(), GNUNET_STRINGS_base64_encode(), GNUNET_SYSERR, GNUNET_RECLAIM_AttributeList::list_head, GNUNET_RECLAIM_Attribute::name, GNUNET_RECLAIM_AttributeListEntry::next, pabc_get_issuer_c(), PABC_load_public_parameters(), PABC_read_usr_ctx(), proof, status, and subject.

Referenced by libgnunet_plugin_reclaim_credential_pabc_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ libgnunet_plugin_reclaim_credential_pabc_init()

void * libgnunet_plugin_reclaim_credential_pabc_init ( void *  cls)

Entry point for the plugin.

Parameters
clsNULL
Returns
the exported block API

Definition at line 532 of file plugin_reclaim_credential_pabc.c.

533{
535
552 return api;
553}
enum GNUNET_GenericReturnValue pabc_get_expiration_p(void *cls, const struct GNUNET_RECLAIM_Presentation *cred, struct GNUNET_TIME_Absolute *exp)
Parse a pabc and return the expiration.
enum GNUNET_GenericReturnValue pabc_get_expiration_c(void *cls, const struct GNUNET_RECLAIM_Credential *cred, struct GNUNET_TIME_Absolute *exp)
Parse a pabc and return the expiration.
static char * pabc_value_to_string(void *cls, uint32_t type, const void *data, size_t data_size)
Convert the 'value' of an credential to a string.
struct GNUNET_RECLAIM_AttributeList * pabc_parse_attributes_p(void *cls, const struct GNUNET_RECLAIM_Presentation *cred)
Parse a pabc and return the respective claim value as Attribute.
static const char * pabc_number_to_typename(void *cls, uint32_t type)
Convert a type number (i.e.
static uint32_t pabc_typename_to_number(void *cls, const char *pabc_typename)
Convert a type name to the corresponding number.
char * pabc_get_issuer_p(void *cls, const struct GNUNET_RECLAIM_Presentation *cred)
Parse a pabc and return the issuer.
int pabc_create_presentation(void *cls, const struct GNUNET_RECLAIM_Credential *credential, const struct GNUNET_RECLAIM_AttributeList *attrs, struct GNUNET_RECLAIM_Presentation **presentation)
static int pabc_string_to_value(void *cls, uint32_t type, const char *s, void **data, size_t *data_size)
Convert human-readable version of a 'value' of an credential to the binary representation.
struct GNUNET_RECLAIM_AttributeList * pabc_parse_attributes_c(void *cls, const struct GNUNET_RECLAIM_Credential *cred)
Parse a pabc and return the respective claim value as Attribute.
Each plugin is required to return a pointer to a struct of this type as the return value from its ent...
GNUNET_RECLAIM_CredentialValueToStringFunction value_to_string
Conversion to string.
GNUNET_RECLAIM_CredentialTypenameToNumberFunction typename_to_number
Typename to number.
GNUNET_RECLAIM_PresentationGetIssuerFunction get_issuer_p
Attesation issuer.
GNUNET_RECLAIM_CredentialNumberToTypenameFunction number_to_typename
Number to typename.
GNUNET_RECLAIM_CredentialGetIssuerFunction get_issuer
Attesation issuer.
GNUNET_RECLAIM_PresentationGetExpirationFunction get_expiration_p
Expiration.
GNUNET_RECLAIM_PresentationValueToStringFunction value_to_string_p
Conversion to string.
GNUNET_RECLAIM_CredentialStringToValueFunction string_to_value
Conversion to binary.
GNUNET_RECLAIM_CredentialGetExpirationFunction get_expiration
Expiration.
GNUNET_RECLAIM_CredentialGetAttributesFunction get_attributes
Attesation attributes.
GNUNET_RECLAIM_PresentationStringToValueFunction string_to_value_p
Conversion to binary.
GNUNET_RECLAIM_PresentationTypenameToNumberFunction typename_to_number_p
Typename to number.
GNUNET_RECLAIM_PresentationNumberToTypenameFunction number_to_typename_p
Number to typename.
GNUNET_RECLAIM_CredentialToPresentation create_presentation
Get presentation.
GNUNET_RECLAIM_PresentationGetAttributesFunction get_attributes_p
Attesation attributes.

References GNUNET_RECLAIM_CredentialPluginFunctions::create_presentation, GNUNET_RECLAIM_CredentialPluginFunctions::get_attributes, GNUNET_RECLAIM_CredentialPluginFunctions::get_attributes_p, GNUNET_RECLAIM_CredentialPluginFunctions::get_expiration, GNUNET_RECLAIM_CredentialPluginFunctions::get_expiration_p, GNUNET_RECLAIM_CredentialPluginFunctions::get_issuer, GNUNET_RECLAIM_CredentialPluginFunctions::get_issuer_p, GNUNET_new, GNUNET_RECLAIM_CredentialPluginFunctions::number_to_typename, GNUNET_RECLAIM_CredentialPluginFunctions::number_to_typename_p, pabc_create_presentation(), pabc_get_expiration_c(), pabc_get_expiration_p(), pabc_get_issuer_c(), pabc_get_issuer_p(), pabc_number_to_typename(), pabc_parse_attributes_c(), pabc_parse_attributes_p(), pabc_string_to_value(), pabc_typename_to_number(), pabc_value_to_string(), GNUNET_RECLAIM_CredentialPluginFunctions::string_to_value, GNUNET_RECLAIM_CredentialPluginFunctions::string_to_value_p, GNUNET_RECLAIM_CredentialPluginFunctions::typename_to_number, GNUNET_RECLAIM_CredentialPluginFunctions::typename_to_number_p, GNUNET_RECLAIM_CredentialPluginFunctions::value_to_string, and GNUNET_RECLAIM_CredentialPluginFunctions::value_to_string_p.

Here is the call graph for this function:

◆ libgnunet_plugin_reclaim_credential_pabc_done()

void * libgnunet_plugin_reclaim_credential_pabc_done ( void *  cls)

Exit point from the plugin.

Parameters
clsthe return value from libgnunet_plugin_block_test_init()
Returns
NULL

Definition at line 563 of file plugin_reclaim_credential_pabc.c.

564{
566
567 GNUNET_free (api);
568 return NULL;
569}
void * cls
Closure for all of the callbacks.

References GNUNET_RECLAIM_CredentialPluginFunctions::cls, and GNUNET_free.

Variable Documentation

◆ name

const char* name

◆ number

uint32_t number

Definition at line 102 of file plugin_reclaim_credential_pabc.c.

Referenced by pabc_number_to_typename().

◆ 

struct { ... } pabc_cred_name_map[]
Initial value:
{ NULL, UINT32_MAX } }

Mapping of credential type numbers to human-readable credential type names.

Referenced by pabc_number_to_typename(), and pabc_typename_to_number().