X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Finclude%2Fgnunet_credential_service.h;h=bac9f408aaae1946b48072b0ac6cbc2ff5863bf4;hb=ec50a665dc884f7997419d0351ae8ade9c1aeabe;hp=7419407d33ec0a5dd337bb006c1737ed7e550194;hpb=73a127e962c5ecbfc002b1b0c9ea9cf441591c6d;p=oweals%2Fgnunet.git diff --git a/src/include/gnunet_credential_service.h b/src/include/gnunet_credential_service.h index 7419407d3..bac9f408a 100644 --- a/src/include/gnunet_credential_service.h +++ b/src/include/gnunet_credential_service.h @@ -2,25 +2,22 @@ This file is part of GNUnet Copyright (C) 2012-2014 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . */ /** * @author Martin Schanzenbach - * @author Adnan Husain * * @file * API to the Credential service @@ -74,65 +71,49 @@ enum GNUNET_CREDENTIAL_CredentialFlags { GNUNET_NETWORK_STRUCT_BEGIN /** - * The credential record + * The attribute delegation record */ -struct GNUNET_CREDENTIAL_CredentialRecordData { - - /** - * The signature for this credential by the issuer - */ - struct GNUNET_CRYPTO_EcdsaSignature signature; - - /** - * Signature meta - */ - struct GNUNET_CRYPTO_EccSignaturePurpose purpose; +struct GNUNET_CREDENTIAL_DelegationRecord { /** - * Public key of the issuer + * Number of delegation sets in this record */ - struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key; - + uint32_t set_count; + /** - * Public key of the subject this credential was issued to + * Length of delegation sets */ - struct GNUNET_CRYPTO_EcdsaPublicKey subject_key; - + uint64_t data_size; /** - * Expiration time of this credential - */ - uint64_t expiration GNUNET_PACKED; - - /** - * Followed by the attribute string + * Followed by set_count DelegationSetRecords + * */ }; - /** * The attribute delegation record -*/ -struct GNUNET_CREDENTIAL_DelegationRecordData { - - uint32_t set_count; + */ +struct GNUNET_CREDENTIAL_DelegationRecordSet { - uint64_t data_size; + /** + * Public key of the subject this attribute was delegated to + */ + struct GNUNET_CRYPTO_EcdsaPublicKey subject_key; - char *data; - /** - * Followed by the attribute that was delegated to as string - * May be empty + * Length of attribute, may be 0 */ + uint32_t subject_attribute_len; }; +GNUNET_NETWORK_STRUCT_END /** * The attribute delegation record -*/ -struct GNUNET_CREDENTIAL_DelegationSetRecord { - + */ +struct GNUNET_CREDENTIAL_DelegationSet { + /** * Public key of the subject this attribute was delegated to */ @@ -140,20 +121,18 @@ struct GNUNET_CREDENTIAL_DelegationSetRecord { uint32_t subject_attribute_len; - const char *subject_attribute; - /** - * Followed by the attribute that was delegated to as string - * May be empty + * The subject attribute */ + const char *subject_attribute; }; /** * A delegation -*/ + */ struct GNUNET_CREDENTIAL_Delegation { - + /** * The issuer of the delegation */ @@ -188,9 +167,9 @@ struct GNUNET_CREDENTIAL_Delegation { /** * A credential -*/ + */ struct GNUNET_CREDENTIAL_Credential { - + /** * The issuer of the credential */ @@ -201,6 +180,16 @@ struct GNUNET_CREDENTIAL_Credential { */ struct GNUNET_CRYPTO_EcdsaPublicKey subject_key; + /** + * Signature of this credential + */ + struct GNUNET_CRYPTO_EcdsaSignature signature; + + /** + * Expiration of this credential + */ + struct GNUNET_TIME_Absolute expiration; + /** * Length of the attribute */ @@ -210,11 +199,8 @@ struct GNUNET_CREDENTIAL_Credential { * The attribute */ const char *issuer_attribute; - -}; - -GNUNET_NETWORK_STRUCT_END +}; @@ -246,7 +232,7 @@ GNUNET_CREDENTIAL_disconnect (struct GNUNET_CREDENTIAL_Handle *handle); * @param c_count the number of credentials found * @param credential the credentials */ -typedef void (*GNUNET_CREDENTIAL_VerifyResultProcessor) (void *cls, +typedef void (*GNUNET_CREDENTIAL_CredentialResultProcessor) (void *cls, unsigned int d_count, struct GNUNET_CREDENTIAL_Delegation *delegation_chain, unsigned int c_count, @@ -260,7 +246,7 @@ typedef void (*GNUNET_CREDENTIAL_VerifyResultProcessor) (void *cls, * @param result the record data that can be handed to the subject */ typedef void (*GNUNET_CREDENTIAL_DelegateResultProcessor) (void *cls, - uint32_t success); + uint32_t success); /** * Iterator called on obtained result for an attribute delegation removal. @@ -270,9 +256,7 @@ typedef void (*GNUNET_CREDENTIAL_DelegateResultProcessor) (void *cls, * @param result the record data that can be handed to the subject */ typedef void (*GNUNET_CREDENTIAL_RemoveDelegateResultProcessor) (void *cls, - uint32_t success); - - + uint32_t success); /** @@ -287,7 +271,8 @@ typedef void (*GNUNET_CREDENTIAL_RemoveDelegateResultProcessor) (void *cls, * @param issuer_key the issuer public key * @param issuer_attribute the issuer attribute * @param subject_key the subject public key - * @param subject_attribute the attribute claimed by the subject + * @param credential_count number of credentials + * @param credentials the subject credentials * @param proc function to call on result * @param proc_cls closure for processor * @return handle to the queued request @@ -297,10 +282,19 @@ GNUNET_CREDENTIAL_verify (struct GNUNET_CREDENTIAL_Handle *handle, const struct GNUNET_CRYPTO_EcdsaPublicKey *issuer_key, const char *issuer_attribute, const struct GNUNET_CRYPTO_EcdsaPublicKey *subject_key, - const char *subject_attribute, - GNUNET_CREDENTIAL_VerifyResultProcessor proc, + uint32_t credential_count, + const struct GNUNET_CREDENTIAL_Credential *credentials, + GNUNET_CREDENTIAL_CredentialResultProcessor proc, void *proc_cls); +struct GNUNET_CREDENTIAL_Request* +GNUNET_CREDENTIAL_collect (struct GNUNET_CREDENTIAL_Handle *handle, + const struct GNUNET_CRYPTO_EcdsaPublicKey *issuer_key, + const char *issuer_attribute, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *subject_key, + GNUNET_CREDENTIAL_CredentialResultProcessor proc, + void *proc_cls); + /** * Delegate an attribute * @@ -309,6 +303,8 @@ GNUNET_CREDENTIAL_verify (struct GNUNET_CREDENTIAL_Handle *handle, * @param attribute the name of the attribute to delegate * @param subject the subject of the delegation * @param delegated_attribute the name of the attribute that is delegated to + * @param proc the result callback + * @param proc_cls the result closure context * @return handle to the queued request */ struct GNUNET_CREDENTIAL_Request * @@ -326,54 +322,35 @@ GNUNET_CREDENTIAL_add_delegation (struct GNUNET_CREDENTIAL_Handle *handle, * @param handle handle to the Credential service * @param issuer the ego that was used to delegate the attribute * @param attribute the name of the attribute that is delegated + * @param proc the callback + * @param proc_cls callback closure * @return handle to the queued request */ struct GNUNET_CREDENTIAL_Request * GNUNET_CREDENTIAL_remove_delegation (struct GNUNET_CREDENTIAL_Handle *handle, - struct GNUNET_IDENTITY_Ego *issuer, - const char *attribute, - GNUNET_CREDENTIAL_RemoveDelegateResultProcessor proc, - void *proc_cls); + struct GNUNET_IDENTITY_Ego *issuer, + const char *attribute, + GNUNET_CREDENTIAL_RemoveDelegateResultProcessor proc, + void *proc_cls); /** * Issue an attribute to a subject * - * @param handle handle to the Credential service * @param issuer the ego that should be used to issue the attribute * @param subject the subject of the attribute * @param attribute the name of the attribute * @param expiration the TTL of the credential * @return handle to the queued request */ -struct GNUNET_CREDENTIAL_CredentialRecordData * -GNUNET_CREDENTIAL_issue (struct GNUNET_CREDENTIAL_Handle *handle, - const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, - struct GNUNET_CRYPTO_EcdsaPublicKey *subject, - const char *attribute, - struct GNUNET_TIME_Absolute *expiration); +struct GNUNET_CREDENTIAL_Credential* +GNUNET_CREDENTIAL_credential_issue (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, + struct GNUNET_CRYPTO_EcdsaPublicKey *subject, + const char *attribute, + struct GNUNET_TIME_Absolute *expiration); -/** - * Remove a credential - * - * @param handle handle to the Credential service - * @param issuer the identity that issued the credential - * @param subject the subject of the credential - * @param credential the name of the credential - * @return handle to the queued request - */ -/** - struct GNUNET_CREDENTIAL_IssueRequest * - GNUNET_CREDENTIAL_remove (struct GNUNET_CREDENTIAL_Handle *handle, - struct GNUNET_IDENTITY_Ego *issuer, - struct GNUNET_IDENTITY_Ego *subject, - const char *credential, - GNUNET_CREDENTIAL_IssueResultProcessor proc, - void *proc_cls); - */ - /** * Cancel pending lookup request @@ -381,7 +358,7 @@ GNUNET_CREDENTIAL_issue (struct GNUNET_CREDENTIAL_Handle *handle, * @param lr the lookup request to cancel */ void -GNUNET_CREDENTIAL_verify_cancel (struct GNUNET_CREDENTIAL_Request *vr); +GNUNET_CREDENTIAL_request_cancel (struct GNUNET_CREDENTIAL_Request *lr); #if 0 /* keep Emacsens' auto-indent happy */