Identity management. More...
Macros | |
#define | GNUNET_IDENTITY_VERSION 0x00000100 |
Version number of GNUnet Identity API. More... | |
Typedefs | |
typedef void(* | GNUNET_IDENTITY_Callback) (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name) |
Method called to inform about the egos of this peer. More... | |
typedef void(* | GNUNET_IDENTITY_Continuation) (void *cls, enum GNUNET_ErrorCode ec) |
Function called once the requested operation has been completed. More... | |
typedef void(* | GNUNET_IDENTITY_CreateContinuation) (void *cls, const struct GNUNET_CRYPTO_PrivateKey *pk, enum GNUNET_ErrorCode ec) |
Function called once the requested operation has been completed. More... | |
typedef void(* | GNUNET_IDENTITY_EgoCallback) (void *cls, struct GNUNET_IDENTITY_Ego *ego) |
Function called with the result. More... | |
typedef void(* | GNUNET_IDENTITY_EgoSuffixCallback) (void *cls, const struct GNUNET_CRYPTO_PrivateKey *priv, const char *ego_name) |
Function called with the result. More... | |
Identity management.
Egos in GNUnet are ECDSA keys. You assume an ego by using (signing with) a particular private key. As GNUnet users are expected to have many egos, we need an identity service to allow users to manage their egos. The identity service manages the egos (private keys) of the local user; it does NOT manage egos of other users (public keys). For giving names to other users and manage their public keys securely, we use GNS.
#define GNUNET_IDENTITY_VERSION 0x00000100 |
Version number of GNUnet Identity API.
Definition at line 63 of file gnunet_identity_service.h.
typedef void(* GNUNET_IDENTITY_Callback) (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name) |
Method called to inform about the egos of this peer.
When used with GNUNET_IDENTITY_connect, this function is initially called for all egos and then again whenever a ego's name changes or if it is deleted. At the end of the initial pass over all egos, the function is once called with 'NULL' for ego. That does NOT mean that the callback won't be invoked in the future or that there was an error.
When used with GNUNET_IDENTITY_create or GNUNET_IDENTITY_get, this function is only called ONCE, and 'NULL' being passed in ego does indicate an error (for example because name is taken or no default value is known). If ego is non-NULL and if '*ctx' is set in those callbacks, the value WILL be passed to a subsequent call to the identity callback of GNUNET_IDENTITY_connect (if that one was not NULL).
When an identity is renamed, this function is called with the (known) ego but the NEW name.
When an identity is deleted, this function is called with the (known) ego and "NULL" for the name. In this case, the ego is henceforth invalid (and the ctx should also be cleaned up).
cls | closure |
ego | ego handle |
ctx | context for application to store data for this ego (during the lifetime of this process, initially NULL) |
name | name assigned by the user for this ego, NULL if the user just deleted the ego and it must thus no longer be used |
Definition at line 155 of file gnunet_identity_service.h.
typedef void(* GNUNET_IDENTITY_Continuation) (void *cls, enum GNUNET_ErrorCode ec) |
Function called once the requested operation has been completed.
cls | closure |
ec | the GNUNET_ErrorCode |
Definition at line 199 of file gnunet_identity_service.h.
typedef void(* GNUNET_IDENTITY_CreateContinuation) (void *cls, const struct GNUNET_CRYPTO_PrivateKey *pk, enum GNUNET_ErrorCode ec) |
Function called once the requested operation has been completed.
cls | closure |
pk | private key, NULL on error |
ec | the GNUNET_ErrorCode |
Definition at line 239 of file gnunet_identity_service.h.
typedef void(* GNUNET_IDENTITY_EgoCallback) (void *cls, struct GNUNET_IDENTITY_Ego *ego) |
Function called with the result.
cls | closure |
ego | NULL on error / ego not found |
Definition at line 320 of file gnunet_identity_service.h.
typedef void(* GNUNET_IDENTITY_EgoSuffixCallback) (void *cls, const struct GNUNET_CRYPTO_PrivateKey *priv, const char *ego_name) |
Function called with the result.
cls | closure |
ego | NULL on error / ego not found |
ego_name | NULL on error, name of the ego otherwise |
Definition at line 361 of file gnunet_identity_service.h.
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.
ego | the ego |
Definition at line 517 of file identity_api.c.
References GNUNET_IDENTITY_Ego::pk.
Referenced by add_attribute_cont(), add_credential_cont(), authorize_endpoint(), code_redirect(), collect_orphans(), delete_attribute_cont(), delete_credential_cont(), DID_create(), directory_trim_complete(), display_record(), ego_callback(), ego_cb(), ego_get_all(), ego_get_response(), get_anonymous_private_key(), get_ego(), get_identity_for_string(), GNUNET_CONVERSATION_phone_create(), handle_gns_response(), id_connect_cb(), identity_cb(), list_attribute_cont(), list_credential_cont(), list_tickets_cont(), namestore_add_or_update(), namestore_delete(), namestore_get(), namestore_import(), on_ego_lookup(), origin_lookup_cb(), print_ego(), read_encrypted_message(), remove_did_document_ego_lookup_cb(), revoke_ticket_cont(), sign_cb(), store_cb(), and uri_ksk_continuation().
struct GNUNET_IDENTITY_Ego * GNUNET_IDENTITY_ego_get_anonymous | ( | void | ) |
Obtain the ego representing 'anonymous' users.
Definition at line 157 of file identity_api.c.
References GNUNET_CRYPTO_PrivateKey::ecdsa_key, GNUNET_assert, GNUNET_CRYPTO_ecdsa_key_get_anonymous(), GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_private_key_get_length(), GNUNET_PUBLIC_KEY_TYPE_ECDSA, GNUNET_IDENTITY_Ego::id, GNUNET_IDENTITY_Ego::pk, GNUNET_IDENTITY_Ego::pub, GNUNET_CRYPTO_PrivateKey::type, and GNUNET_CRYPTO_PublicKey::type.
Referenced by get_anonymous_private_key(), and get_anonymous_public_key().
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.
ego | identity handle with the private key |
pk | set to ego's public key |
Definition at line 529 of file identity_api.c.
References GNUNET_CRYPTO_key_get_public(), GNUNET_NO, GNUNET_YES, pk, GNUNET_IDENTITY_Ego::pk, GNUNET_IDENTITY_Ego::pub, and GNUNET_IDENTITY_Ego::pub_initialized.
Referenced by code_redirect(), DID_create(), DID_ego_to_did(), DID_identity_to_did(), DID_identity_to_did_document(), ego_callback(), find_ego(), get_anonymous_public_key(), get_ego(), get_identity_for_string(), id_connect_cb(), list_ego(), print_ego(), revoke_ticket_cont(), and store_cb().
const char * GNUNET_IDENTITY_ego_get_name | ( | const struct GNUNET_IDENTITY_Ego * | ego | ) |
Obtain the name associated with an ego.
ego | the ego |
struct GNUNET_IDENTITY_Handle * GNUNET_IDENTITY_connect | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
GNUNET_IDENTITY_Callback | cb, | ||
void * | cb_cls | ||
) |
Connect to the identity service.
cfg | Configuration to contact the identity service. |
cb | function to call on all identity events, can be NULL |
cb_cls | closure for cb |
cfg | the configuration to use |
cb | function to call on all identity events, can be NULL |
cb_cls | closure for cb |
Definition at line 487 of file identity_api.c.
References GNUNET_IDENTITY_Handle::cb, GNUNET_IDENTITY_Handle::cb_cls, cfg, GNUNET_ARM_Handle::cfg, GNUNET_CONTAINER_multihashmap_create(), GNUNET_free, GNUNET_new, GNUNET_YES, h, GNUNET_ARM_Handle::mq, and reconnect().
Referenced by REST_identity_init(), REST_namestore_init(), REST_openid_init(), REST_reclaim_init(), and run().
struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_get | ( | struct GNUNET_IDENTITY_Handle * | id, |
const char * | service_name, | ||
GNUNET_IDENTITY_Callback | cb, | ||
void * | cb_cls | ||
) |
Obtain the ego that is currently preferred/default for a service.
id | identity service to query |
service_name | for which service is an identity wanted |
cb | function to call with the result (will only be called once) |
cb_cls | closure for cb |
struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_set | ( | struct GNUNET_IDENTITY_Handle * | id, |
const char * | service_name, | ||
struct GNUNET_IDENTITY_Ego * | ego, | ||
GNUNET_IDENTITY_Continuation | cont, | ||
void * | cont_cls | ||
) |
Set the preferred/default ego for a service.
id | identity service to inform |
service_name | for which service is an identity set |
ego | new default identity to be set for this service |
cont | function to call once the operation finished |
cont_cls | closure for cont |
void GNUNET_IDENTITY_disconnect | ( | struct GNUNET_IDENTITY_Handle * | h | ) |
Disconnect from identity service.
h | identity service to disconnect |
h | handle to destroy |
Definition at line 732 of file identity_api.c.
References free_ego(), GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), h, GNUNET_ARM_Handle::mq, op, and GNUNET_ARM_Handle::reconnect_task.
Referenced by cleanup(), do_cleanup(), do_shutdown(), do_stop_task(), process_stdin(), REST_identity_done(), REST_namestore_done(), REST_openid_done(), REST_reclaim_done(), and shutdown_task().
struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_create | ( | struct GNUNET_IDENTITY_Handle * | id, |
const char * | name, | ||
const struct GNUNET_CRYPTO_PrivateKey * | privkey, | ||
enum GNUNET_CRYPTO_KeyType | ktype, | ||
GNUNET_IDENTITY_CreateContinuation | cont, | ||
void * | cont_cls | ||
) |
Create a new ego with the given name.
id | identity service to use |
name | desired name |
privkey | desired private key or NULL to create one |
ktype | the type of key to create. Ignored if privkey != NULL. |
cont | function to call with the result (will only be called once) |
cont_cls | closure for cont |
Definition at line 561 of file identity_api.c.
References env, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_IDENTITY_CREATE, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, GNUNET_OK, h, GNUNET_ARM_Operation::h, CreateRequestMessage::key_len, GNUNET_ARM_Handle::mq, name, CreateRequestMessage::name_len, op, and private_key_create().
Referenced by create_did_ego_lockup_cb(), ego_create(), origin_lookup_cb(), and run().
struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_rename | ( | struct GNUNET_IDENTITY_Handle * | h, |
const char * | old_name, | ||
const char * | new_name, | ||
GNUNET_IDENTITY_Continuation | cb, | ||
void * | cb_cls | ||
) |
Renames an existing ego.
id | identity service to use |
old_name | old name |
new_name | desired new name |
cb | function to call with the result (will only be called once) |
cb_cls | closure for cb |
Renames an existing ego.
h | identity service to use |
old_name | old name |
new_name | desired new name |
cb | function to call with the result (will only be called once) |
cb_cls | closure for cb |
Definition at line 621 of file identity_api.c.
References env, GNUNET_break, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_IDENTITY_RENAME, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, h, GNUNET_ARM_Operation::h, GNUNET_ARM_Handle::mq, RenameMessage::new_name_len, RenameMessage::old_name_len, and op.
Referenced by ego_edit().
struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_delete | ( | struct GNUNET_IDENTITY_Handle * | h, |
const char * | name, | ||
GNUNET_IDENTITY_Continuation | cb, | ||
void * | cb_cls | ||
) |
Delete an existing ego.
id | identity service to use |
name | name of the identity to delete |
cb | function to call with the result (will only be called once) |
cb_cls | closure for cb |
Delete an existing ego.
h | identity service to use |
name | name of the identity to delete |
cb | function to call with the result (will only be called once) |
cb_cls | closure for cb |
Definition at line 674 of file identity_api.c.
References env, GNUNET_break, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_IDENTITY_DELETE, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, h, GNUNET_ARM_Operation::h, GNUNET_ARM_Handle::mq, name, DeleteMessage::name_len, op, and DeleteMessage::reserved.
Referenced by ego_delete_name(), ego_delete_pubkey(), and run().
void GNUNET_IDENTITY_cancel | ( | struct GNUNET_IDENTITY_Operation * | op | ) |
Cancel an identity operation.
Note that the operation MAY still be executed; this merely cancels the continuation; if the request was already transmitted, the service may still choose to complete the operation.
op | operation to cancel |
Definition at line 715 of file identity_api.c.
References op.
Referenced by do_shutdown(), and shutdown_task().
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.
cfg | configuration to use |
name | name to look up |
cb | callback to invoke with the result |
cb_cls | closure for cb |
Definition at line 186 of file identity_api_lookup.c.
References GNUNET_IDENTITY_EgoLookup::cb, GNUNET_IDENTITY_EgoLookup::cb_cls, cfg, el, env, GNUNET_assert, GNUNET_break, GNUNET_CLIENT_connect(), GNUNET_free, GNUNET_MESSAGE_TYPE_IDENTITY_LOOKUP, GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE, GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, GNUNET_strdup, handlers, GNUNET_IDENTITY_EgoLookup::mq, mq_error_handler(), name, and GNUNET_IDENTITY_EgoLookup::name.
Referenced by add_continuation(), create_did(), create_did_ego_create_cb(), ego_sign_data(), parse(), remove_did_document(), replace_did_document_remove_cb(), and run().
void GNUNET_IDENTITY_ego_lookup_cancel | ( | struct GNUNET_IDENTITY_EgoLookup * | el | ) |
Abort ego lookup attempt.
el | handle for lookup to abort |
Definition at line 236 of file identity_api_lookup.c.
References el, GNUNET_free, GNUNET_MQ_destroy(), GNUNET_IDENTITY_EgoLookup::mq, and GNUNET_IDENTITY_EgoLookup::name.
Referenced by do_shutdown(), handle_identity_result_code(), handle_identity_update(), and shutdown_hook().
struct GNUNET_IDENTITY_EgoSuffixLookup * GNUNET_IDENTITY_ego_lookup_by_suffix | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | suffix, | ||
GNUNET_IDENTITY_EgoSuffixCallback | cb, | ||
void * | cb_cls | ||
) |
Obtain the ego with the maximum suffix match between the ego's name and the given domain name suffix.
For example, given a suffix "a.b.c" and egos with names "d.a.b.c", "b.c" and "c", we return the ego for "b.c".
cfg | configuration to use |
suffix | for which domain name suffix is an identity wanted |
cb | function to call with the result (will only be called once) |
cb_cls | closure for cb |
Obtain the ego with the maximum suffix match between the ego's name and the given domain name suffix.
cfg | configuration to use |
name | name to look up |
cb | callback to invoke with the result |
cb_cls | closure for cb |
Definition at line 185 of file identity_api_suffix_lookup.c.
References GNUNET_IDENTITY_EgoLookup::cb, GNUNET_IDENTITY_EgoLookup::cb_cls, cfg, el, env, GNUNET_assert, GNUNET_break, GNUNET_CLIENT_connect(), GNUNET_free, GNUNET_MESSAGE_TYPE_IDENTITY_LOOKUP_BY_SUFFIX, GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE, GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, GNUNET_strdup, handlers, GNUNET_IDENTITY_EgoLookup::mq, and mq_error_handler().
Referenced by GNUNET_GNS_lookup_with_tld().
void GNUNET_IDENTITY_ego_lookup_by_suffix_cancel | ( | struct GNUNET_IDENTITY_EgoSuffixLookup * | el | ) |
Abort ego suffix lookup attempt.
el | handle for lookup to abort |
Abort ego suffix lookup attempt.
el | handle for lookup to abort |
Definition at line 237 of file identity_api_suffix_lookup.c.
References el, GNUNET_free, GNUNET_MQ_destroy(), and GNUNET_IDENTITY_EgoLookup::mq.
Referenced by GNUNET_GNS_lookup_with_tld_cancel(), handle_identity_result_code(), handle_identity_update(), and mq_error_handler().