105 { NULL, UINT32_MAX } };
150 char const *
const value,
158 "Found attribute in PABC credential: `%s': `%s'\n",
160 if (0 == strcmp (
key,
"expiration"))
162 if (0 == strcmp (
key,
"issuer"))
164 if (0 == strcmp (
key,
"subject"))
190 "Collecting PABC attributes...\n");
193 pabc_cred_inspect_credential (
data,
246 if (PABC_OK != pabc_cred_get_attr_by_name_from_cred (
data,
304 if (PABC_OK != pabc_cred_get_attr_by_name_from_cred (
data,
309 if (1 != sscanf (exp_str,
"%llu", &exp_i))
312 "Invalid expiration `%s'\n", exp_str);
317 "Converted expiration string `%s' to %llu",
368 struct pabc_context *
ctx = NULL;
369 struct pabc_user_context *usr_ctx = NULL;
370 struct pabc_public_parameters *pp = NULL;
371 struct pabc_credential *
cred = NULL;
372 struct pabc_blinded_proof *
proof = NULL;
382 PABC_ASSERT (pabc_new_ctx (&
ctx));
387 "No issuer found in credential\n");
388 pabc_free_ctx (&
ctx);
392 "Got issuer for credential: %s\n", issuer);
397 "Failed to read public parameters.\n");
398 pabc_free_ctx (&
ctx);
402 if (PABC_OK != pabc_cred_get_attr_by_name_from_cred (
credential->data,
407 "Failed to get subject.\n");
408 pabc_free_ctx (&
ctx);
418 "Failed to read user context.\n");
419 pabc_free_public_parameters (
ctx, &pp);
427 "Failed to allocate credential.\n");
428 pabc_free_user_context (
ctx, pp, &usr_ctx);
429 pabc_free_public_parameters (
ctx, &pp);
437 "Failed to decode credential.\n");
438 pabc_free_credential (
ctx, pp, &
cred);
439 pabc_free_user_context (
ctx, pp, &usr_ctx);
440 pabc_free_public_parameters (
ctx, &pp);
448 "Failed to allocate proof.\n");
449 pabc_free_credential (
ctx, pp, &
cred);
450 pabc_free_user_context (
ctx, pp, &usr_ctx);
451 pabc_free_public_parameters (
ctx, &pp);
460 PABC_DISCLOSED,
cred);
464 "Failed to configure proof.\n");
465 pabc_free_credential (
ctx, pp, &
cred);
466 pabc_free_user_context (
ctx, pp, &usr_ctx);
467 pabc_free_public_parameters (
ctx, &pp);
477 "Failed to sign proof.\n");
479 pabc_free_credential (
ctx, pp, &
cred);
480 pabc_free_user_context (
ctx, pp, &usr_ctx);
481 pabc_free_public_parameters (
ctx, &pp);
492 pabc_cred_encode_proof (
ctx, pp,
proof, userid, ppid, &json);
498 "Failed to serialize proof.\n");
500 pabc_free_credential (
ctx, pp, &
cred);
501 pabc_free_user_context (
ctx, pp, &usr_ctx);
502 pabc_free_public_parameters (
ctx, &pp);
510 "Presentation: %s\n", json_enc);
515 strlen (json_enc) + 1);
517 PABC_FREE_NULL (json);
519 pabc_free_credential (
ctx, pp, &
cred);
520 pabc_free_user_context (
ctx, pp, &usr_ctx);
521 pabc_free_public_parameters (
ctx, &pp);
static char * subject
Subject pubkey string.
static gnutls_certificate_credentials_t cred
The credential.
static char * data
The data to insert into the dht.
struct GNUNET_HashCode key
The key used in the DHT.
static struct GNUNET_FS_Handle * ctx
static char * res
Currently read line or NULL on EOF.
static char * value
Value of the record to add/remove.
static uint32_t type
Type string converted to DNS type value.
static size_t data_size
Number of bytes in data.
static int status
The program status; 0 for success.
static struct GNUNET_RECLAIM_Identifier credential
Credential ID.
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
Plugin API for reclaim attribute types.
#define GNUNET_log(kind,...)
GNUNET_GenericReturnValue
Named constants for return values.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_strndup(a, length)
Wrapper around GNUNET_xstrndup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_RECLAIM_Presentation * GNUNET_RECLAIM_presentation_new(uint32_t type, const void *data, size_t data_size)
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_CREDENTIAL_TYPE_PABC
libpabc credential
@ GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING
String attribute.
size_t GNUNET_STRINGS_base64_encode(const void *in, size_t len, char **output)
Encode into Base64.
enum GNUNET_GenericReturnValue PABC_load_public_parameters(struct pabc_context *const ctx, char const *const pp_name, struct pabc_public_parameters **pp)
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)
static char * pabc_get_issuer(void *cls, const char *data, size_t data_size)
Parse a pabc and return the issuer.
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.
static 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.
static const char * pabc_number_to_typename(void *cls, uint32_t type)
Convert a type number (i.e.
static 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.
static 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.
void * libgnunet_plugin_reclaim_credential_pabc_done(void *cls)
Exit point from the plugin.
static uint32_t pabc_typename_to_number(void *cls, const char *pabc_typename)
Convert a type name to the corresponding number.
static char * pabc_get_issuer_p(void *cls, const struct GNUNET_RECLAIM_Presentation *cred)
Parse a pabc and return the issuer.
static void inspect_attrs(char const *const key, char const *const value, void *ctx)
static 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.
static struct @43 pabc_cred_name_map[]
Mapping of credential type numbers to human-readable credential type names.
void * libgnunet_plugin_reclaim_credential_pabc_init(void *cls)
Entry point for the plugin.
static 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 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.
static enum GNUNET_GenericReturnValue pabc_create_presentation(void *cls, const struct GNUNET_RECLAIM_Credential *credential, const struct GNUNET_RECLAIM_AttributeList *attrs, struct GNUNET_RECLAIM_Presentation **presentation)
static 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_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.
A list of GNUNET_RECLAIM_Attribute structures.
struct GNUNET_RECLAIM_AttributeListEntry * list_head
List head.
const char * name
The name of the 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.
void * cls
Closure for all of the callbacks.
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.
A credential presentation.
Time for absolute times used by GNUnet, in microseconds.
uint64_t abs_value_us
The actual value.