GNUnet 0.21.0
gnunet-abd.c File Reference

command line tool to access command line Credential service More...

Include dependency graph for gnunet-abd.c:

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, int32_t success, const char *emsg)
 
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_Handlecfg
 Configuration we are using. More...
 
static struct GNUNET_NAMESTORE_Handlens
 Handle to the namestore. More...
 
static struct GNUNET_CRYPTO_PrivateKey zone_pkey
 Private key for the our zone. More...
 
static struct GNUNET_IDENTITY_EgoLookupel
 EgoLookup. More...
 
static struct GNUNET_ABD_Handleabd
 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_Requestverify_request
 Handle to verify request. More...
 
static struct GNUNET_ABD_Requestcollect_request
 Handle to collect request. More...
 
static struct GNUNET_SCHEDULER_Tasktt
 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_QueueEntryadd_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 char * record_label
 Record label for storing delegations. More...
 

Detailed Description

command line tool to access command line Credential service

Author
Martin Schanzenbach

Definition in file gnunet-abd.c.

Function Documentation

◆ do_shutdown()

static void do_shutdown ( void *  cls)
static

Task run on shutdown.

Cleans up everything.

Parameters
clsunused

Definition at line 219 of file gnunet-abd.c.

220{
221 if (NULL != verify_request)
222 {
224 verify_request = NULL;
225 }
226 if (NULL != abd)
227 {
229 abd = NULL;
230 }
231 if (NULL != tt)
232 {
234 tt = NULL;
235 }
236 if (NULL != el)
237 {
239 el = NULL;
240 }
241 if (NULL != add_qe)
242 {
244 add_qe = NULL;
245 }
246 if (NULL != ns)
247 {
249 ns = NULL;
250 }
251}
static struct GNUNET_NAMESTORE_QueueEntry * add_qe
Queue entry for the 'add' operation.
Definition: gnunet-abd.c:177
static struct GNUNET_IDENTITY_EgoLookup * el
EgoLookup.
Definition: gnunet-abd.c:51
static struct GNUNET_SCHEDULER_Task * tt
Task scheduled to handle timeout.
Definition: gnunet-abd.c:76
static struct GNUNET_NAMESTORE_Handle * ns
Handle to the namestore.
Definition: gnunet-abd.c:41
static struct GNUNET_ABD_Handle * abd
Handle to Credential service.
Definition: gnunet-abd.c:56
static struct GNUNET_ABD_Request * verify_request
Handle to verify request.
Definition: gnunet-abd.c:66
void GNUNET_ABD_disconnect(struct GNUNET_ABD_Handle *handle)
Shutdown connection with the ABD service.
Definition: abd_api.c:376
void GNUNET_ABD_request_cancel(struct GNUNET_ABD_Request *lr)
Cancel pending verify request.
Definition: abd_api.c:399
void GNUNET_IDENTITY_ego_lookup_cancel(struct GNUNET_IDENTITY_EgoLookup *el)
Abort ego lookup attempt.
void GNUNET_NAMESTORE_disconnect(struct GNUNET_NAMESTORE_Handle *h)
Disconnect from the namestore service (and free associated resources).
void GNUNET_NAMESTORE_cancel(struct GNUNET_NAMESTORE_QueueEntry *qe)
Cancel a namestore operation.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:975

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().

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

◆ do_timeout()

static void do_timeout ( void *  cls)
static

Task run on timeout.

Triggers shutdown.

Parameters
clsunused

Definition at line 260 of file gnunet-abd.c.

261{
262 tt = NULL;
264}
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:562

References GNUNET_SCHEDULER_shutdown(), and tt.

Referenced by run().

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

◆ handle_intermediate_result()

static void handle_intermediate_result ( void *  cls,
struct GNUNET_ABD_Delegation dd,
bool  is_bw 
)
static

Definition at line 268 of file gnunet-abd.c.

