reclaim-credential-plugin-jwt attribute plugin to provide the API for JWT credentials. More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_reclaim_plugin.h"
#include <inttypes.h>
#include <jansson.h>
Go to the source code of this file.
Functions | |
static char * | jwt_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 | jwt_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 | jwt_typename_to_number (void *cls, const char *jwt_typename) |
Convert a type name to the corresponding number. More... | |
static const char * | jwt_number_to_typename (void *cls, uint32_t type) |
Convert a type number to the corresponding type string (e.g. More... | |
static struct GNUNET_RECLAIM_AttributeList * | jwt_parse_attributes (void *cls, const char *data, size_t data_size) |
Parse a JWT and return the respective claim value as Attribute. More... | |
static struct GNUNET_RECLAIM_AttributeList * | jwt_parse_attributes_c (void *cls, const struct GNUNET_RECLAIM_Credential *cred) |
Parse a JWT and return the respective claim value as Attribute. More... | |
static struct GNUNET_RECLAIM_AttributeList * | jwt_parse_attributes_p (void *cls, const struct GNUNET_RECLAIM_Presentation *cred) |
Parse a JWT and return the respective claim value as Attribute. More... | |
static char * | jwt_get_issuer (void *cls, const char *data, size_t data_size) |
Parse a JWT and return the issuer. More... | |
static char * | jwt_get_issuer_c (void *cls, const struct GNUNET_RECLAIM_Credential *cred) |
Parse a JWT and return the issuer. More... | |
static char * | jwt_get_issuer_p (void *cls, const struct GNUNET_RECLAIM_Presentation *cred) |
Parse a JWT and return the issuer. More... | |
static enum GNUNET_GenericReturnValue | jwt_get_expiration (void *cls, const char *data, size_t data_size, struct GNUNET_TIME_Absolute *exp) |
Parse a JWT and return the expiration. More... | |
static enum GNUNET_GenericReturnValue | jwt_get_expiration_c (void *cls, const struct GNUNET_RECLAIM_Credential *cred, struct GNUNET_TIME_Absolute *exp) |
Parse a JWT and return the expiration. More... | |
static enum GNUNET_GenericReturnValue | jwt_get_expiration_p (void *cls, const struct GNUNET_RECLAIM_Presentation *cred, struct GNUNET_TIME_Absolute *exp) |
Parse a JWT and return the expiration. More... | |
static enum GNUNET_GenericReturnValue | jwt_create_presentation (void *cls, const struct GNUNET_RECLAIM_Credential *cred, const struct GNUNET_RECLAIM_AttributeList *attrs, struct GNUNET_RECLAIM_Presentation **presentation) |
void * | libgnunet_plugin_reclaim_credential_jwt_init (void *cls) |
Entry point for the plugin. More... | |
void * | libgnunet_plugin_reclaim_credential_jwt_done (void *cls) |
Exit point from the plugin. More... | |
Variables | |
struct { | |
const char * name | |
uint32_t number | |
} | jwt_cred_name_map [] |
Mapping of credential type numbers to human-readable credential type names. More... | |
reclaim-credential-plugin-jwt attribute plugin to provide the API for JWT credentials.
Definition in file plugin_reclaim_credential_jwt.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 44 of file plugin_reclaim_credential_jwt.c.
References data, data_size, GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT, GNUNET_strndup, and type.
Referenced by libgnunet_plugin_reclaim_credential_jwt_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 72 of file plugin_reclaim_credential_jwt.c.
References data, data_size, GNUNET_OK, GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT, GNUNET_strdup, GNUNET_SYSERR, and type.
Referenced by libgnunet_plugin_reclaim_credential_jwt_init().
|
static |
Convert a type name to the corresponding number.
cls | closure, unused |
jwt_typename | name to convert |
Definition at line 112 of file plugin_reclaim_credential_jwt.c.
References jwt_cred_name_map, and name.
Referenced by libgnunet_plugin_reclaim_credential_jwt_init().
|
static |
Convert a type number to the corresponding type string (e.g.
1 to "A")
cls | closure, unused |
type | number of a type to convert |
Definition at line 132 of file plugin_reclaim_credential_jwt.c.
References jwt_cred_name_map, name, number, and type.
Referenced by libgnunet_plugin_reclaim_credential_jwt_init().
|
static |
Parse a JWT and return the respective claim value as Attribute.
cls | the plugin |
cred | the jwt credential |
Definition at line 153 of file plugin_reclaim_credential_jwt.c.
References data, data_size, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_new, GNUNET_RECLAIM_attribute_list_add(), GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING, GNUNET_STRINGS_base64url_decode(), GNUNET_strndup, key, and value.
Referenced by jwt_parse_attributes_c(), and jwt_parse_attributes_p().
|
static |
Parse a JWT and return the respective claim value as Attribute.
cls | the plugin |
cred | the jwt credential |
Definition at line 268 of file plugin_reclaim_credential_jwt.c.
References cred, GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT, and jwt_parse_attributes().
Referenced by libgnunet_plugin_reclaim_credential_jwt_init().
|
static |
Parse a JWT and return the respective claim value as Attribute.
cls | the plugin |
cred | the jwt credential |
Definition at line 285 of file plugin_reclaim_credential_jwt.c.
References cred, GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT, and jwt_parse_attributes().
Referenced by libgnunet_plugin_reclaim_credential_jwt_init().
|
static |
Parse a JWT and return the issuer.
cls | the plugin |
cred | the jwt credential |
Definition at line 302 of file plugin_reclaim_credential_jwt.c.
References data, data_size, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_strdup, GNUNET_STRINGS_base64url_decode(), and GNUNET_strndup.
Referenced by jwt_get_issuer_c(), and jwt_get_issuer_p().
|
static |
Parse a JWT and return the issuer.
cls | the plugin |
cred | the jwt credential |
Definition at line 346 of file plugin_reclaim_credential_jwt.c.
References cred, GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT, and jwt_get_issuer().
Referenced by libgnunet_plugin_reclaim_credential_jwt_init().
|
static |
Parse a JWT and return the issuer.
cls | the plugin |
cred | the jwt credential |
Definition at line 363 of file plugin_reclaim_credential_jwt.c.
References cred, GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT, and jwt_get_issuer().
Referenced by libgnunet_plugin_reclaim_credential_jwt_init().
|
static |
Parse a JWT and return the expiration.
cls | the plugin |
cred | the jwt credential |
Definition at line 380 of file plugin_reclaim_credential_jwt.c.
References GNUNET_TIME_Absolute::abs_value_us, data, data_size, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_OK, GNUNET_STRINGS_base64url_decode(), GNUNET_strndup, and GNUNET_SYSERR.
Referenced by jwt_get_expiration_c(), and jwt_get_expiration_p().
|
static |
Parse a JWT and return the expiration.
cls | the plugin |
cred | the jwt credential |
Definition at line 424 of file plugin_reclaim_credential_jwt.c.
References cred, GNUNET_NO, GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT, and jwt_get_expiration().
Referenced by libgnunet_plugin_reclaim_credential_jwt_init().
|
static |
Parse a JWT and return the expiration.
cls | the plugin |
cred | the jwt credential |
Definition at line 442 of file plugin_reclaim_credential_jwt.c.
References cred, GNUNET_NO, GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT, and jwt_get_expiration().
Referenced by libgnunet_plugin_reclaim_credential_jwt_init().
|
static |
Definition at line 453 of file plugin_reclaim_credential_jwt.c.
References cred, GNUNET_NO, GNUNET_OK, GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT, and GNUNET_RECLAIM_presentation_new().
Referenced by libgnunet_plugin_reclaim_credential_jwt_init().
void * libgnunet_plugin_reclaim_credential_jwt_init | ( | void * | cls | ) |
Entry point for the plugin.
cls | NULL |
Definition at line 478 of file plugin_reclaim_credential_jwt.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, jwt_create_presentation(), jwt_get_expiration_c(), jwt_get_expiration_p(), jwt_get_issuer_c(), jwt_get_issuer_p(), jwt_number_to_typename(), jwt_parse_attributes_c(), jwt_parse_attributes_p(), jwt_string_to_value(), jwt_typename_to_number(), jwt_value_to_string(), GNUNET_RECLAIM_CredentialPluginFunctions::number_to_typename, GNUNET_RECLAIM_CredentialPluginFunctions::number_to_typename_p, 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_jwt_done | ( | void * | cls | ) |
Exit point from the plugin.
cls | the return value from libgnunet_plugin_block_test_init() |
Definition at line 512 of file plugin_reclaim_credential_jwt.c.
References GNUNET_RECLAIM_CredentialPluginFunctions::cls, and GNUNET_free.
const char* name |
Definition at line 99 of file plugin_reclaim_credential_jwt.c.
Referenced by jwt_number_to_typename(), and jwt_typename_to_number().
uint32_t number |
Definition at line 100 of file plugin_reclaim_credential_jwt.c.
Referenced by jwt_number_to_typename().
struct { ... } jwt_cred_name_map[] |
Mapping of credential type numbers to human-readable credential type names.
Referenced by jwt_number_to_typename(), and jwt_typename_to_number().