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"
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_AttributeList * | pabc_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_AttributeList * | pabc_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_AttributeList * | pabc_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... | |
reclaim-credential-plugin-pabc attribute plugin to provide the API for pabc credentials.
Definition in file plugin_reclaim_credential_pabc.c.
|
static |
Convert the 'value' of an credential to a string.
cls | closure, unused |
type | type of the credential |
data | value in binary encoding |
data_size | number of bytes in data |
Definition at line 46 of file plugin_reclaim_credential_pabc.c.
References data, data_size, GNUNET_RECLAIM_CREDENTIAL_TYPE_PABC, GNUNET_strndup, and type.
Referenced by libgnunet_plugin_reclaim_credential_pabc_init().
|
static |
Convert human-readable version of a 'value' of an credential to the binary representation.
cls | closure, unused |
type | type of the credential |
s | human-readable string |
data | set to value in binary encoding (will be allocated) |
data_size | set to number of bytes in data |
Definition at line 74 of file plugin_reclaim_credential_pabc.c.
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().
|
static |
Convert a type name to the corresponding number.
cls | closure, unused |
pabc_typename | name to convert |
Definition at line 114 of file plugin_reclaim_credential_pabc.c.
References name, and pabc_cred_name_map.
Referenced by libgnunet_plugin_reclaim_credential_pabc_init().
|
static |
Convert a type number (i.e.
1) to the corresponding type string
cls | closure, unused |
type | number of a type to convert |
Definition at line 134 of file plugin_reclaim_credential_pabc.c.
References name, number, pabc_cred_name_map, and type.
Referenced by libgnunet_plugin_reclaim_credential_pabc_init().
|
static |
Definition at line 148 of file plugin_reclaim_credential_pabc.c.
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().
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.
cls | the plugin |
cred | the pabc credential |
Definition at line 182 of file plugin_reclaim_credential_pabc.c.
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().
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.
cls | the plugin |
cred | the pabc credential |
Definition at line 206 of file plugin_reclaim_credential_pabc.c.
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().
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.
cls | the plugin |
cred | the pabc credential |
Definition at line 223 of file plugin_reclaim_credential_pabc.c.
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().
char* pabc_get_issuer | ( | void * | cls, |
const char * | data, | ||
size_t | data_size | ||
) |
Parse a pabc and return the issuer.
cls | the plugin |
cred | the pabc credential |
Definition at line 240 of file plugin_reclaim_credential_pabc.c.
Referenced by pabc_get_expiration(), and pabc_get_issuer_c().
char* pabc_get_issuer_c | ( | void * | cls, |
const struct GNUNET_RECLAIM_Credential * | cred | ||
) |
Parse a pabc and return the issuer.
cls | the plugin |
cred | the pabc credential |
Definition at line 261 of file plugin_reclaim_credential_pabc.c.
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().
char* pabc_get_issuer_p | ( | void * | cls, |
const struct GNUNET_RECLAIM_Presentation * | cred | ||
) |
Parse a pabc and return the issuer.
cls | the plugin |
cred | the pabc credential |
Definition at line 278 of file plugin_reclaim_credential_pabc.c.
Referenced by libgnunet_plugin_reclaim_credential_pabc_init().
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.
cls | the plugin |
cred | the pabc credential |
Definition at line 278 of file plugin_reclaim_credential_pabc.c.
References GNUNET_RECLAIM_Presentation::data, GNUNET_RECLAIM_Presentation::data_size, GNUNET_RECLAIM_CREDENTIAL_TYPE_PABC, pabc_get_issuer(), and GNUNET_RECLAIM_Presentation::type.
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.
cls | the plugin |
cred | the pabc credential |
Definition at line 278 of file plugin_reclaim_credential_pabc.c.
Referenced by libgnunet_plugin_reclaim_credential_pabc_init().
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.
cls | the plugin |
cred | the pabc credential |
Definition at line 278 of file plugin_reclaim_credential_pabc.c.
Referenced by libgnunet_plugin_reclaim_credential_pabc_init().
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.
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().
void* libgnunet_plugin_reclaim_credential_pabc_init | ( | void * | cls | ) |
Entry point for the plugin.
cls | NULL |
Definition at line 532 of file plugin_reclaim_credential_pabc.c.
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.
void* libgnunet_plugin_reclaim_credential_pabc_done | ( | void * | cls | ) |
Exit point from the plugin.
cls | the return value from libgnunet_plugin_block_test_init() |
Definition at line 563 of file plugin_reclaim_credential_pabc.c.
References GNUNET_RECLAIM_CredentialPluginFunctions::cls, and GNUNET_free.
const char* name |
Definition at line 101 of file plugin_reclaim_credential_pabc.c.
Referenced by pabc_number_to_typename(), and pabc_typename_to_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[] |
Mapping of credential type numbers to human-readable credential type names.
Referenced by pabc_number_to_typename(), and pabc_typename_to_number().