271{
272 char *prefix = "";
273 if (is_bw)
274 prefix = "Backward -";
275 else
276 prefix = "Forward -";
277
278 printf ("%s Intermediate result: %s.%s <- %s.%s\n",
279 prefix,
284}
static int prefix
If printing the value of PREFIX has been requested.
Definition: gnunet-config.c:59
char * GNUNET_CRYPTO_public_key_to_string(const struct GNUNET_CRYPTO_PublicKey *key)
Creates a (Base32) string representation of the public key.
Definition: crypto_pkey.c:551
struct GNUNET_CRYPTO_PublicKey subject_key
Public key of the subject this attribute was delegated to.
const char * issuer_attribute
The attribute.
const char * subject_attribute
The attribute.
struct GNUNET_CRYPTO_PublicKey issuer_key
The issuer of the delegation.

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().

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

◆ handle_collect_result()

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

Definition at line 288 of file gnunet-abd.c.

293{
294 int i;
295 char *line;
296
297 verify_request = NULL;
298 if (NULL != dele)
299 {
300 for (i = 0; i < c_count; i++)
301 {
303 printf ("%s\n", line);
305 }
306 }
307 else
308 {
309 printf ("Received NULL\n");
310 }
311
313}
char * GNUNET_ABD_delegate_to_string(const struct GNUNET_ABD_Delegate *cred)
Definition: delegate_misc.c:37
static char * line
Desired phone line (string to be converted to a hash).
#define GNUNET_free(ptr)
Wrapper around free.

References GNUNET_ABD_delegate_to_string(), GNUNET_free, GNUNET_SCHEDULER_shutdown(), line, and verify_request.

Referenced by identity_cb().

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

◆ handle_verify_result()

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

Definition at line 317 of file gnunet-abd.c.

322{
323 int i;
324 char *iss_key;
325 char *sub_key;
326
327 verify_request = NULL;
328 if (NULL == dele)
329 ret = 1;
330 else
331 {
332 printf ("Delegation Chain:\n");
333 for (i = 0; i < d_count; i++)
334 {
336 sub_key = GNUNET_CRYPTO_public_key_to_string (&dc[i].subject_key);
337
338 if (0 != dc[i].subject_attribute_len)
339 {
340 printf ("(%d) %s.%s <- %s.%s\n",
341 i,
342 iss_key,
343 dc[i].issuer_attribute,
344 sub_key,
345 dc[i].subject_attribute);
346 }
347 else
348 {
349 printf ("(%d) %s.%s <- %s\n",
350 i,
351 iss_key,
352 dc[i].issuer_attribute,
353 sub_key);
354 }
355 GNUNET_free (iss_key);
356 GNUNET_free (sub_key);
357 }
358 printf ("\nDelegate(s):\n");
359 for (i = 0; i < c_count; i++)
360 {
362 sub_key = GNUNET_CRYPTO_public_key_to_string (&dele[i].subject_key);
363 printf ("%s.%s <- %s\n", iss_key, dele[i].issuer_attribute, sub_key);
364 GNUNET_free (iss_key);
365 GNUNET_free (sub_key);
366 }
367 printf ("Successful.\n");
368 }
369
371}
static char * issuer_key
Issuer pubkey string.
Definition: gnunet-abd.c:112
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
static struct GNUNET_FS_DownloadContext * dc

References dc, GNUNET_CRYPTO_public_key_to_string(), GNUNET_free, GNUNET_SCHEDULER_shutdown(), issuer_key, ret, and verify_request.

Referenced by run().

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

◆ identity_cb()

static void identity_cb ( void *  cls,
struct GNUNET_IDENTITY_Ego ego 
)
static

Callback invoked from identity service with ego information.

An ego of NULL means the ego was not found.

Parameters
clsclosure with the configuration
egoan ego known to identity service, or NULL

Definition at line 382 of file gnunet-abd.c.

383{
384 const struct GNUNET_CRYPTO_PrivateKey *privkey;
385
386 el = NULL;
387 if (NULL == ego)
388 {
389 if (NULL != ego_name)
390 {
391 fprintf (stderr,
392 _ ("Ego `%s' not known to identity service\n"),
393 ego_name);
394 }
396 return;
397 }
398
399 if (GNUNET_YES == collect)
400 {
401
402 if (GNUNET_OK !=
404 &issuer_pkey))
405 {
406 fprintf (stderr,
407 _ ("Issuer public key `%s' is not well-formed\n"),
408 issuer_key);
410 }
412
416 privkey,
417 direction,
419 NULL,
421 NULL);
422 return;
423 }
425}
static struct GNUNET_ABD_Request * collect_request
Handle to collect request.
Definition: gnunet-abd.c:71
static char * issuer_attr
Issuer attribute.
Definition: gnunet-abd.c:122
struct GNUNET_CRYPTO_PublicKey issuer_pkey
Issuer key.
Definition: gnunet-abd.c:106
static int collect
Collect mode.
Definition: gnunet-abd.c:132
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)
Definition: gnunet-abd.c:288
static char * ego_name
ego
Definition: gnunet-abd.c:117
enum GNUNET_ABD_AlgoDirectionFlags direction
API enum, filled and passed for collect/verify.
Definition: gnunet-abd.c:172
static void handle_intermediate_result(void *cls, struct GNUNET_ABD_Delegation *dd, bool is_bw)
Definition: gnunet-abd.c:268
struct GNUNET_ABD_Request * GNUNET_ABD_collect(struct GNUNET_ABD_Handle *handle, const struct GNUNET_CRYPTO_PublicKey *issuer_key, const char *issuer_attribute, const struct GNUNET_CRYPTO_PrivateKey *subject_key, enum GNUNET_ABD_AlgoDirectionFlags direction, GNUNET_ABD_CredentialResultProcessor proc, void *proc_cls, GNUNET_ABD_IntermediateResultProcessor proc2, void *proc2_cls)
Performs attribute collection.
Definition: abd_api.c:423
const struct GNUNET_CRYPTO_PrivateKey * GNUNET_IDENTITY_ego_get_private_key(const struct GNUNET_IDENTITY_Ego *ego)
Obtain the ECC key associated with a ego.
Definition: identity_api.c:517
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_public_key_from_string(const char *str, struct GNUNET_CRYPTO_PublicKey *key)
Parses a (Base32) string representation of the public key.
Definition: crypto_pkey.c:571
@ GNUNET_OK
@ GNUNET_YES
#define _(String)
GNU gettext support macro.
Definition: platform.h:178
A private key for an identity as per LSD0001.

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().

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

◆ parse_expiration()

static int parse_expiration ( const char *  expirationstring,
int *  etime_is_rel,
uint64_t *  etime 
)
static

Parse expiration time.

