command line tool to access command line Credential service More...
#include "gnunet_error_codes.h"
#include "platform.h"
#include <gnunet_util_lib.h>
#include <gnunet_abd_service.h>
#include <gnunet_gnsrecord_lib.h>
#include <gnunet_namestore_service.h>
#include "delegate_misc.h"
#include "abd_serialization.h"
Go to the source code of this file.
Functions | |
static void | do_shutdown (void *cls) |
Task run on shutdown. More... | |
static void | do_timeout (void *cls) |
Task run on timeout. More... | |
static void | handle_intermediate_result (void *cls, struct GNUNET_ABD_Delegation *dd, bool is_bw) |
static void | handle_collect_result (void *cls, unsigned int d_count, struct GNUNET_ABD_Delegation *dc, unsigned int c_count, struct GNUNET_ABD_Delegate *dele) |
static void | handle_verify_result (void *cls, unsigned int d_count, struct GNUNET_ABD_Delegation *dc, unsigned int c_count, struct GNUNET_ABD_Delegate *dele) |
static void | identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) |
Callback invoked from identity service with ego information. More... | |
static int | parse_expiration (const char *expirationstring, int *etime_is_rel_, uint64_t *etime_) |
Parse expiration time. More... | |
static void | error_cb (void *cls) |
Function called if lookup fails. More... | |
static void | add_continuation (void *cls, enum GNUNET_ErrorCode ec) |
static void | get_existing_record (void *cls, const struct GNUNET_CRYPTO_PrivateKey *zone_key, const char *rec_name, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd) |
static void | store_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) |
static void | sign_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) |
static void | run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) |
Main function that will be run. More... | |
int | main (int argc, char *const *argv) |
The main function for gnunet-gns. More... | |
Variables | |
static const struct GNUNET_CONFIGURATION_Handle * | cfg |
Configuration we are using. More... | |
static struct GNUNET_NAMESTORE_Handle * | ns |
Handle to the namestore. More... | |
static struct GNUNET_CRYPTO_PrivateKey | zone_pkey |
Private key for the our zone. More... | |
static struct GNUNET_IDENTITY_EgoLookup * | el |
EgoLookup. More... | |
static struct GNUNET_ABD_Handle * | abd |
Handle to Credential service. More... | |
static struct GNUNET_TIME_Relative | timeout |
Desired timeout for the lookup (default is no timeout). More... | |
static struct GNUNET_ABD_Request * | verify_request |
Handle to verify request. More... | |
static struct GNUNET_ABD_Request * | collect_request |
Handle to collect request. More... | |
static struct GNUNET_SCHEDULER_Task * | tt |
Task scheduled to handle timeout. More... | |
static int | ret = 0 |
Return value of the commandline. More... | |
static char * | subject |
Subject pubkey string. More... | |
static char * | subject_delegate |
Subject delegate string. More... | |
static char * | expiration |
Credential TTL. More... | |
struct GNUNET_CRYPTO_PublicKey | subject_pkey |
Subject key. More... | |
struct GNUNET_CRYPTO_PublicKey | issuer_pkey |
Issuer key. More... | |
static char * | issuer_key |
Issuer pubkey string. More... | |
static char * | ego_name |
ego More... | |
static char * | issuer_attr |
Issuer attribute. More... | |
static int | verify |
Verify mode. More... | |
static int | collect |
Collect mode. More... | |
static int | create_is |
Create mode. More... | |
static int | create_ss |
Create mode. More... | |
static int | sign_ss |
Create mode. More... | |
static char * | import |
Signed issue credentials. More... | |
static int | is_private |
Is record private. More... | |
static int | forward |
Search direction: forward. More... | |
static int | backward |
Search direction: backward. More... | |
enum GNUNET_ABD_AlgoDirectionFlags | direction = 0 |
API enum, filled and passed for collect/verify. More... | |
static struct GNUNET_NAMESTORE_QueueEntry * | add_qe |
Queue entry for the 'add' operation. More... | |
static void * | data |
Value in binary format. More... | |
static size_t | data_size |
Number of bytes in data. More... | |
static uint32_t | type |
Type string converted to DNS type value. More... | |
static char * | typestring |
Type of the record to add/remove, NULL to remove all. More... | |
static uint64_t | etime |
Expiration string converted to numeric value. More... | |
static int | etime_is_rel = GNUNET_SYSERR |
Is expiration time relative or absolute time? More... | |
static const char * | record_label |
Record label for storing delegations. More... | |
command line tool to access command line Credential service
Definition in file gnunet-abd.c.
|
static |
Task run on shutdown.
Cleans up everything.
cls | unused |
Definition at line 220 of file gnunet-abd.c.
References abd, add_qe, el, GNUNET_ABD_disconnect(), GNUNET_ABD_request_cancel(), GNUNET_IDENTITY_ego_lookup_cancel(), GNUNET_NAMESTORE_cancel(), GNUNET_NAMESTORE_disconnect(), GNUNET_SCHEDULER_cancel(), ns, tt, and verify_request.
Referenced by run().
|
static |
Task run on timeout.
Triggers shutdown.
cls | unused |
Definition at line 261 of file gnunet-abd.c.
References GNUNET_SCHEDULER_shutdown(), and tt.
Referenced by run().
|
static |
Definition at line 269 of file gnunet-abd.c.
References GNUNET_CRYPTO_public_key_to_string(), GNUNET_ABD_Delegation::issuer_attribute, GNUNET_ABD_Delegation::issuer_key, prefix, GNUNET_ABD_Delegation::subject_attribute, and GNUNET_ABD_Delegation::subject_key.
Referenced by identity_cb(), and run().
|
static |
Definition at line 289 of file gnunet-abd.c.
References GNUNET_ABD_delegate_to_string(), GNUNET_free, GNUNET_SCHEDULER_shutdown(), line, and verify_request.
Referenced by identity_cb().
|
static |
Definition at line 318 of file gnunet-abd.c.
References dc, GNUNET_CRYPTO_public_key_to_string(), GNUNET_free, GNUNET_SCHEDULER_shutdown(), issuer_key, ret, and verify_request.
Referenced by run().
|
static |
Callback invoked from identity service with ego information.
An ego of NULL means the ego was not found.
cls | closure with the configuration |
ego | an ego known to identity service, or NULL |
Definition at line 383 of file gnunet-abd.c.
References _, abd, collect, collect_request, direction, ego_name, el, GNUNET_ABD_collect(), GNUNET_CRYPTO_public_key_from_string(), GNUNET_IDENTITY_ego_get_private_key(), GNUNET_OK, GNUNET_SCHEDULER_shutdown(), GNUNET_YES, handle_collect_result(), handle_intermediate_result(), issuer_attr, issuer_key, and issuer_pkey.
Referenced by run().
|
static |
Parse expiration time.
expirationstring | text to parse | |
[out] | etime_is_rel | set to GNUNET_YES if time is relative |
[out] | etime | set to expiration time (abs or rel) |
Definition at line 438 of file gnunet-abd.c.
References GNUNET_TIME_Absolute::abs_value_us, expirationstring, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NO, GNUNET_OK, GNUNET_STRINGS_absolute_time_to_string(), GNUNET_STRINGS_fancy_time_to_absolute(), GNUNET_STRINGS_fancy_time_to_relative(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_SYSERR, GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_YES, and GNUNET_TIME_Relative::rel_value_us.
Referenced by store_cb().
|
static |
Function called if lookup fails.
Definition at line 480 of file gnunet-abd.c.
References GNUNET_SCHEDULER_shutdown().
Referenced by GNUNET_NAMESTORE_records_lookup(), GNUNET_NAMESTORE_records_lookup2(), GNUNET_NAMESTORE_zone_iteration_start(), GNUNET_NAMESTORE_zone_iteration_start2(), GNUNET_NAMESTORE_zone_monitor_start(), GNUNET_NAMESTORE_zone_monitor_start2(), GNUNET_NAMESTORE_zone_to_name(), GNUNET_PEERSTORE_monitor_start(), GNUNET_RECLAIM_get_attributes_start(), GNUNET_RECLAIM_get_credentials_start(), GNUNET_RECLAIM_ticket_iteration_start(), records_lookup(), and store_cb().
|
static |
Definition at line 489 of file gnunet-abd.c.
References GNUNET_EC_NONE, GNUNET_ErrorCode_get_hint(), GNUNET_SCHEDULER_shutdown(), and qe.
Referenced by get_existing_record().
|
static |
Definition at line 504 of file gnunet-abd.c.
References add_continuation(), add_qe, data, GNUNET_GNSRECORD_Data::data, data_size, GNUNET_GNSRECORD_Data::data_size, etime, etime_is_rel, GNUNET_GNSRECORD_Data::expiration_time, GNUNET_GNSRECORD_Data::flags, GNUNET_assert, GNUNET_free, GNUNET_GNSRECORD_RF_PRIVATE, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_malloc, GNUNET_memcpy, GNUNET_NAMESTORE_record_set_store(), GNUNET_NO, GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_YES, is_private, ns, rd, rd_count, GNUNET_GNSRECORD_Data::record_type, type, and zone_pkey.
Referenced by store_cb().
|
static |
Definition at line 545 of file gnunet-abd.c.
References _, add_qe, cred, data, data_size, el, error_cb(), etime, etime_is_rel, expiration, get_existing_record(), GNUNET_ABD_delegate_from_string(), GNUNET_ABD_delegate_serialize(), GNUNET_CRYPTO_public_key_to_string(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_GNSRECORD_string_to_value(), GNUNET_GNSRECORD_TYPE_DELEGATE, GNUNET_IDENTITY_ego_get_private_key(), GNUNET_IDENTITY_ego_get_public_key(), GNUNET_log, GNUNET_NAMESTORE_connect(), GNUNET_NAMESTORE_records_lookup(), GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_shutdown(), ns, parse_expiration(), record_label, subject, type, typestring, and zone_pkey.
Referenced by run().
|
static |
Definition at line 671 of file gnunet-abd.c.
References ego_name, el, expiration, GNUNET_ABD_delegate_issue(), GNUNET_ABD_delegate_to_string(), GNUNET_CRYPTO_public_key_from_string(), GNUNET_free, GNUNET_IDENTITY_ego_get_private_key(), GNUNET_OK, GNUNET_SCHEDULER_shutdown(), GNUNET_STRINGS_fancy_time_to_absolute(), issuer_attr, res, subject, and subject_pkey.
Referenced by run().
|
static |
Main function that will be run.
cls | closure |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
c | configuration |
Definition at line 759 of file gnunet-abd.c.
References _, abd, backward, cfg, collect, create_is, create_ss, direction, do_shutdown(), do_timeout(), ego_name, el, forward, GNUNET_ABD_connect(), GNUNET_ABD_delegate_from_string(), GNUNET_ABD_FLAG_BACKWARD, GNUNET_ABD_FLAG_FORWARD, GNUNET_ABD_verify(), GNUNET_CRYPTO_public_key_from_string(), GNUNET_free, GNUNET_free_nz, GNUNET_GNS_EMPTY_LABEL_AT, GNUNET_GNSRECORD_TYPE_ATTRIBUTE, GNUNET_GNSRECORD_TYPE_DELEGATE, GNUNET_IDENTITY_ego_lookup(), GNUNET_malloc, GNUNET_memcpy, GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_strdup, GNUNET_YES, handle_intermediate_result(), handle_verify_result(), identity_cb(), issuer_attr, GNUNET_ABD_Delegate::issuer_attribute, issuer_key, issuer_pkey, record_label, sign_cb(), sign_ss, store_cb(), subject, subject_delegate, subject_pkey, timeout, tt, type, verify, and verify_request.
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
The main function for gnunet-gns.
argc | number of arguments from the command line |
argv | command line arguments |
Definition at line 1002 of file gnunet-abd.c.
References _, backward, collect, create_is, create_ss, ego_name, expiration, forward, gettext_noop, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_string(), GNUNET_log_setup(), GNUNET_OK, GNUNET_OS_project_data_gnunet(), GNUNET_PROGRAM_run(), GNUNET_TIME_UNIT_FOREVER_REL, is_private, issuer_attr, issuer_key, options, ret, run(), sign_ss, subject, subject_delegate, timeout, and verify.
|
static |
|
static |
Handle to the namestore.
Definition at line 42 of file gnunet-abd.c.
Referenced by do_shutdown(), get_existing_record(), and store_cb().
|
static |
Private key for the our zone.
Definition at line 47 of file gnunet-abd.c.
Referenced by get_existing_record(), and store_cb().
|
static |
EgoLookup.
Definition at line 52 of file gnunet-abd.c.
Referenced by do_shutdown(), identity_cb(), run(), sign_cb(), and store_cb().
|
static |
Handle to Credential service.
Definition at line 57 of file gnunet-abd.c.
Referenced by do_shutdown(), identity_cb(), and run().
|
static |
Desired timeout for the lookup (default is no timeout).
Definition at line 62 of file gnunet-abd.c.
|
static |
Handle to verify request.
Definition at line 67 of file gnunet-abd.c.
Referenced by do_shutdown(), handle_collect_result(), handle_verify_result(), and run().
|
static |
|
static |
Task scheduled to handle timeout.
Definition at line 77 of file gnunet-abd.c.
Referenced by do_shutdown(), do_timeout(), and run().
|
static |
Return value of the commandline.
Definition at line 82 of file gnunet-abd.c.
Referenced by handle_verify_result(), and main().
|
static |
Subject pubkey string.
Definition at line 87 of file gnunet-abd.c.
Referenced by generate_id_token_body(), generate_userinfo_json(), GNUNET_ABD_delegate_issue(), main(), pabc_create_presentation(), run(), sign_cb(), and store_cb().
|
static |
Subject delegate string.
Definition at line 92 of file gnunet-abd.c.
|
static |
Credential TTL.
Definition at line 97 of file gnunet-abd.c.
Referenced by main(), sign_cb(), and store_cb().
struct GNUNET_CRYPTO_PublicKey subject_pkey |
Subject key.
Definition at line 102 of file gnunet-abd.c.
Referenced by abd_string_to_value(), abd_value_to_string(), GNUNET_ABD_delegate_from_string(), GNUNET_ABD_delegate_to_string(), run(), and sign_cb().
struct GNUNET_CRYPTO_PublicKey issuer_pkey |
Issuer key.
Definition at line 107 of file gnunet-abd.c.
Referenced by GNUNET_ABD_delegate_from_string(), GNUNET_ABD_delegate_to_string(), identity_cb(), and run().
|
static |
Issuer pubkey string.
Definition at line 113 of file gnunet-abd.c.
Referenced by GNUNET_ABD_collect(), GNUNET_ABD_verify(), handle_verify_result(), identity_cb(), main(), and run().
|
static |
ego
Definition at line 118 of file gnunet-abd.c.
Referenced by identity_cb(), main(), run(), and sign_cb().
|
static |
Issuer attribute.
Definition at line 123 of file gnunet-abd.c.
Referenced by identity_cb(), main(), run(), and sign_cb().
|
static |
Verify mode.
Definition at line 128 of file gnunet-abd.c.
Referenced by check_ssl_certificate(), get_store_peer_of(), main(), run(), and verify_store_peer().
|
static |
Collect mode.
Definition at line 133 of file gnunet-abd.c.
Referenced by identity_cb(), main(), and run().
|
static |
|
static |
|
static |
|
static |
Signed issue credentials.
Definition at line 153 of file gnunet-abd.c.
|
static |
Is record private.
Definition at line 158 of file gnunet-abd.c.
Referenced by get_existing_record(), and main().
|
static |
Search direction: forward.
Definition at line 163 of file gnunet-abd.c.
Referenced by main(), request_room_message_step(), and run().
|
static |
Search direction: backward.
Definition at line 168 of file gnunet-abd.c.
enum GNUNET_ABD_AlgoDirectionFlags direction = 0 |
API enum, filled and passed for collect/verify.
Definition at line 173 of file gnunet-abd.c.
Referenced by check_get(), GNUNET_ABD_collect(), GNUNET_ABD_verify(), handle_get(), identity_cb(), and run().
|
static |
Queue entry for the 'add' operation.
Definition at line 178 of file gnunet-abd.c.
Referenced by do_shutdown(), get_existing_record(), and store_cb().
|
static |
Value in binary format.
Definition at line 183 of file gnunet-abd.c.
Referenced by get_existing_record(), and store_cb().
|
static |
Number of bytes in data.
Definition at line 188 of file gnunet-abd.c.
Referenced by get_existing_record(), and store_cb().
|
static |
Type string converted to DNS type value.
Definition at line 193 of file gnunet-abd.c.
Referenced by get_existing_record(), run(), and store_cb().
|
static |
Type of the record to add/remove, NULL to remove all.
Definition at line 198 of file gnunet-abd.c.
Referenced by store_cb().
|
static |
Expiration string converted to numeric value.
Definition at line 202 of file gnunet-abd.c.
Referenced by get_existing_record(), and store_cb().
|
static |
Is expiration time relative or absolute time?
Definition at line 207 of file gnunet-abd.c.
Referenced by get_existing_record(), and store_cb().
|
static |
Record label for storing delegations.
Definition at line 212 of file gnunet-abd.c.
Referenced by run(), and store_cb().