Parameters
expirationstringtext to parse
[out]etime_is_relset to GNUNET_YES if time is relative
[out]etimeset to expiration time (abs or rel)
Returns
GNUNET_OK on success

Definition at line 437 of file gnunet-abd.c.

440{
441 // copied from namestore/gnunet-namestore.c
442 struct GNUNET_TIME_Relative etime_rel;
443 struct GNUNET_TIME_Absolute etime_abs;
444
445 if (0 == strcmp (expirationstring, "never"))
446 {
447 *etime = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
449 return GNUNET_OK;
450 }
451 if (GNUNET_OK ==
453 {
455 *etime = etime_rel.rel_value_us;
457 "Storing record with relative expiration time of %s\n",
459 return GNUNET_OK;
460 }
461 if (GNUNET_OK ==
463 {
465 *etime = etime_abs.abs_value_us;
467 "Storing record with absolute expiration time of %s\n",
469 return GNUNET_OK;
470 }
471 return GNUNET_SYSERR;
472}
static int etime_is_rel
Is expiration time relative or absolute time?
Definition: gnunet-abd.c:206
static uint64_t etime
Expiration string converted to numeric value.
Definition: gnunet-abd.c:201
static char * expirationstring
Desired expiration time.
#define GNUNET_log(kind,...)
@ GNUNET_NO
@ GNUNET_SYSERR
@ GNUNET_ERROR_TYPE_DEBUG
enum GNUNET_GenericReturnValue GNUNET_STRINGS_fancy_time_to_relative(const char *fancy_time, struct GNUNET_TIME_Relative *rtime)
Convert a given fancy human-readable time to our internal representation.
Definition: strings.c:260
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
Definition: strings.c:570
const char * GNUNET_STRINGS_absolute_time_to_string(struct GNUNET_TIME_Absolute t)
Like asctime, except for GNUnet time.
Definition: strings.c:617
#define GNUNET_TIME_UNIT_FOREVER_ABS
Constant used to specify "forever".
enum GNUNET_GenericReturnValue GNUNET_STRINGS_fancy_time_to_absolute(const char *fancy_time, struct GNUNET_TIME_Absolute *atime)
Convert a given fancy human-readable time to our internal representation.
Definition: strings.c:302
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.

References GNUNET_TIME_Absolute::abs_value_us, etime, etime_is_rel, 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().

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

◆ error_cb()

static void error_cb ( void *  cls)
static

Function called if lookup fails.

Definition at line 479 of file gnunet-abd.c.

480{
481 fprintf (stderr, "Error occurred during lookup, shutting down.\n");
483 return;
484}

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().

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

◆ add_continuation()

static void add_continuation ( void *  cls,
int32_t  success,
const char *  emsg 
)
static

Definition at line 488 of file gnunet-abd.c.

489{
490 struct GNUNET_NAMESTORE_QueueEntry **qe = cls;
491 *qe = NULL;
492
493 if (GNUNET_OK == success)
494 printf ("Adding successful.\n");
495 else
496 fprintf (stderr, "Error occurred during adding, shutting down.\n");
497
499}
static struct GNUNET_DATASTORE_QueueEntry * qe
Current operation.
An QueueEntry used to store information for a pending NAMESTORE record operation.
Definition: namestore_api.c:49

References GNUNET_OK, GNUNET_SCHEDULER_shutdown(), and qe.

Referenced by get_existing_record().

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

◆ get_existing_record()

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

Definition at line 503 of file gnunet-abd.c.

508{
509 struct GNUNET_GNSRECORD_Data *rde;
510 struct GNUNET_GNSRECORD_Data*rdn =
511 GNUNET_malloc (sizeof(*rdn) * (rd_count + 1));
512
513 memset (rdn, 0, sizeof (struct GNUNET_GNSRECORD_Data));
514 GNUNET_memcpy (&rdn[1], rd,
515 rd_count * sizeof (struct GNUNET_GNSRECORD_Data));
516 rde = &rdn[0];
517 rde->data = data;
518 rde->data_size = data_size;
519 rde->record_type = type;
520
521 // Set flags
522 if (GNUNET_YES == is_private)
524 rde->expiration_time = etime;
527 else if (GNUNET_NO != etime_is_rel)
529
530 GNUNET_assert (NULL != rec_name);
532 &zone_pkey,
533 rec_name,
534 rd_count + 1,
535 rde,
537 &add_qe);
538 GNUNET_free (rdn);
539 return;
540}
static struct GNUNET_CRYPTO_PrivateKey zone_pkey
Private key for the our zone.
Definition: gnunet-abd.c:46
static int is_private
Is record private.
Definition: gnunet-abd.c:157
static void * data
Value in binary format.
Definition: gnunet-abd.c:182
static void add_continuation(void *cls, int32_t success, const char *emsg)
Definition: gnunet-abd.c:488
static uint32_t type
Type string converted to DNS type value.
Definition: gnunet-abd.c:192
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
static unsigned int rd_count
Number of records for currently parsed set.
static struct GNUNET_GNSRECORD_Data rd[50]
The record data under a single label.
@ GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION
This expiration time of the record is a relative time (not an absolute time).
@ GNUNET_GNSRECORD_RF_PRIVATE
This is a private record of this peer and it should thus not be published.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_malloc(size)
Wrapper around malloc.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *pkey, unsigned int rd_set_count, const struct GNUNET_NAMESTORE_RecordInfo *record_info, unsigned int *rds_sent, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
Store one or more record sets in the namestore.
uint32_t record_type
Type of the GNS/DNS record.
const void * data
Binary value stored in the DNS record.
size_t data_size
Number of bytes in data.
enum GNUNET_GNSRECORD_Flags flags
Flags for the record.
uint64_t expiration_time
Expiration time for the DNS record.

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_records_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().

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

◆ store_cb()

static void store_cb ( void *  cls,
struct GNUNET_IDENTITY_Ego ego 
)
static

Definition at line 544 of file gnunet-abd.c.

545{
546 const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
547 struct GNUNET_ABD_Delegate *cred;
548 struct GNUNET_CRYPTO_PublicKey zone_pubkey;
549 char *subject_pubkey_str;
550 char *zone_pubkey_str;
551
552 el = NULL;
553
555 if (NULL == ns)
556 {
558 _ ("Failed to connect to namestore\n"));
560 return;
561 }
562
563 if (NULL == ego)
564 {
566 _("Ego does not exist!\n"));
568 return;
569 }
570
571 // Key handling
573
575 {
576 // Parse import
577 cred = GNUNET_ABD_delegate_from_string (import);
578
579 if (NULL == cred)
580 {
581 fprintf (stderr,
582 "%s is not a valid credential\n", import);
584 return;
585 }
586
587 // Get import subject public key string
588 subject_pubkey_str =
590
591 // Get zone public key string
592 GNUNET_IDENTITY_ego_get_public_key (ego, &zone_pubkey);
593 zone_pubkey_str =
595
596 // Check if the subject key in the signed import matches the zone's key it is issued to
597 if (strcmp (zone_pubkey_str, subject_pubkey_str) != 0)
598 {
599 fprintf (stderr,
600 "Import signed delegate does not match this ego's public key.\n");
601 GNUNET_free (cred);
603 return;
604 }
605
606 // Expiration
609
610 // Prepare the data to be store in the record
611 data_size = GNUNET_ABD_delegate_serialize (cred, (char **) &data);
612 GNUNET_free (cred);
613 }
614 else
615 {
616 // For all other types e.g. GNUNET_GNSRECORD_TYPE_ATTRIBUTE
617 if (GNUNET_OK !=
619 {
620 if (typestring == NULL)
621 {
622 fputs ("Value for unknown record type not well-formed.\n", stderr);
623 }
624 else if (subject == NULL)
625 {
626 fprintf (stderr,
627 "Value for record type `%s' not well-formed.\n",
628 typestring);
629 }
630 else
631 {
632 fprintf (stderr,
633 "Value `%s' invalid for record type `%s'\n",
634 subject,
635 typestring);
636 }
638 return;
639 }
640
641 // Take care of expiration
642 if (NULL == expiration)
643 {
644 fprintf (stderr, "Missing option -e for operation 'create'\n");
646 return;
647 }
649 {
650 fprintf (stderr, "Invalid time format `%s'\n", expiration);
652 return;
653 }
654 }
655
656 // Start lookup
658 &zone_pkey,
660 &error_cb,
661 NULL,
663 NULL);
664 return;
665}
int GNUNET_ABD_delegate_serialize(struct GNUNET_ABD_Delegate *dele, char **data)
struct GNUNET_ABD_Delegate * GNUNET_ABD_delegate_from_string(const char *s)
Definition: delegate_misc.c:80
static char * record_label
Record label for storing delegations.
Definition: gnunet-abd.c:211
static char * expiration
Credential TTL.
Definition: gnunet-abd.c:96
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static int parse_expiration(const char *expirationstring, int *etime_is_rel, uint64_t *etime)
Parse expiration time.
Definition: gnunet-abd.c:437
static void error_cb(void *cls)
Function called if lookup fails.
Definition: gnunet-abd.c:479
static char * subject
Subject pubkey string.
Definition: gnunet-abd.c:86
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)
Definition: gnunet-abd.c:503
static char * typestring
Type of the record to add/remove, NULL to remove all.
Definition: gnunet-abd.c:197
int GNUNET_GNSRECORD_string_to_value(uint32_t type, const char *s, void **data, size_t *data_size)
Convert human-readable version of the value s of a record of type type to the respective binary repre...
Definition: gnsrecord.c:177
void GNUNET_IDENTITY_ego_get_public_key(struct GNUNET_IDENTITY_Ego *ego, struct GNUNET_CRYPTO_PublicKey *pk)
Get the identifier (public key) of an ego.
Definition: identity_api.c:529
@ GNUNET_ERROR_TYPE_ERROR
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *pkey, const char *label, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor rm, void *rm_cls)
Lookup an item in the namestore.
struct GNUNET_NAMESTORE_Handle * GNUNET_NAMESTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the namestore service.
#define GNUNET_GNSRECORD_TYPE_DELEGATE
For ABD policies.
struct GNUNET_TIME_Absolute expiration
Expiration of this credential.
struct GNUNET_CRYPTO_PublicKey subject_key
Public key of the subject this credential was issued to.
An identity key as per LSD0001.
uint64_t abs_value_us
The actual value.

References _, GNUNET_TIME_Absolute::abs_value_us, add_qe, cfg, data, data_size, el, error_cb(), etime, etime_is_rel, expiration, GNUNET_ABD_Delegate::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, GNUNET_ABD_Delegate::subject_key, type, typestring, and zone_pkey.

Referenced by run().

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

◆ sign_cb()

static void sign_cb ( void *  cls,
struct GNUNET_IDENTITY_Ego ego 
)
static

Definition at line 669 of file gnunet-abd.c.

670{
671 const struct GNUNET_CRYPTO_PrivateKey *privkey;
672 struct GNUNET_ABD_Delegate *dele;
673 struct GNUNET_TIME_Absolute etime_abs;
674 char *res;
675
676 el = NULL;
677
678 // work on expiration time
679 if (NULL == expiration)
680 {
681 fprintf (stderr, "Please specify a TTL\n");
683 return;
684 }
685 else if (GNUNET_OK !=
687 {
688 fprintf (stderr,
689 "%s is not a valid ttl! Only absolute times are accepted!\n",
690 expiration);
692 return;
693 }
694
695 // If contains a space - split it by the first space only - assume first entry is subject followed by attribute(s)
696 char *subject_pubkey_str;
697 char *subject_attr = NULL;
698 char *token;
699
700 // Subject Public Key
701 token = strtok (subject, " ");
702 subject_pubkey_str = token;
703 // Subject Attribute(s)
704 token = strtok (NULL, " ");
705 if (NULL != token)
706 {
707 subject_attr = token;
708 }
709
710 // work on keys
712
713 if (NULL == subject_pubkey_str)
714 {
715 fprintf (stderr,
716 "Subject pubkey not given\n");
718 return;
719 }
720 if (GNUNET_OK !=
721 GNUNET_CRYPTO_public_key_from_string (subject_pubkey_str,
722 &subject_pkey))
723 {
724 fprintf (stderr,
725 "Subject public key `%s' is not well-formed\n",
726 subject_pubkey_str);
728 return;
729 }
730
731 // Sign delegate
732 dele = GNUNET_ABD_delegate_issue (privkey,
735 subject_attr,
736 &etime_abs);
738 GNUNET_free (dele);
739 printf ("%s\n", res);
740
742 ego_name = NULL;
743
745}
struct GNUNET_CRYPTO_PublicKey subject_pkey
Subject key.
Definition: gnunet-abd.c:101
static char * res
Currently read line or NULL on EOF.
struct GNUNET_ABD_Delegate * GNUNET_ABD_delegate_issue(const struct GNUNET_CRYPTO_PrivateKey *issuer, struct GNUNET_CRYPTO_PublicKey *subject, const char *iss_attr, const char *sub_attr, struct GNUNET_TIME_Absolute *expiration)
Issue an attribute to a subject.

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().

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

◆ run()

static void run ( void *  cls,
char *const *  args,
const char *  cfgfile,
const struct GNUNET_CONFIGURATION_Handle c 
)
static

Main function that will be run.

Parameters
clsclosure
argsremaining command-line arguments
cfgfilename of the configuration file used (for saving, can be NULL!)
cconfiguration

Definition at line 757 of file gnunet-abd.c.

761{
762 cfg = c;
763
766
767 // Check relevant cmdline parameters
768 if (GNUNET_YES == create_is)
769 {
770 if (NULL == ego_name)
771 {
772 fprintf (stderr, "Missing option '-ego'\n");
774 return;
775 }
776 if (NULL == issuer_attr)
777 {
778 fprintf (stderr, "Missing option '-attribute' for issuer attribute\n");
780 return;
781 }
782 if (NULL == subject)
783 {
784 fprintf (stderr, "Missing option -subject for operation 'create'.'\n");
786 return;
787 }
788
789 // Lookup ego, on success call store_cb and store as ATTRIBUTE type
793 return;
794 }
795
796 if (GNUNET_YES == create_ss)
797 {
798
799 // check if signed parameter has been passed in cmd line call
800 if (NULL == import)
801 {
802 fprintf (stderr, "'import' required\n");
804 return;
805 }
806
809 // Store subject side
811
812 return;
813 }
814
815 if (GNUNET_YES == sign_ss)
816 {
817 if (NULL == ego_name)
818 {
819 fprintf (stderr, "ego required\n");
821 return;
822 }
823 if (NULL == subject)
824 {
825 fprintf (stderr, "Subject public key needed\n");
827 return;
828 }
829
830 // lookup ego and call function sign_cb on success
832 return;
833 }
834
835 if ((GNUNET_NO == forward) && (GNUNET_NO == backward))
836 {
837 // set default: bidirectional
840 }
841 if (GNUNET_YES == forward)
843 if (GNUNET_YES == backward)
845
846 if (GNUNET_YES == collect)
847 {
848 if (NULL == issuer_key)
849 {
850 fprintf (stderr, _ ("Issuer public key not well-formed\n"));
852 return;
853 }
854
856
857 if (NULL == abd)
858 {
859 fprintf (stderr, _ ("Failed to connect to ABD\n"));
861 return;
862 }
863 if (NULL == issuer_attr)
864 {
865 fprintf (stderr, _ ("You must provide issuer the attribute\n"));
867 return;
868 }
869
870 if (NULL == ego_name)
871 {
872 fprintf (stderr, _ ("ego required\n"));
874 return;
875 }
877 return;
878 }
879
880 if (NULL == subject)
881 {
882 fprintf (stderr, _ ("Subject public key needed\n"));
884 return;
885 }
887 &subject_pkey))
888 {
889 fprintf (stderr,
890 _ ("Subject public key `%s' is not well-formed\n"),
891 subject);
893 return;
894 }
895
896 if (GNUNET_YES == verify)
897 {
898 if (NULL == issuer_key)
899 {
900 fprintf (stderr, _ ("Issuer public key not well-formed\n"));
902 return;
903 }
904 if (GNUNET_OK !=
906 &issuer_pkey))
907 {
908 fprintf (stderr,
909 _ ("Issuer public key `%s' is not well-formed\n"),
910 issuer_key);
912 return;
913 }
915
916 if (NULL == abd)
917 {
918 fprintf (stderr, _ ("Failed to connect to ABD\n"));
920 return;
921 }
922 if ((NULL == issuer_attr) || (NULL == subject_delegate))
923 {
924 fprintf (stderr, _ ("You must provide issuer and subject attributes\n"));
926 return;
927 }
928
929 // Subject credentials are comma separated
930 char *tmp = GNUNET_strdup (subject_delegate);
931 char *tok = strtok (tmp, ",");
932 if (NULL == tok)
933 {
934 fprintf (stderr, "Invalid subject credentials\n");
935 GNUNET_free (tmp);
937 return;
938 }
939 int count = 1;
940 int i;
941 while (NULL != (tok = strtok (NULL, ",")))
942 count++;
943 struct GNUNET_ABD_Delegate*delegates =
944 GNUNET_malloc (sizeof(*delegates) * count);
945 struct GNUNET_ABD_Delegate *dele;
946 GNUNET_free (tmp);
948 tok = strtok (tmp, ",");
949 for (i = 0; i < count; i++)
950 {
952 GNUNET_memcpy (&delegates[i],
953 dele,
954 sizeof (struct GNUNET_ABD_Delegate));
955 delegates[i].issuer_attribute = GNUNET_strdup (dele->issuer_attribute);
956 tok = strtok (NULL, ",");
957 GNUNET_free (dele);
958 }
959
964 count,
965 delegates,
966 direction,
968 NULL,
970 NULL);
971 for (i = 0; i < count; i++)
972 {
973 GNUNET_free_nz ((char *) delegates[i].issuer_attribute);
974 delegates[i].issuer_attribute = NULL;
975 }
976 GNUNET_free (tmp);
977 GNUNET_free (delegates);
978 }
979 else
980 {
981 fprintf (stderr,
982 _ (
983 "Please specify name to lookup, subject key and issuer key!\n"));
985 }
986 return;
987}
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)
Definition: gnunet-abd.c:317
static int create_ss
Create mode.
Definition: gnunet-abd.c:142
static int create_is
Create mode.
Definition: gnunet-abd.c:137
static void identity_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego)
Callback invoked from identity service with ego information.
Definition: gnunet-abd.c:382
static char * subject_delegate
Subject delegate string.
Definition: gnunet-abd.c:91
static void do_timeout(void *cls)
Task run on timeout.
Definition: gnunet-abd.c:260
static void sign_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego)
Definition: gnunet-abd.c:669
static int sign_ss
Create mode.
Definition: gnunet-abd.c:147
static void store_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego)
Definition: gnunet-abd.c:544
static void do_shutdown(void *cls)
Task run on shutdown.
Definition: gnunet-abd.c:219
static int backward
Search direction: backward.
Definition: gnunet-abd.c:167
static int verify
Verify mode.
Definition: gnunet-abd.c:127
static int forward
Search direction: forward.
Definition: gnunet-abd.c:162
static struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).
Definition: gnunet-abd.c:61
struct GNUNET_ABD_Handle * GNUNET_ABD_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize the connection with the ABD service.
Definition: abd_api.c:354
struct GNUNET_ABD_Request * GNUNET_ABD_verify(struct GNUNET_ABD_Handle *handle, const struct GNUNET_CRYPTO_PublicKey *issuer_key, const char *issuer_attribute, const struct GNUNET_CRYPTO_PublicKey *subject_key, uint32_t delegate_count, const struct GNUNET_ABD_Delegate *delegates, enum GNUNET_ABD_AlgoDirectionFlags direction, GNUNET_ABD_CredentialResultProcessor proc, void *proc_cls, GNUNET_ABD_IntermediateResultProcessor proc2, void *proc2_cls)
Performs attribute verification.
Definition: abd_api.c:497
@ GNUNET_ABD_FLAG_BACKWARD
@ GNUNET_ABD_FLAG_FORWARD
#define GNUNET_GNS_EMPTY_LABEL_AT
String we use to indicate an empty label (top-level entry in the zone).
struct GNUNET_IDENTITY_EgoLookup * GNUNET_IDENTITY_ego_lookup(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, GNUNET_IDENTITY_EgoCallback cb, void *cb_cls)
Lookup an ego by name.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_free_nz(ptr)
Wrapper around free.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received,...
Definition: scheduler.c:1334
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1272
#define GNUNET_GNSRECORD_TYPE_ATTRIBUTE
For ABD reverse lookups.
const char * issuer_attribute
The issuer attribute.

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().

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

◆ main()

int main ( int  argc,
char *const *  argv 
)

The main function for gnunet-gns.

Parameters
argcnumber of arguments from the command line
argvcommand line arguments
Returns
0 ok, 1 on error

Definition at line 998 of file gnunet-abd.c.

999{
1002 "verify",
1003 gettext_noop (
1004 "verify credential against attribute"),
1005 &verify),
1007 's',
1008 "subject",
1009 "PKEY",
1010 gettext_noop (
1011 "The public key of the subject to lookup the"
1012 "credential for, or for issuer side storage: subject and its attributes"),
1013 &subject),
1015 'd',
1016 "delegate",
1017 "DELE",
1018 gettext_noop ("The private, signed delegate presented by the subject"),
1021 'i',
1022 "issuer",
1023 "PKEY",
1024 gettext_noop (
1025 "The public key of the authority to verify the credential against"),
1026 &issuer_key),
1028 "ego",
1029 "EGO",
1030 gettext_noop ("The ego/zone name to use"),
1031 &ego_name),
1033 'a',
1034 "attribute",
1035 "ATTR",
1036 gettext_noop ("The issuer attribute to verify against or to issue"),
1037 &issuer_attr),
1039 "ttl",
1040 "EXP",
1041 gettext_noop (
1042 "The time to live for the credential."
1043 "e.g. 5m, 6h, \"1990-12-30 12:00:00\""),
1044 &expiration),
1046 "collect",
1047 gettext_noop ("collect credentials"),
1048 &collect),
1050 "createIssuerSide",
1051 gettext_noop (
1052 "Create and issue a credential issuer side."),
1053 &create_is),
1055 "createSubjectSide",
1056 gettext_noop (
1057 "Issue a credential subject side."),
1058 &create_ss),
1060 'S',
1061 "signSubjectSide",
1062 gettext_noop ("Create, sign and return a credential subject side."),
1063 &sign_ss),
1065 'x',
1066 "import",
1067 "IMP",
1068 gettext_noop (
1069 "Import signed credentials that should be issued to a zone/ego"),
1070 &import),
1072 "private",
1073 gettext_noop ("Create private record entry."),
1074 &is_private),
1076 'F',
1077 "forward",
1078 gettext_noop (
1079 "Indicates that the collect/verify process is done via forward search."),
1080 &forward),
1082 'B',
1083 "backward",
1084 gettext_noop (
1085 "Indicates that the collect/verify process is done via forward search."),
1086 &backward),
1088
1089
1091 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
1092 return 2;
1093
1094 GNUNET_log_setup ("gnunet-abd", "WARNING", NULL);
1095 if (GNUNET_OK != GNUNET_PROGRAM_run (argc,
1096 argv,
1097 "gnunet-abd",
1098 _ ("GNUnet abd resolver tool"),
1099 options,
1100 &run,
1101 NULL))
1102 ret = 1;
1103 GNUNET_free_nz ((void *) argv);
1104 return ret;
1105}
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
Definition: 002.c:13
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
#define gettext_noop(String)
Definition: gettext.h:70
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
Main function that will be run.
Definition: gnunet-abd.c:757
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_flag(char shortName, const char *name, const char *description, int *val)
Allow user to specify a flag (which internally means setting an integer to 1/GNUNET_YES/GNUNET_OK.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_string(char shortName, const char *name, const char *argumentHelp, const char *description, char **str)
Allow user to specify a string.
enum GNUNET_GenericReturnValue GNUNET_log_setup(const char *comp, const char *loglevel, const char *logfile)
Setup logging.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration,...
Definition: program.c:400
enum GNUNET_GenericReturnValue GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
Definition: strings.c:1230
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
Definition of a command line option.

References _, backward, collect, create_is, create_ss, ego_name, expiration, forward, gettext_noop, GNUNET_free_nz, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_string(), GNUNET_log_setup(), GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_STRINGS_get_utf8_args(), GNUNET_TIME_UNIT_FOREVER_REL, is_private, issuer_attr, issuer_key, options, ret, run(), sign_ss, subject, subject_delegate, timeout, and verify.

Here is the call graph for this function:

Variable Documentation

◆ cfg

const struct GNUNET_CONFIGURATION_Handle* cfg
static

Configuration we are using.

Definition at line 36 of file gnunet-abd.c.

Referenced by run(), and store_cb().

◆ ns

struct GNUNET_NAMESTORE_Handle* ns
static

Handle to the namestore.

Definition at line 41 of file gnunet-abd.c.

Referenced by do_shutdown(), get_existing_record(), and store_cb().

◆ zone_pkey

struct GNUNET_CRYPTO_PrivateKey zone_pkey
static

Private key for the our zone.

Definition at line 46 of file gnunet-abd.c.

Referenced by get_existing_record(), and store_cb().

◆ el

struct GNUNET_IDENTITY_EgoLookup* el
static

EgoLookup.

Definition at line 51 of file gnunet-abd.c.

Referenced by do_shutdown(), identity_cb(), run(), sign_cb(), and store_cb().

◆ abd

struct GNUNET_ABD_Handle* abd
static

Handle to Credential service.

Definition at line 56 of file gnunet-abd.c.

Referenced by do_shutdown(), identity_cb(), and run().

◆ timeout

struct GNUNET_TIME_Relative timeout
static

Desired timeout for the lookup (default is no timeout).

Definition at line 61 of file gnunet-abd.c.

Referenced by main(), and run().

◆ verify_request

struct GNUNET_ABD_Request* verify_request
static

Handle to verify request.

Definition at line 66 of file gnunet-abd.c.

Referenced by do_shutdown(), handle_collect_result(), handle_verify_result(), and run().

◆ collect_request

struct GNUNET_ABD_Request* collect_request
static

Handle to collect request.

Definition at line 71 of file gnunet-abd.c.

Referenced by identity_cb().

◆ tt

struct GNUNET_SCHEDULER_Task* tt
static

Task scheduled to handle timeout.

Definition at line 76 of file gnunet-abd.c.

Referenced by do_shutdown(), do_timeout(), and run().

◆ ret

int ret = 0
static

Return value of the commandline.

Definition at line 81 of file gnunet-abd.c.

Referenced by handle_verify_result(), and main().

◆ subject

char* subject
static

◆ subject_delegate

char* subject_delegate
static

Subject delegate string.

Definition at line 91 of file gnunet-abd.c.

Referenced by main(), and run().

◆ expiration

char* expiration
static

Credential TTL.

Definition at line 96 of file gnunet-abd.c.

Referenced by main(), sign_cb(), and store_cb().

◆ subject_pkey

◆ issuer_pkey

struct GNUNET_CRYPTO_PublicKey issuer_pkey

Issuer key.

Definition at line 106 of file gnunet-abd.c.

Referenced by GNUNET_ABD_delegate_from_string(), GNUNET_ABD_delegate_to_string(), identity_cb(), and run().

◆ issuer_key

char* issuer_key
static

Issuer pubkey string.

Definition at line 112 of file gnunet-abd.c.

Referenced by GNUNET_ABD_collect(), GNUNET_ABD_verify(), handle_verify_result(), identity_cb(), main(), and run().

◆ ego_name

char* ego_name
static

ego

Definition at line 117 of file gnunet-abd.c.

Referenced by identity_cb(), main(), run(), and sign_cb().

◆ issuer_attr

char* issuer_attr
static

Issuer attribute.

Definition at line 122 of file gnunet-abd.c.

Referenced by identity_cb(), main(), run(), and sign_cb().

◆ verify

int verify
static

Verify mode.

Definition at line 127 of file gnunet-abd.c.

Referenced by check_ssl_certificate(), get_store_peer_of(), main(), run(), and verify_store_peer().

◆ collect

int collect
static

Collect mode.

Definition at line 132 of file gnunet-abd.c.

Referenced by identity_cb(), main(), and run().

◆ create_is

int create_is
static

Create mode.

Definition at line 137 of file gnunet-abd.c.

Referenced by main(), and run().

◆ create_ss

int create_ss
static

Create mode.

Definition at line 142 of file gnunet-abd.c.

Referenced by main(), and run().

◆ sign_ss

int sign_ss
static

Create mode.

Definition at line 147 of file gnunet-abd.c.

Referenced by main(), and run().

◆ import

char* import
static

Signed issue credentials.

Definition at line 152 of file gnunet-abd.c.

◆ is_private

int is_private
static

Is record private.

Definition at line 157 of file gnunet-abd.c.

Referenced by get_existing_record(), and main().

◆ forward

int forward
static

Search direction: forward.

Definition at line 162 of file gnunet-abd.c.

Referenced by main(), request_room_message_step(), and run().

◆ backward

int backward
static

Search direction: backward.

Definition at line 167 of file gnunet-abd.c.

Referenced by main(), and run().

◆ direction

enum GNUNET_ABD_AlgoDirectionFlags direction = 0

API enum, filled and passed for collect/verify.

Definition at line 172 of file gnunet-abd.c.

Referenced by check_get(), GNUNET_ABD_collect(), GNUNET_ABD_verify(), handle_get(), identity_cb(), and run().

◆ add_qe

struct GNUNET_NAMESTORE_QueueEntry* add_qe
static

Queue entry for the 'add' operation.

Definition at line 177 of file gnunet-abd.c.

Referenced by do_shutdown(), get_existing_record(), and store_cb().

◆ data

void* data
static

Value in binary format.

Definition at line 182 of file gnunet-abd.c.

Referenced by get_existing_record(), and store_cb().

◆ data_size

size_t data_size
static

Number of bytes in data.

Definition at line 187 of file gnunet-abd.c.

Referenced by get_existing_record(), and store_cb().

◆ type

uint32_t type
static

Type string converted to DNS type value.

Definition at line 192 of file gnunet-abd.c.

Referenced by get_existing_record(), run(), and store_cb().

◆ typestring

char* typestring
static

Type of the record to add/remove, NULL to remove all.

Definition at line 197 of file gnunet-abd.c.

Referenced by store_cb().

◆ etime

uint64_t etime
static

Expiration string converted to numeric value.

Definition at line 201 of file gnunet-abd.c.

Referenced by get_existing_record(), parse_expiration(), and store_cb().

◆ etime_is_rel

int etime_is_rel = GNUNET_SYSERR
static

Is expiration time relative or absolute time?

Definition at line 206 of file gnunet-abd.c.

Referenced by get_existing_record(), parse_expiration(), and store_cb().

◆ record_label

char* record_label
static

Record label for storing delegations.

Definition at line 211 of file gnunet-abd.c.

Referenced by run(), and store_cb().