diff options
author | Andreas Ebner <a.e.bner@web.de> | 2019-10-07 11:48:07 +0200 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2019-10-07 12:18:42 +0200 |
commit | 1d468ecabd6c2ee5c0eae672292efa0f51bc9e48 (patch) | |
tree | 6b527980752f9603945e070c8187bfbb06232b6f /src | |
parent | 5cc45c7ee6a3ac522e5a1f58010d4efdf4fd102f (diff) |
Renamed credential service to abd, replaced all related functions, parameters, etc
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 16 | ||||
-rw-r--r-- | src/abd/Makefile.am (renamed from src/credential/Makefile.am) | 73 | ||||
-rw-r--r-- | src/abd/abd.conf.in | 5 | ||||
-rw-r--r-- | src/abd/abd.h (renamed from src/credential/credential.h) | 27 | ||||
-rw-r--r-- | src/abd/abd_api.c (renamed from src/credential/credential_api.c) | 184 | ||||
-rw-r--r-- | src/abd/abd_serialization.c (renamed from src/credential/credential_serialization.c) | 110 | ||||
-rw-r--r-- | src/abd/abd_serialization.h (renamed from src/credential/credential_serialization.h) | 84 | ||||
-rw-r--r-- | src/abd/delegate_misc.c (renamed from src/credential/delegate_misc.c) | 26 | ||||
-rw-r--r-- | src/abd/delegate_misc.h (renamed from src/credential/delegate_misc.h) | 12 | ||||
-rw-r--r-- | src/abd/gnunet-abd.c (renamed from src/credential/gnunet-credential.c) | 82 | ||||
-rw-r--r-- | src/abd/gnunet-service-abd.c (renamed from src/credential/gnunet-service-credential.c) | 128 | ||||
-rw-r--r-- | src/abd/plugin_gnsrecord_abd.c (renamed from src/credential/plugin_gnsrecord_credential.c) | 65 | ||||
-rw-r--r-- | src/abd/plugin_rest_credential.c (renamed from src/credential/plugin_rest_credential.c) | 0 | ||||
-rwxr-xr-x | src/abd/test_abd_bi_and.sh | 98 | ||||
-rwxr-xr-x | src/abd/test_abd_bi_and2.sh | 94 | ||||
-rwxr-xr-x | src/abd/test_abd_bi_and3.sh | 96 | ||||
-rwxr-xr-x | src/abd/test_abd_bi_and4.sh | 83 | ||||
-rwxr-xr-x | src/abd/test_abd_bi_bw.sh | 87 | ||||
-rwxr-xr-x | src/abd/test_abd_bi_bw_link.sh | 92 | ||||
-rwxr-xr-x | src/abd/test_abd_bi_bw_link2.sh | 93 | ||||
-rwxr-xr-x | src/abd/test_abd_bi_fw.sh | 92 | ||||
-rw-r--r-- | src/abd/test_abd_defaults.conf (renamed from src/credential/test_credential_defaults.conf) | 2 | ||||
-rwxr-xr-x | src/abd/test_abd_issue.sh | 46 | ||||
-rw-r--r-- | src/abd/test_abd_lookup.conf (renamed from src/credential/test_credential_lookup.conf) | 6 | ||||
-rwxr-xr-x | src/abd/test_abd_own.sh | 140 | ||||
-rwxr-xr-x | src/abd/test_abd_verify.sh | 87 | ||||
-rwxr-xr-x | src/abd/test_abd_verify_and.sh | 86 | ||||
-rwxr-xr-x | src/abd/test_abd_verify_simple.sh | 56 | ||||
-rwxr-xr-x | src/abd/test_credential_collect.sh (renamed from src/credential/test_credential_collect.sh) | 0 | ||||
-rwxr-xr-x | src/abd/test_credential_collect_rest.sh (renamed from src/credential/test_credential_collect_rest.sh) | 0 | ||||
-rwxr-xr-x | src/abd/test_credential_issue_rest.sh (renamed from src/credential/test_credential_issue_rest.sh) | 0 | ||||
-rwxr-xr-x | src/abd/test_credential_verify_rest.sh (renamed from src/credential/test_credential_verify_rest.sh) | 0 | ||||
-rw-r--r-- | src/credential/credential.conf.in | 5 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_and.sh | 98 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_and2.sh | 94 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_and3.sh | 96 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_and4.sh | 83 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_bw.sh | 87 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_bw_link.sh | 92 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_bw_link2.sh | 93 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_fw.sh | 92 | ||||
-rwxr-xr-x | src/credential/test_credential_issue.sh | 46 | ||||
-rwxr-xr-x | src/credential/test_credential_own.sh | 140 | ||||
-rwxr-xr-x | src/credential/test_credential_verify.sh | 87 | ||||
-rwxr-xr-x | src/credential/test_credential_verify_and.sh | 87 | ||||
-rwxr-xr-x | src/credential/test_credential_verify_simple.sh | 56 | ||||
-rw-r--r-- | src/include/Makefile.am | 2 | ||||
-rw-r--r-- | src/include/gnunet_abd_service.h (renamed from src/include/gnunet_credential_service.h) | 104 | ||||
-rw-r--r-- | src/include/gnunet_gnsrecord_lib.h | 3 | ||||
-rw-r--r-- | src/include/gnunet_protocols.h | 12 |
50 files changed, 1612 insertions, 1635 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 217aea54f..51bf2d63d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,7 +12,9 @@ endif if HAVE_EXPERIMENTAL EXP_DIR = \ rps \ - credential + abd \ + reclaim-attribute \ + reclaim if HAVE_ABE EXP_DIR += \ abe @@ -23,7 +25,6 @@ if HAVE_JSON endif endif -if HAVE_MHD if HAVE_JSON JSON_DIR = json if HAVE_LIBGNURL @@ -34,6 +35,13 @@ if HAVE_LIBCURL endif endif endif + +if BUILD_PULSE_HELPERS +CONVERSATION_DIR = conversation +else +if BUILD_GST_HELPERS +CONVERSATION_DIR = conversation +endif endif if HAVE_SQLITE @@ -51,7 +59,6 @@ endif if HAVE_MHD if HAVE_JSON REST_DIR = rest - RECLAIM_DIR = reclaim-attribute reclaim endif endif @@ -109,12 +116,11 @@ SUBDIRS = \ vpn \ gns \ zonemaster \ - conversation \ + $(CONVERSATION_DIR) \ fs \ exit \ pt \ secretsharing \ - $(RECLAIM_DIR) \ $(EXP_DIR) \ integration-tests diff --git a/src/credential/Makefile.am b/src/abd/Makefile.am index e72cf4f79..321fb0350 100644 --- a/src/credential/Makefile.am +++ b/src/abd/Makefile.am @@ -2,8 +2,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/include EXTRA_DIST = \ - test_credential_defaults.conf \ - test_credential_lookup.conf + test_abd_defaults.conf \ + test_abd_lookup.conf if USE_COVERAGE @@ -17,28 +17,28 @@ libexecdir= $(pkglibdir)/libexec/ plugindir = $(libdir)/gnunet pkgcfg_DATA = \ - credential.conf + abd.conf # /usr/lib - compiles a layer which can be used to be communicagte with the service lib_LTLIBRARIES = \ - libgnunetcredential.la + libgnunetabd.la # /usr/lib/gnunet/libexec - Business logic . Separate process libexec_PROGRAMS = \ - gnunet-service-credential + gnunet-service-abd bin_PROGRAMS = \ - gnunet-credential + gnunet-abd plugin_LTLIBRARIES = \ - libgnunet_plugin_gnsrecord_credential.la + libgnunet_plugin_gnsrecord_abd.la -gnunet_credential_SOURCES = \ - gnunet-credential.c -gnunet_credential_LDADD = \ - libgnunetcredential.la \ +gnunet_abd_SOURCES = \ + gnunet-abd.c +gnunet_abd_LDADD = \ + libgnunetabd.la \ $(top_builddir)/src/util/libgnunetutil.la \ $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ $(top_builddir)/src/identity/libgnunetidentity.la \ @@ -46,21 +46,21 @@ gnunet_credential_LDADD = \ $(GN_LIBINTL) -libgnunet_plugin_gnsrecord_credential_la_SOURCES = \ - plugin_gnsrecord_credential.c -libgnunet_plugin_gnsrecord_credential_la_LIBADD = \ - libgnunetcredential.la \ +libgnunet_plugin_gnsrecord_abd_la_SOURCES = \ + plugin_gnsrecord_abd.c +libgnunet_plugin_gnsrecord_abd_la_LIBADD = \ + libgnunetabd.la \ $(top_builddir)/src/util/libgnunetutil.la \ $(LTLIBINTL) -libgnunet_plugin_gnsrecord_credential_la_LDFLAGS = \ +libgnunet_plugin_gnsrecord_abd_la_LDFLAGS = \ $(GN_PLUGIN_LDFLAGS) -gnunet_service_credential_SOURCES = \ - gnunet-service-credential.c -gnunet_service_credential_LDADD = \ - libgnunetcredential.la \ +gnunet_service_abd_SOURCES = \ + gnunet-service-abd.c +gnunet_service_abd_LDADD = \ + libgnunetabd.la \ $(top_builddir)/src/util/libgnunetutil.la \ $(top_builddir)/src/gns/libgnunetgns.la \ $(top_builddir)/src/namestore/libgnunetnamestore.la \ @@ -68,24 +68,24 @@ gnunet_service_credential_LDADD = \ $(GN_LIBINTL) -libgnunetcredential_la_SOURCES = \ - credential_api.c credential.h\ - credential_serialization.c \ - credential_serialization.h \ +libgnunetabd_la_SOURCES = \ + abd_api.c abd.h\ + abd_serialization.c \ + abd_serialization.h \ delegate_misc.c \ delegate_misc.h -libgnunetcredential_la_LIBADD = \ +libgnunetabd_la_LIBADD = \ $(top_builddir)/src/util/libgnunetutil.la $(XLIB) -libgnunetcredential_la_LDFLAGS = \ +libgnunetabd_la_LDFLAGS = \ $(GN_LIB_LDFLAGS) check_SCRIPTS = \ - test_credential_issue.sh \ - test_credential_verify_simple.sh \ - test_credential_verify.sh \ - test_credential_verify_and.sh + test_abd_issue.sh \ + test_abd_verify_simple.sh \ + test_abd_verify.sh \ + test_abd_verify_and.sh if ENABLE_TEST_RUN if HAVE_SQLITE @@ -94,17 +94,16 @@ if HAVE_SQLITE endif endif -#libgnunet_plugin_rest_credential_la_SOURCES = \ -# plugin_rest_credential.c -#libgnunet_plugin_rest_credential_la_LIBADD = \ -# $(top_builddir)/src/credential/libgnunetcredential.la \ +#libgnunet_plugin_rest_abd_la_SOURCES = \ +# plugin_rest_abd.c +#libgnunet_plugin_rest_abd_la_LIBADD = \ +# $(top_builddir)/src/abd/libgnunetabd.la \ # $(top_builddir)/src/rest/libgnunetrest.la \ # $(top_builddir)/src/identity/libgnunetidentity.la \ # $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \ -# $(LTLIBINTL) -ljansson $(MHD_LIBS) -#libgnunet_plugin_rest_credential_la_LDFLAGS = \ +# $(LTLIBINTL) -ljansson -lmicrohttpd +#libgnunet_plugin_rest_abd_la_LDFLAGS = \ # $(GN_PLUGIN_LDFLAGS) -#libgnunet_plugin_rest_credential_la_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS) diff --git a/src/abd/abd.conf.in b/src/abd/abd.conf.in new file mode 100644 index 000000000..7baf95fc8 --- /dev/null +++ b/src/abd/abd.conf.in @@ -0,0 +1,5 @@ +[abd] +BINARY = gnunet-service-abd +UNIXPATH = $GNUNET_USER_RUNTIME_DIR/gnunet-service-abd.sock +RUN_PER_USER = YES +OPTIONS = -L DEBUG diff --git a/src/credential/credential.h b/src/abd/abd.h index 1dd476814..854814832 100644 --- a/src/credential/credential.h +++ b/src/abd/abd.h @@ -11,21 +11,21 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 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 <http://www.gnu.org/licenses/>. SPDX-License-Identifier: AGPL3.0-or-later */ /** - * @file credential/credential.h - * @brief IPC messages between CREDENTIAL API and CREDENTIAL service + * @file abd/abd.h + * @brief IPC messages between ABD API and ABD service * @author Martin Schanzenbach */ -#ifndef CREDENTIAL_H -#define CREDENTIAL_H +#ifndef ABD_H +#define ABD_H -#include "gnunet_credential_service.h" +#include "gnunet_abd_service.h" GNUNET_NETWORK_STRUCT_BEGIN @@ -35,7 +35,7 @@ GNUNET_NETWORK_STRUCT_BEGIN struct CollectMessage { /** - * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY + * Header of type #GNUNET_MESSAGE_TYPE_ABD_VERIFY */ struct GNUNET_MessageHeader header; @@ -74,7 +74,7 @@ struct CollectMessage struct VerifyMessage { /** - * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY + * Header of type #GNUNET_MESSAGE_TYPE_ABD_VERIFY */ struct GNUNET_MessageHeader header; @@ -113,12 +113,12 @@ struct VerifyMessage /** - * Message from CREDENTIAL service to client: new results. + * Message from ABD service to client: new results. */ struct DelegationChainResultMessage { /** - * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY_RESULT + * Header of type #GNUNET_MESSAGE_TYPE_ABD_VERIFY_RESULT */ struct GNUNET_MessageHeader header; @@ -142,16 +142,16 @@ struct DelegationChainResultMessage */ uint32_t c_count GNUNET_PACKED; - /* followed by ad_count GNUNET_CREDENTIAL_RecordData structs*/ + /* followed by ad_count GNUNET_ABD_RecordData structs*/ }; /** - * Message from CREDENTIAL service to client: new results. + * Message from ABD service to client: new results. */ struct DelegationChainIntermediateMessage { /** - * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_INTERMEDIATE_RESULT + * Header of type #GNUNET_MESSAGE_TYPE_ABD_INTERMEDIATE_RESULT */ struct GNUNET_MessageHeader header; @@ -205,6 +205,7 @@ struct ChainEntry struct CredentialEntry { + /** * The signature for this credential by the issuer */ diff --git a/src/credential/credential_api.c b/src/abd/abd_api.c index 7acce7d9e..cdc52df91 100644 --- a/src/credential/credential_api.c +++ b/src/abd/abd_api.c @@ -18,8 +18,8 @@ SPDX-License-Identifier: AGPL3.0-or-later */ /** - * @file credential/credential_api.c - * @brief library to access the CREDENTIAL service + * @file abd/abd_api.c + * @brief library to access the ABD service * @author Martin Schanzenbach */ #include "platform.h" @@ -29,39 +29,39 @@ #include "gnunet_hello_lib.h" #include "gnunet_protocols.h" #include "gnunet_signatures.h" -#include "credential.h" -#include "credential_serialization.h" -#include "gnunet_credential_service.h" +#include "abd.h" +#include "abd_serialization.h" +#include "gnunet_abd_service.h" #include "gnunet_identity_service.h" -#define LOG(kind, ...) GNUNET_log_from (kind, "credential-api", __VA_ARGS__) +#define LOG(kind, ...) GNUNET_log_from (kind, "abd-api", __VA_ARGS__) /** * Handle to a verify request */ -struct GNUNET_CREDENTIAL_Request +struct GNUNET_ABD_Request { /** * DLL */ - struct GNUNET_CREDENTIAL_Request *next; + struct GNUNET_ABD_Request *next; /** * DLL */ - struct GNUNET_CREDENTIAL_Request *prev; + struct GNUNET_ABD_Request *prev; /** - * handle to credential service + * handle to abd service */ - struct GNUNET_CREDENTIAL_Handle *credential_handle; + struct GNUNET_ABD_Handle *abd_handle; /** * processor to call on verify result */ - GNUNET_CREDENTIAL_CredentialResultProcessor verify_proc; + GNUNET_ABD_CredentialResultProcessor verify_proc; /** * @e verify_proc closure @@ -71,7 +71,7 @@ struct GNUNET_CREDENTIAL_Request /** * processor to call on intermediate result */ - GNUNET_CREDENTIAL_IntermediateResultProcessor int_proc; + GNUNET_ABD_IntermediateResultProcessor int_proc; /** * @e verify_proc2 closure @@ -91,9 +91,9 @@ struct GNUNET_CREDENTIAL_Request /** - * Connection to the CREDENTIAL service. + * Connection to the ABD service. */ -struct GNUNET_CREDENTIAL_Handle +struct GNUNET_ABD_Handle { /** @@ -109,12 +109,12 @@ struct GNUNET_CREDENTIAL_Handle /** * Head of linked list of active verify requests. */ - struct GNUNET_CREDENTIAL_Request *request_head; + struct GNUNET_ABD_Request *request_head; /** * Tail of linked list of active verify requests. */ - struct GNUNET_CREDENTIAL_Request *request_tail; + struct GNUNET_ABD_Request *request_tail; /** * Reconnect task @@ -134,23 +134,23 @@ struct GNUNET_CREDENTIAL_Handle /** - * Reconnect to CREDENTIAL service. + * Reconnect to ABD service. * - * @param handle the handle to the CREDENTIAL service + * @param handle the handle to the ABD service */ static void -reconnect (struct GNUNET_CREDENTIAL_Handle *handle); +reconnect (struct GNUNET_ABD_Handle *handle); /** - * Reconnect to CREDENTIAL + * Reconnect to ABD * * @param cls the handle */ static void reconnect_task (void *cls) { - struct GNUNET_CREDENTIAL_Handle *handle = cls; + struct GNUNET_ABD_Handle *handle = cls; handle->reconnect_task = NULL; reconnect (handle); @@ -163,7 +163,7 @@ reconnect_task (void *cls) * @param handle our handle */ static void -force_reconnect (struct GNUNET_CREDENTIAL_Handle *handle) +force_reconnect (struct GNUNET_ABD_Handle *handle) { GNUNET_MQ_destroy (handle->mq); handle->mq = NULL; @@ -181,21 +181,21 @@ force_reconnect (struct GNUNET_CREDENTIAL_Handle *handle) * the same closure specified at the creation of the message queue. * Not every message queue implementation supports an error handler. * - * @param cls closure with the `struct GNUNET_CREDENTIAL_Handle *` + * @param cls closure with the `struct GNUNET_ABD_Handle *` * @param error error code */ static void mq_error_handler (void *cls, enum GNUNET_MQ_Error error) { - struct GNUNET_CREDENTIAL_Handle *handle = cls; + struct GNUNET_ABD_Handle *handle = cls; force_reconnect (handle); } /** - * Check validity of message received from the CREDENTIAL service + * Check validity of message received from the ABD service * - * @param cls the `struct GNUNET_CREDENTIAL_Handle *` + * @param cls the `struct GNUNET_ABD_Handle *` * @param vr_msg the incoming message */ static int @@ -207,27 +207,27 @@ check_result (void *cls, const struct DelegationChainResultMessage *vr_msg) /** - * Handler for messages received from the CREDENTIAL service + * Handler for messages received from the ABD service * - * @param cls the `struct GNUNET_CREDENTIAL_Handle *` + * @param cls the `struct GNUNET_ABD_Handle *` * @param vr_msg the incoming message */ static void handle_result (void *cls, const struct DelegationChainResultMessage *vr_msg) { - struct GNUNET_CREDENTIAL_Handle *handle = cls; + struct GNUNET_ABD_Handle *handle = cls; uint32_t r_id = ntohl (vr_msg->id); - struct GNUNET_CREDENTIAL_Request *vr; + struct GNUNET_ABD_Request *vr; size_t mlen = ntohs (vr_msg->header.size) - sizeof (*vr_msg); uint32_t d_count = ntohl (vr_msg->d_count); uint32_t c_count = ntohl (vr_msg->c_count); - struct GNUNET_CREDENTIAL_Delegation d_chain[d_count]; - struct GNUNET_CREDENTIAL_Delegate dels[c_count]; - GNUNET_CREDENTIAL_CredentialResultProcessor proc; + struct GNUNET_ABD_Delegation d_chain[d_count]; + struct GNUNET_ABD_Delegate dels[c_count]; + GNUNET_ABD_CredentialResultProcessor proc; void *proc_cls; LOG (GNUNET_ERROR_TYPE_DEBUG, - "Received verify reply from CREDENTIAL service\n"); + "Received verify reply from ABD service\n"); for (vr = handle->request_head; NULL != vr; vr = vr->next) if (vr->r_id == r_id) break; @@ -240,7 +240,7 @@ handle_result (void *cls, const struct DelegationChainResultMessage *vr_msg) GNUNET_free (vr); GNUNET_assert ( GNUNET_OK == - GNUNET_CREDENTIAL_delegation_chain_deserialize (mlen, + GNUNET_ABD_delegation_chain_deserialize (mlen, (const char *) &vr_msg[1], d_count, d_chain, @@ -267,17 +267,17 @@ check_intermediate (void *cls, const struct DelegationChainIntermediateMessage * static void handle_intermediate (void *cls, const struct DelegationChainIntermediateMessage *vr_msg) { - struct GNUNET_CREDENTIAL_Handle *handle = cls; + struct GNUNET_ABD_Handle *handle = cls; uint32_t r_id = ntohl (vr_msg->id); uint32_t size = ntohl (vr_msg->size); bool is_bw = ntohs(vr_msg->is_bw); - struct GNUNET_CREDENTIAL_Request *vr; - GNUNET_CREDENTIAL_IntermediateResultProcessor proc; + struct GNUNET_ABD_Request *vr; + GNUNET_ABD_IntermediateResultProcessor proc; void *proc_cls; - struct GNUNET_CREDENTIAL_Delegation *dd; + struct GNUNET_ABD_Delegation *dd; - LOG (GNUNET_ERROR_TYPE_DEBUG, "Received intermediate reply from CREDENTIAL service\n"); + LOG (GNUNET_ERROR_TYPE_DEBUG, "Received intermediate reply from ABD service\n"); for (vr = handle->request_head; NULL != vr; vr = vr->next) if (vr->r_id == r_id) @@ -288,10 +288,10 @@ handle_intermediate (void *cls, const struct DelegationChainIntermediateMessage proc = vr->int_proc; proc_cls = vr->proc2_cls; - dd = GNUNET_new (struct GNUNET_CREDENTIAL_Delegation); + dd = GNUNET_new (struct GNUNET_ABD_Delegation); GNUNET_assert ( GNUNET_OK == - GNUNET_CREDENTIAL_delegation_chain_deserialize (size, + GNUNET_ABD_delegation_chain_deserialize (size, (const char *) &vr_msg[1], 1, dd, @@ -303,33 +303,33 @@ handle_intermediate (void *cls, const struct DelegationChainIntermediateMessage /** - * Reconnect to CREDENTIAL service. + * Reconnect to ABD service. * - * @param handle the handle to the CREDENTIAL service + * @param handle the handle to the ABD service */ static void -reconnect (struct GNUNET_CREDENTIAL_Handle *handle) +reconnect (struct GNUNET_ABD_Handle *handle) { struct GNUNET_MQ_MessageHandler handlers[] = {GNUNET_MQ_hd_var_size (result, - GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY_RESULT, + GNUNET_MESSAGE_TYPE_ABD_VERIFY_RESULT, struct DelegationChainResultMessage, handle), GNUNET_MQ_hd_var_size (result, - GNUNET_MESSAGE_TYPE_CREDENTIAL_COLLECT_RESULT, + GNUNET_MESSAGE_TYPE_ABD_COLLECT_RESULT, struct DelegationChainResultMessage, handle), GNUNET_MQ_hd_var_size (intermediate, - GNUNET_MESSAGE_TYPE_CREDENTIAL_INTERMEDIATE_RESULT, + GNUNET_MESSAGE_TYPE_ABD_INTERMEDIATE_RESULT, struct DelegationChainIntermediateMessage, handle), GNUNET_MQ_handler_end ()}; - struct GNUNET_CREDENTIAL_Request *vr; + struct GNUNET_ABD_Request *vr; GNUNET_assert (NULL == handle->mq); - LOG (GNUNET_ERROR_TYPE_DEBUG, "Trying to connect to CREDENTIAL\n"); + LOG (GNUNET_ERROR_TYPE_DEBUG, "Trying to connect to ABD\n"); handle->mq = GNUNET_CLIENT_connect (handle->cfg, - "credential", + "abd", handlers, &mq_error_handler, handle); @@ -341,17 +341,17 @@ reconnect (struct GNUNET_CREDENTIAL_Handle *handle) /** - * Initialize the connection with the CREDENTIAL service. + * Initialize the connection with the ABD service. * * @param cfg configuration to use - * @return handle to the CREDENTIAL service, or NULL on error + * @return handle to the ABD service, or NULL on error */ -struct GNUNET_CREDENTIAL_Handle * -GNUNET_CREDENTIAL_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) +struct GNUNET_ABD_Handle * +GNUNET_ABD_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) { - struct GNUNET_CREDENTIAL_Handle *handle; + struct GNUNET_ABD_Handle *handle; - handle = GNUNET_new (struct GNUNET_CREDENTIAL_Handle); + handle = GNUNET_new (struct GNUNET_ABD_Handle); handle->cfg = cfg; reconnect (handle); if (NULL == handle->mq) @@ -364,12 +364,12 @@ GNUNET_CREDENTIAL_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) /** - * Shutdown connection with the CREDENTIAL service. + * Shutdown connection with the ABD service. * - * @param handle handle of the CREDENTIAL connection to stop + * @param handle handle of the ABD connection to stop */ void -GNUNET_CREDENTIAL_disconnect (struct GNUNET_CREDENTIAL_Handle *handle) +GNUNET_ABD_disconnect (struct GNUNET_ABD_Handle *handle) { if (NULL != handle->mq) { @@ -392,9 +392,9 @@ GNUNET_CREDENTIAL_disconnect (struct GNUNET_CREDENTIAL_Handle *handle) * @param lr the verify request to cancel */ void -GNUNET_CREDENTIAL_request_cancel (struct GNUNET_CREDENTIAL_Request *lr) +GNUNET_ABD_request_cancel (struct GNUNET_ABD_Request *lr) { - struct GNUNET_CREDENTIAL_Handle *handle = lr->credential_handle; + struct GNUNET_ABD_Handle *handle = lr->abd_handle; GNUNET_CONTAINER_DLL_remove (handle->request_head, handle->request_tail, lr); GNUNET_MQ_discard (lr->env); @@ -404,7 +404,7 @@ GNUNET_CREDENTIAL_request_cancel (struct GNUNET_CREDENTIAL_Request *lr) /** * Performs attribute collection. - * Collects all credentials of subject to fulfill the + * Collects all abds of subject to fulfill the * attribute, if possible * * @param handle handle to the Credential service @@ -415,21 +415,21 @@ GNUNET_CREDENTIAL_request_cancel (struct GNUNET_CREDENTIAL_Request *lr) * @param proc_cls closure for processor * @return handle to the queued request */ -struct GNUNET_CREDENTIAL_Request * -GNUNET_CREDENTIAL_collect ( - struct GNUNET_CREDENTIAL_Handle *handle, +struct GNUNET_ABD_Request * +GNUNET_ABD_collect ( + struct GNUNET_ABD_Handle *handle, const struct GNUNET_CRYPTO_EcdsaPublicKey *issuer_key, const char *issuer_attribute, const struct GNUNET_CRYPTO_EcdsaPrivateKey *subject_key, - enum GNUNET_CREDENTIAL_AlgoDirectionFlags direction, - GNUNET_CREDENTIAL_CredentialResultProcessor proc, + enum GNUNET_ABD_AlgoDirectionFlags direction, + GNUNET_ABD_CredentialResultProcessor proc, void *proc_cls, - GNUNET_CREDENTIAL_IntermediateResultProcessor proc2, + GNUNET_ABD_IntermediateResultProcessor proc2, void *proc2_cls) { - /* IPC to shorten credential names, return shorten_handle */ + /* IPC to shorten abd names, return shorten_handle */ struct CollectMessage *c_msg; - struct GNUNET_CREDENTIAL_Request *vr; + struct GNUNET_ABD_Request *vr; size_t nlen; if (NULL == issuer_attribute) @@ -440,7 +440,7 @@ GNUNET_CREDENTIAL_collect ( //DEBUG LOG LOG (GNUNET_ERROR_TYPE_DEBUG, - "Trying to collect `%s' in CREDENTIAL\n", + "Trying to collect `%s' in ABD\n", issuer_attribute); nlen = strlen (issuer_attribute) + 1; if (nlen >= GNUNET_MAX_MESSAGE_SIZE - sizeof (*vr)) @@ -448,15 +448,15 @@ GNUNET_CREDENTIAL_collect ( GNUNET_break (0); return NULL; } - vr = GNUNET_new (struct GNUNET_CREDENTIAL_Request); - vr->credential_handle = handle; + vr = GNUNET_new (struct GNUNET_ABD_Request); + vr->abd_handle = handle; vr->verify_proc = proc; vr->proc_cls = proc_cls; vr->int_proc = proc2; vr->proc2_cls = proc2_cls; vr->r_id = handle->r_id_gen++; vr->env = - GNUNET_MQ_msg_extra (c_msg, nlen, GNUNET_MESSAGE_TYPE_CREDENTIAL_COLLECT); + GNUNET_MQ_msg_extra (c_msg, nlen, GNUNET_MESSAGE_TYPE_ABD_COLLECT); c_msg->id = htonl (vr->r_id); c_msg->subject_key = *subject_key; c_msg->issuer_key = *issuer_key; @@ -487,23 +487,23 @@ GNUNET_CREDENTIAL_collect ( * @param proc_cls closure for processor * @return handle to the queued request */ -struct GNUNET_CREDENTIAL_Request * -GNUNET_CREDENTIAL_verify ( - struct GNUNET_CREDENTIAL_Handle *handle, +struct GNUNET_ABD_Request * +GNUNET_ABD_verify ( + struct GNUNET_ABD_Handle *handle, const struct GNUNET_CRYPTO_EcdsaPublicKey *issuer_key, const char *issuer_attribute, const struct GNUNET_CRYPTO_EcdsaPublicKey *subject_key, uint32_t delegate_count, - const struct GNUNET_CREDENTIAL_Delegate *delegates, - enum GNUNET_CREDENTIAL_AlgoDirectionFlags direction, - GNUNET_CREDENTIAL_CredentialResultProcessor proc, + const struct GNUNET_ABD_Delegate *delegates, + enum GNUNET_ABD_AlgoDirectionFlags direction, + GNUNET_ABD_CredentialResultProcessor proc, void *proc_cls, - GNUNET_CREDENTIAL_IntermediateResultProcessor proc2, + GNUNET_ABD_IntermediateResultProcessor proc2, void *proc2_cls) { - /* IPC to shorten credential names, return shorten_handle */ + /* IPC to shorten abd names, return shorten_handle */ struct VerifyMessage *v_msg; - struct GNUNET_CREDENTIAL_Request *vr; + struct GNUNET_ABD_Request *vr; size_t nlen; size_t clen; @@ -513,11 +513,11 @@ GNUNET_CREDENTIAL_verify ( return NULL; } - clen = GNUNET_CREDENTIAL_delegates_get_size (delegate_count, delegates); + clen = GNUNET_ABD_delegates_get_size (delegate_count, delegates); //DEBUG LOG LOG (GNUNET_ERROR_TYPE_DEBUG, - "Trying to verify `%s' in CREDENTIAL\n", + "Trying to verify `%s' in ABD\n", issuer_attribute); nlen = strlen (issuer_attribute) + 1 + clen; if (nlen >= GNUNET_MAX_MESSAGE_SIZE - sizeof (*vr)) @@ -525,15 +525,15 @@ GNUNET_CREDENTIAL_verify ( GNUNET_break (0); return NULL; } - vr = GNUNET_new (struct GNUNET_CREDENTIAL_Request); - vr->credential_handle = handle; + vr = GNUNET_new (struct GNUNET_ABD_Request); + vr->abd_handle = handle; vr->verify_proc = proc; vr->proc_cls = proc_cls; vr->int_proc = proc2; vr->proc2_cls = proc2_cls; vr->r_id = handle->r_id_gen++; vr->env = - GNUNET_MQ_msg_extra (v_msg, nlen, GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY); + GNUNET_MQ_msg_extra (v_msg, nlen, GNUNET_MESSAGE_TYPE_ABD_VERIFY); v_msg->id = htonl (vr->r_id); v_msg->subject_key = *subject_key; v_msg->d_count = htonl (delegate_count); @@ -542,7 +542,7 @@ GNUNET_CREDENTIAL_verify ( v_msg->resolution_algo = htons (direction); GNUNET_memcpy (&v_msg[1], issuer_attribute, strlen (issuer_attribute)); - GNUNET_CREDENTIAL_delegates_serialize (delegate_count, + GNUNET_ABD_delegates_serialize (delegate_count, delegates, clen, ((char *) &v_msg[1]) + @@ -553,4 +553,4 @@ GNUNET_CREDENTIAL_verify ( return vr; } -/* end of credential_api.c */ +/* end of abd_api.c */ diff --git a/src/credential/credential_serialization.c b/src/abd/abd_serialization.c index 8d8eafa44..d2bc15166 100644 --- a/src/credential/credential_serialization.c +++ b/src/abd/abd_serialization.c @@ -20,30 +20,30 @@ /** - * @file credential/credential_serialization.c + * @file abd/abd_serialization.c * @brief API to serialize and deserialize delegation chains - * and credentials + * and abds * @author Martin Schanzenbach */ #include "platform.h" #include "gnunet_util_lib.h" #include "gnunet_constants.h" -#include "gnunet_credential_service.h" +#include "gnunet_abd_service.h" #include "gnunet_signatures.h" -#include "credential.h" +#include "abd.h" /** * Calculate how many bytes we will need to serialize * the given delegation chain * * @param ds_count number of delegation chain entries - * @param dsr array of #GNUNET_CREDENTIAL_DelegationSet + * @param dsr array of #GNUNET_ABD_DelegationSet * @return the required size to serialize */ size_t -GNUNET_CREDENTIAL_delegation_set_get_size ( +GNUNET_ABD_delegation_set_get_size ( unsigned int ds_count, - const struct GNUNET_CREDENTIAL_DelegationSet *dsr) + const struct GNUNET_ABD_DelegationSet *dsr) { unsigned int i; size_t ret; @@ -59,18 +59,18 @@ GNUNET_CREDENTIAL_delegation_set_get_size ( } /** - * Serizalize the given delegation chain entries and credential + * Serizalize the given delegation chain entries and abd * * @param d_count number of delegation chain entries - * @param dsr array of #GNUNET_CREDENTIAL_DelegationSet + * @param dsr array of #GNUNET_ABD_DelegationSet * @param dest_size size of the destination * @param dest where to store the result * @return the size of the data, -1 on failure */ ssize_t -GNUNET_CREDENTIAL_delegation_set_serialize ( +GNUNET_ABD_delegation_set_serialize ( unsigned int d_count, - const struct GNUNET_CREDENTIAL_DelegationSet *dsr, + const struct GNUNET_ABD_DelegationSet *dsr, size_t dest_size, char *dest) { @@ -110,11 +110,11 @@ GNUNET_CREDENTIAL_delegation_set_serialize ( * @return #GNUNET_OK on success, #GNUNET_SYSERR on error */ int -GNUNET_CREDENTIAL_delegation_set_deserialize ( +GNUNET_ABD_delegation_set_deserialize ( size_t len, const char *src, unsigned int d_count, - struct GNUNET_CREDENTIAL_DelegationSet *dsr) + struct GNUNET_ABD_DelegationSet *dsr) { struct DelegationRecordData rec; unsigned int i; @@ -140,16 +140,16 @@ GNUNET_CREDENTIAL_delegation_set_deserialize ( /** * Calculate how many bytes we will need to serialize - * the credentials + * the abds * - * @param c_count number of credential entries - * @param cd a #GNUNET_CREDENTIAL_Credential + * @param c_count number of abd entries + * @param cd a #GNUNET_ABD_Credential * @return the required size to serialize */ size_t -GNUNET_CREDENTIAL_delegates_get_size ( +GNUNET_ABD_delegates_get_size ( unsigned int c_count, - const struct GNUNET_CREDENTIAL_Delegate *cd) + const struct GNUNET_ABD_Delegate *cd) { unsigned int i; size_t ret; @@ -165,18 +165,18 @@ GNUNET_CREDENTIAL_delegates_get_size ( return ret; } /** - * Serizalize the given credentials + * Serizalize the given abds * - * @param c_count number of credential entries - * @param cd a #GNUNET_CREDENTIAL_Credential + * @param c_count number of abd entries + * @param cd a #GNUNET_ABD_Credential * @param dest_size size of the destination * @param dest where to store the result * @return the size of the data, -1 on failure */ ssize_t -GNUNET_CREDENTIAL_delegates_serialize ( +GNUNET_ABD_delegates_serialize ( unsigned int c_count, - const struct GNUNET_CREDENTIAL_Delegate *cd, + const struct GNUNET_ABD_Delegate *cd, size_t dest_size, char *dest) { @@ -218,15 +218,15 @@ GNUNET_CREDENTIAL_delegates_serialize ( * * @param len size of the serialized creds * @param src the serialized data - * @param c_count the number of credential entries - * @param cd where to put the credential data + * @param c_count the number of abd entries + * @param cd where to put the abd data * @return #GNUNET_OK on success, #GNUNET_SYSERR on error */ int -GNUNET_CREDENTIAL_delegates_deserialize (size_t len, +GNUNET_ABD_delegates_deserialize (size_t len, const char *src, unsigned int c_count, - struct GNUNET_CREDENTIAL_Delegate *cd) + struct GNUNET_ABD_Delegate *cd) { struct DelegateEntry c_rec; unsigned int i; @@ -256,20 +256,20 @@ GNUNET_CREDENTIAL_delegates_deserialize (size_t len, /** * Calculate how many bytes we will need to serialize - * the given delegation chain and credential + * the given delegation chain and abd * * @param d_count number of delegation chain entries - * @param dd array of #GNUNET_CREDENTIAL_Delegation - * @param c_count number of credential entries - * @param cd a #GNUNET_CREDENTIAL_Credential + * @param dd array of #GNUNET_ABD_Delegation + * @param c_count number of abd entries + * @param cd a #GNUNET_ABD_Credential * @return the required size to serialize */ size_t -GNUNET_CREDENTIAL_delegation_chain_get_size ( +GNUNET_ABD_delegation_chain_get_size ( unsigned int d_count, - const struct GNUNET_CREDENTIAL_Delegation *dd, + const struct GNUNET_ABD_Delegation *dd, unsigned int c_count, - const struct GNUNET_CREDENTIAL_Delegate *cd) + const struct GNUNET_ABD_Delegate *cd) { unsigned int i; size_t ret; @@ -282,26 +282,26 @@ GNUNET_CREDENTIAL_delegation_chain_get_size ( (ret + dd[i].issuer_attribute_len + dd[i].subject_attribute_len) >= ret); ret += dd[i].issuer_attribute_len + dd[i].subject_attribute_len; } - return ret + GNUNET_CREDENTIAL_delegates_get_size (c_count, cd); + return ret + GNUNET_ABD_delegates_get_size (c_count, cd); } /** - * Serizalize the given delegation chain entries and credential + * Serizalize the given delegation chain entries and abd * * @param d_count number of delegation chain entries - * @param dd array of #GNUNET_CREDENTIAL_Delegation - * @param c_count number of credential entries - * @param cd a #GNUNET_CREDENTIAL_Credential + * @param dd array of #GNUNET_ABD_Delegation + * @param c_count number of abd entries + * @param cd a #GNUNET_ABD_Credential * @param dest_size size of the destination * @param dest where to store the result * @return the size of the data, -1 on failure */ ssize_t -GNUNET_CREDENTIAL_delegation_chain_serialize ( +GNUNET_ABD_delegation_chain_serialize ( unsigned int d_count, - const struct GNUNET_CREDENTIAL_Delegation *dd, + const struct GNUNET_ABD_Delegation *dd, unsigned int c_count, - const struct GNUNET_CREDENTIAL_Delegate *cd, + const struct GNUNET_ABD_Delegate *cd, size_t dest_size, char *dest) { @@ -335,7 +335,7 @@ GNUNET_CREDENTIAL_delegation_chain_serialize ( dd[i].subject_attribute_len); off += dd[i].subject_attribute_len; } - return off + GNUNET_CREDENTIAL_delegates_serialize (c_count, + return off + GNUNET_ABD_delegates_serialize (c_count, cd, dest_size - off, &dest[off]); @@ -349,18 +349,18 @@ GNUNET_CREDENTIAL_delegation_chain_serialize ( * @param src the serialized data * @param d_count the number of delegation chain entries * @param dd where to put the delegation chain entries - * @param c_count the number of credential entries - * @param cd where to put the credential data + * @param c_count the number of abd entries + * @param cd where to put the abd data * @return #GNUNET_OK on success, #GNUNET_SYSERR on error */ int -GNUNET_CREDENTIAL_delegation_chain_deserialize ( +GNUNET_ABD_delegation_chain_deserialize ( size_t len, const char *src, unsigned int d_count, - struct GNUNET_CREDENTIAL_Delegation *dd, + struct GNUNET_ABD_Delegation *dd, unsigned int c_count, - struct GNUNET_CREDENTIAL_Delegate *cd) + struct GNUNET_ABD_Delegate *cd) { struct ChainEntry rec; unsigned int i; @@ -386,14 +386,14 @@ GNUNET_CREDENTIAL_delegation_chain_deserialize ( dd[i].subject_attribute = &src[off]; off += dd[i].subject_attribute_len; } - return GNUNET_CREDENTIAL_delegates_deserialize (len - off, + return GNUNET_ABD_delegates_deserialize (len - off, &src[off], c_count, cd); } int -GNUNET_CREDENTIAL_delegate_serialize (struct GNUNET_CREDENTIAL_Delegate *dele, +GNUNET_ABD_delegate_serialize (struct GNUNET_ABD_Delegate *dele, char **data) { size_t size; @@ -455,10 +455,10 @@ GNUNET_CREDENTIAL_delegate_serialize (struct GNUNET_CREDENTIAL_Delegate *dele, return size; } -struct GNUNET_CREDENTIAL_Delegate * -GNUNET_CREDENTIAL_delegate_deserialize (const char *data, size_t data_size) +struct GNUNET_ABD_Delegate * +GNUNET_ABD_delegate_deserialize (const char *data, size_t data_size) { - struct GNUNET_CREDENTIAL_Delegate *dele; + struct GNUNET_ABD_Delegate *dele; struct DelegateEntry *cdata; char *attr_combo_str; @@ -480,7 +480,7 @@ GNUNET_CREDENTIAL_delegate_deserialize (const char *data, size_t data_size) int attr_combo_len = iss_len + sub_len; dele = - GNUNET_malloc (sizeof (struct GNUNET_CREDENTIAL_Delegate) + attr_combo_len); + GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) + attr_combo_len); dele->issuer_key = cdata->issuer_key; dele->subject_key = cdata->subject_key; @@ -505,4 +505,4 @@ GNUNET_CREDENTIAL_delegate_deserialize (const char *data, size_t data_size) return dele; } -/* end of credential_serialization.c */ +/* end of abd_serialization.c */ diff --git a/src/credential/credential_serialization.h b/src/abd/abd_serialization.h index 0e106caa1..cef9f42ef 100644 --- a/src/credential/credential_serialization.h +++ b/src/abd/abd_serialization.h @@ -20,45 +20,45 @@ /** - * @file credential/credential_serialization.h + * @file abd/abd_serialization.h * @brief API to serialize and deserialize delegation chains - * and credentials + * and abds * @author Martin Schanzenbach */ -#ifndef CREDENTIAL_SERIALIZATION_H -#define CREDENTIAL_SERIALIZATION_H +#ifndef ABD_SERIALIZATION_H +#define ABD_SERIALIZATION_H #include "platform.h" #include "gnunet_util_lib.h" #include "gnunet_constants.h" -#include "gnunet_credential_service.h" +#include "gnunet_abd_service.h" /** * Calculate how many bytes we will need to serialize * the given delegation record * * @param ds_count number of delegation chain entries - * @param dsr array of #GNUNET_CREDENTIAL_Delegation + * @param dsr array of #GNUNET_ABD_Delegation * @return the required size to serialize */ size_t -GNUNET_CREDENTIAL_delegation_set_get_size ( +GNUNET_ABD_delegation_set_get_size ( unsigned int ds_count, - const struct GNUNET_CREDENTIAL_DelegationSet *dsr); + const struct GNUNET_ABD_DelegationSet *dsr); /** * Serizalize the given delegation record entries * * @param d_count number of delegation chain entries - * @param dsr array of #GNUNET_CREDENTIAL_Delegation + * @param dsr array of #GNUNET_ABD_Delegation * @param dest_size size of the destination * @param dest where to store the result * @return the size of the data, -1 on failure */ ssize_t -GNUNET_CREDENTIAL_delegation_set_serialize ( +GNUNET_ABD_delegation_set_serialize ( unsigned int d_count, - const struct GNUNET_CREDENTIAL_DelegationSet *dsr, + const struct GNUNET_ABD_DelegationSet *dsr, size_t dest_size, char *dest); @@ -73,46 +73,46 @@ GNUNET_CREDENTIAL_delegation_set_serialize ( * @return #GNUNET_OK on success, #GNUNET_SYSERR on error */ int -GNUNET_CREDENTIAL_delegation_set_deserialize ( +GNUNET_ABD_delegation_set_deserialize ( size_t len, const char *src, unsigned int d_count, - struct GNUNET_CREDENTIAL_DelegationSet *dsr); + struct GNUNET_ABD_DelegationSet *dsr); /** * Calculate how many bytes we will need to serialize - * the given delegation chain and credential + * the given delegation chain and abd * * @param d_count number of delegation chain entries - * @param dd array of #GNUNET_CREDENTIAL_Delegation - * @param c_count number of credential entries - * @param cd a #GNUNET_CREDENTIAL_Delegate + * @param dd array of #GNUNET_ABD_Delegation + * @param c_count number of abd entries + * @param cd a #GNUNET_ABD_Delegate * @return the required size to serialize */ size_t -GNUNET_CREDENTIAL_delegation_chain_get_size ( +GNUNET_ABD_delegation_chain_get_size ( unsigned int d_count, - const struct GNUNET_CREDENTIAL_Delegation *dd, + const struct GNUNET_ABD_Delegation *dd, unsigned int c_count, - const struct GNUNET_CREDENTIAL_Delegate *cd); + const struct GNUNET_ABD_Delegate *cd); /** - * Serizalize the given delegation chain entries and credential + * Serizalize the given delegation chain entries and abd * * @param d_count number of delegation chain entries - * @param dd array of #GNUNET_CREDENTIAL_Delegation - * @param c_count number of credential entries - * @param cd a #GNUNET_CREDENTIAL_Delegate + * @param dd array of #GNUNET_ABD_Delegation + * @param c_count number of abd entries + * @param cd a #GNUNET_ABD_Delegate * @param dest_size size of the destination * @param dest where to store the result * @return the size of the data, -1 on failure */ ssize_t -GNUNET_CREDENTIAL_delegation_chain_serialize ( +GNUNET_ABD_delegation_chain_serialize ( unsigned int d_count, - const struct GNUNET_CREDENTIAL_Delegation *dd, + const struct GNUNET_ABD_Delegation *dd, unsigned int c_count, - const struct GNUNET_CREDENTIAL_Delegate *cd, + const struct GNUNET_ABD_Delegate *cd, size_t dest_size, char *dest); @@ -124,42 +124,42 @@ GNUNET_CREDENTIAL_delegation_chain_serialize ( * @param src the serialized data * @param d_count the number of delegation chain entries * @param dd where to put the delegation chain entries - * @param c_count number of credential entries - * @param cd where to put the credential data + * @param c_count number of abd entries + * @param cd where to put the abd data * @return #GNUNET_OK on success, #GNUNET_SYSERR on error */ int -GNUNET_CREDENTIAL_delegation_chain_deserialize ( +GNUNET_ABD_delegation_chain_deserialize ( size_t len, const char *src, unsigned int d_count, - struct GNUNET_CREDENTIAL_Delegation *dd, + struct GNUNET_ABD_Delegation *dd, unsigned int c_count, - struct GNUNET_CREDENTIAL_Delegate *cd); + struct GNUNET_ABD_Delegate *cd); size_t -GNUNET_CREDENTIAL_delegates_get_size ( +GNUNET_ABD_delegates_get_size ( unsigned int c_count, - const struct GNUNET_CREDENTIAL_Delegate *cd); + const struct GNUNET_ABD_Delegate *cd); ssize_t -GNUNET_CREDENTIAL_delegates_serialize ( +GNUNET_ABD_delegates_serialize ( unsigned int c_count, - const struct GNUNET_CREDENTIAL_Delegate *cd, + const struct GNUNET_ABD_Delegate *cd, size_t dest_size, char *dest); int -GNUNET_CREDENTIAL_delegates_deserialize (size_t len, +GNUNET_ABD_delegates_deserialize (size_t len, const char *src, unsigned int c_count, - struct GNUNET_CREDENTIAL_Delegate *cd); + struct GNUNET_ABD_Delegate *cd); int -GNUNET_CREDENTIAL_delegate_serialize (struct GNUNET_CREDENTIAL_Delegate *cred, +GNUNET_ABD_delegate_serialize (struct GNUNET_ABD_Delegate *cred, char **data); -struct GNUNET_CREDENTIAL_Delegate * -GNUNET_CREDENTIAL_delegate_deserialize (const char *data, size_t data_size); +struct GNUNET_ABD_Delegate * +GNUNET_ABD_delegate_deserialize (const char *data, size_t data_size); #endif -/* end of credential_serialization.h */ +/* end of abd_serialization.h */ diff --git a/src/credential/delegate_misc.c b/src/abd/delegate_misc.c index 80124711a..ecc7f7669 100644 --- a/src/credential/delegate_misc.c +++ b/src/abd/delegate_misc.c @@ -20,7 +20,7 @@ /** - * @file credential/delegate_misc.c + * @file abd/delegate_misc.c * @brief Misc API for delegate * * @author Martin Schanzenbach @@ -28,14 +28,14 @@ #include "platform.h" #include "gnunet_util_lib.h" #include "gnunet_constants.h" -#include "gnunet_credential_service.h" +#include "gnunet_abd_service.h" #include "gnunet_signatures.h" -#include "credential.h" +#include "abd.h" #include <inttypes.h> char * -GNUNET_CREDENTIAL_delegate_to_string ( - const struct GNUNET_CREDENTIAL_Delegate *cred) +GNUNET_ABD_delegate_to_string ( + const struct GNUNET_ABD_Delegate *cred) { char *cred_str; char *subject_pkey; @@ -75,10 +75,10 @@ GNUNET_CREDENTIAL_delegate_to_string ( return cred_str; } -struct GNUNET_CREDENTIAL_Delegate * -GNUNET_CREDENTIAL_delegate_from_string (const char *s) +struct GNUNET_ABD_Delegate * +GNUNET_ABD_delegate_from_string (const char *s) { - struct GNUNET_CREDENTIAL_Delegate *dele; + struct GNUNET_ABD_Delegate *dele; size_t enclen = (sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)) * 8; if (enclen % 5 > 0) enclen += 5 - enclen % 5; @@ -129,7 +129,7 @@ GNUNET_CREDENTIAL_delegate_from_string (const char *s) { attr_len = strlen (iss_attr) + strlen (sub_attr) + 2; } - dele = GNUNET_malloc (sizeof (struct GNUNET_CREDENTIAL_Delegate) + attr_len); + dele = GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) + attr_len); char tmp_str[attr_len]; GNUNET_memcpy (tmp_str, iss_attr, strlen (iss_attr)); @@ -183,8 +183,8 @@ GNUNET_CREDENTIAL_delegate_from_string (const char *s) * @return handle to the queued request */ -struct GNUNET_CREDENTIAL_Delegate * -GNUNET_CREDENTIAL_delegate_issue ( +struct GNUNET_ABD_Delegate * +GNUNET_ABD_delegate_issue ( const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, struct GNUNET_CRYPTO_EcdsaPublicKey *subject, const char *iss_attr, @@ -192,7 +192,7 @@ GNUNET_CREDENTIAL_delegate_issue ( struct GNUNET_TIME_Absolute *expiration) { struct DelegateEntry *del; - struct GNUNET_CREDENTIAL_Delegate *dele; + struct GNUNET_ABD_Delegate *dele; size_t size; int attr_len; @@ -246,7 +246,7 @@ GNUNET_CREDENTIAL_delegate_issue ( return NULL; } - dele = GNUNET_malloc (sizeof (struct GNUNET_CREDENTIAL_Delegate) + attr_len); + dele = GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) + attr_len); dele->signature = del->signature; dele->expiration = *expiration; GNUNET_CRYPTO_ecdsa_key_get_public (issuer, &dele->issuer_key); diff --git a/src/credential/delegate_misc.h b/src/abd/delegate_misc.h index 936517437..42a95ce99 100644 --- a/src/credential/delegate_misc.h +++ b/src/abd/delegate_misc.h @@ -18,19 +18,19 @@ SPDX-License-Identifier: AGPL3.0-or-later */ /** - * @file credential/delegate_misc.h + * @file abd/delegate_misc.h * @brief Delegate helper functions */ #ifndef DELEGATE_MISC_H #define DELEGATE_MISC_H -#include "gnunet_credential_service.h" +#include "gnunet_abd_service.h" char * -GNUNET_CREDENTIAL_delegate_to_string ( - const struct GNUNET_CREDENTIAL_Delegate *cred); +GNUNET_ABD_delegate_to_string ( + const struct GNUNET_ABD_Delegate *cred); -struct GNUNET_CREDENTIAL_Delegate * -GNUNET_CREDENTIAL_delegate_from_string (const char *str); +struct GNUNET_ABD_Delegate * +GNUNET_ABD_delegate_from_string (const char *str); #endif diff --git a/src/credential/gnunet-credential.c b/src/abd/gnunet-abd.c index 03b017208..23083ec68 100644 --- a/src/credential/gnunet-credential.c +++ b/src/abd/gnunet-abd.c @@ -18,17 +18,17 @@ SPDX-License-Identifier: AGPL3.0-or-later */ /** - * @file gnunet-credential.c + * @file gnunet-abd.c * @brief command line tool to access command line Credential service * @author Martin Schanzenbach */ #include "platform.h" #include <gnunet_util_lib.h> -#include <gnunet_credential_service.h> +#include <gnunet_abd_service.h> #include <gnunet_gnsrecord_lib.h> #include <gnunet_namestore_service.h> #include "delegate_misc.h" -#include "credential_serialization.h" +#include "abd_serialization.h" /** * Configuration we are using. @@ -53,7 +53,7 @@ static struct GNUNET_IDENTITY_EgoLookup *el; /** * Handle to Credential service. */ -static struct GNUNET_CREDENTIAL_Handle *credential; +static struct GNUNET_ABD_Handle *abd; /** * Desired timeout for the lookup (default is no timeout). @@ -63,12 +63,12 @@ static struct GNUNET_TIME_Relative timeout; /** * Handle to verify request */ -static struct GNUNET_CREDENTIAL_Request *verify_request; +static struct GNUNET_ABD_Request *verify_request; /** * Handle to collect request */ -static struct GNUNET_CREDENTIAL_Request *collect_request; +static struct GNUNET_ABD_Request *collect_request; /** * Task scheduled to handle timeout. @@ -169,7 +169,7 @@ static int backward; /** * API enum, filled and passed for collect/verify */ -enum GNUNET_CREDENTIAL_AlgoDirectionFlags direction = 0; +enum GNUNET_ABD_AlgoDirectionFlags direction = 0; /** * Queue entry for the 'add' operation. @@ -225,13 +225,13 @@ do_shutdown (void *cls) { if (NULL != verify_request) { - GNUNET_CREDENTIAL_request_cancel (verify_request); + GNUNET_ABD_request_cancel (verify_request); verify_request = NULL; } - if (NULL != credential) + if (NULL != abd) { - GNUNET_CREDENTIAL_disconnect (credential); - credential = NULL; + GNUNET_ABD_disconnect (abd); + abd = NULL; } if (NULL != tt) { @@ -270,7 +270,7 @@ do_timeout (void *cls) static void handle_intermediate_result(void *cls, - struct GNUNET_CREDENTIAL_Delegation *dd, + struct GNUNET_ABD_Delegation *dd, bool is_bw) { char *prefix = ""; @@ -290,9 +290,9 @@ handle_intermediate_result(void *cls, static void handle_collect_result (void *cls, unsigned int d_count, - struct GNUNET_CREDENTIAL_Delegation *dc, + struct GNUNET_ABD_Delegation *dc, unsigned int c_count, - struct GNUNET_CREDENTIAL_Delegate *dele) + struct GNUNET_ABD_Delegate *dele) { int i; char *line; @@ -302,7 +302,7 @@ handle_collect_result (void *cls, { for (i = 0; i < c_count; i++) { - line = GNUNET_CREDENTIAL_delegate_to_string (&dele[i]); + line = GNUNET_ABD_delegate_to_string (&dele[i]); printf ("%s\n", line); GNUNET_free (line); } @@ -319,9 +319,9 @@ handle_collect_result (void *cls, static void handle_verify_result (void *cls, unsigned int d_count, - struct GNUNET_CREDENTIAL_Delegation *dc, + struct GNUNET_ABD_Delegation *dc, unsigned int c_count, - struct GNUNET_CREDENTIAL_Delegate *dele) + struct GNUNET_ABD_Delegate *dele) { int i; char *iss_key; @@ -413,7 +413,7 @@ identity_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) } privkey = GNUNET_IDENTITY_ego_get_private_key (ego); - collect_request = GNUNET_CREDENTIAL_collect (credential, + collect_request = GNUNET_ABD_collect (abd, &issuer_pkey, issuer_attr, privkey, @@ -557,8 +557,8 @@ store_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) if (GNUNET_GNSRECORD_TYPE_DELEGATE == type) { // Parse import - struct GNUNET_CREDENTIAL_Delegate *cred; - cred = GNUNET_CREDENTIAL_delegate_from_string (import); + struct GNUNET_ABD_Delegate *cred; + cred = GNUNET_ABD_delegate_from_string (import); // Get import subject public key string char *subject_pubkey_str = @@ -584,7 +584,7 @@ store_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) etime_is_rel = GNUNET_NO; // Prepare the data to be store in the record - data_size = GNUNET_CREDENTIAL_delegate_serialize (cred, (char **) &data); + data_size = GNUNET_ABD_delegate_serialize (cred, (char **) &data); GNUNET_free (cred); } else @@ -631,7 +631,7 @@ static void sign_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) { const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; - struct GNUNET_CREDENTIAL_Delegate *dele; + struct GNUNET_ABD_Delegate *dele; struct GNUNET_TIME_Absolute etime_abs; char *res; @@ -694,12 +694,12 @@ sign_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) } // Sign delegate - dele = GNUNET_CREDENTIAL_delegate_issue (privkey, + dele = GNUNET_ABD_delegate_issue (privkey, &subject_pkey, issuer_attr, subject_attr, &etime_abs); - res = GNUNET_CREDENTIAL_delegate_to_string (dele); + res = GNUNET_ABD_delegate_to_string (dele); GNUNET_free (dele); printf ("%s\n", res); @@ -803,9 +803,9 @@ run (void *cls, backward = GNUNET_YES; } if (GNUNET_YES == forward) - direction |= GNUNET_CREDENTIAL_FLAG_FORWARD; + direction |= GNUNET_ABD_FLAG_FORWARD; if (GNUNET_YES == backward) - direction |= GNUNET_CREDENTIAL_FLAG_BACKWARD; + direction |= GNUNET_ABD_FLAG_BACKWARD; if (GNUNET_YES == collect) { @@ -816,11 +816,11 @@ run (void *cls, return; } - credential = GNUNET_CREDENTIAL_connect (cfg); + abd = GNUNET_ABD_connect (cfg); - if (NULL == credential) + if (NULL == abd) { - fprintf (stderr, _ ("Failed to connect to CREDENTIAL\n")); + fprintf (stderr, _ ("Failed to connect to ABD\n")); GNUNET_SCHEDULER_shutdown (); return; } @@ -877,11 +877,11 @@ run (void *cls, GNUNET_SCHEDULER_shutdown (); return; } - credential = GNUNET_CREDENTIAL_connect (cfg); + abd = GNUNET_ABD_connect (cfg); - if (NULL == credential) + if (NULL == abd) { - fprintf (stderr, _ ("Failed to connect to CREDENTIAL\n")); + fprintf (stderr, _ ("Failed to connect to ABD\n")); GNUNET_SCHEDULER_shutdown (); return; } @@ -906,23 +906,23 @@ run (void *cls, int i; while (NULL != (tok = strtok (NULL, ","))) count++; - struct GNUNET_CREDENTIAL_Delegate delegates[count]; - struct GNUNET_CREDENTIAL_Delegate *dele; + struct GNUNET_ABD_Delegate delegates[count]; + struct GNUNET_ABD_Delegate *dele; GNUNET_free (tmp); tmp = GNUNET_strdup (subject_delegate); tok = strtok (tmp, ","); for (i = 0; i < count; i++) { - dele = GNUNET_CREDENTIAL_delegate_from_string (tok); + dele = GNUNET_ABD_delegate_from_string (tok); GNUNET_memcpy (&delegates[i], dele, - sizeof (struct GNUNET_CREDENTIAL_Delegate)); + sizeof (struct GNUNET_ABD_Delegate)); delegates[i].issuer_attribute = GNUNET_strdup (dele->issuer_attribute); tok = strtok (NULL, ","); GNUNET_free (dele); } - verify_request = GNUNET_CREDENTIAL_verify (credential, + verify_request = GNUNET_ABD_verify (abd, &issuer_pkey, issuer_attr, &subject_pkey, @@ -1054,11 +1054,11 @@ main (int argc, char *const *argv) if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) return 2; - GNUNET_log_setup ("gnunet-credential", "WARNING", NULL); + GNUNET_log_setup ("gnunet-abd", "WARNING", NULL); if (GNUNET_OK != GNUNET_PROGRAM_run (argc, argv, - "gnunet-credential", - _ ("GNUnet credential resolver tool"), + "gnunet-abd", + _ ("GNUnet abd resolver tool"), options, &run, NULL)) @@ -1067,4 +1067,4 @@ main (int argc, char *const *argv) return ret; } -/* end of gnunet-credential.c */ +/* end of gnunet-abd.c */ diff --git a/src/credential/gnunet-service-credential.c b/src/abd/gnunet-service-abd.c index 4753e8e3b..84222b290 100644 --- a/src/credential/gnunet-service-credential.c +++ b/src/abd/gnunet-service-abd.c @@ -18,7 +18,7 @@ SPDX-License-Identifier: AGPL3.0-or-later */ /** - * @file credential/gnunet-service-credential.c + * @file abd/gnunet-service-abd.c * @brief GNUnet Credential Service (main service) * @author Martin Schanzenbach */ @@ -26,9 +26,9 @@ #include "gnunet_util_lib.h" -#include "credential.h" -#include "credential_serialization.h" -#include "gnunet_credential_service.h" +#include "abd.h" +#include "abd_serialization.h" +#include "gnunet_abd_service.h" #include "gnunet_protocols.h" #include "gnunet_signatures.h" #include "gnunet_statistics_service.h" @@ -39,7 +39,7 @@ #include <gnunet_namestore_service.h> -#define GNUNET_CREDENTIAL_MAX_LENGTH 255 +#define GNUNET_ABD_MAX_LENGTH 255 struct VerifyRequestHandle; @@ -82,32 +82,6 @@ struct DelegationChainEntry /** * DLL for record */ -struct CredentialRecordEntry -{ - /** - * DLL - */ - struct CredentialRecordEntry *next; - - /** - * DLL - */ - struct CredentialRecordEntry *prev; - - /** - * Number of references in delegation chains - */ - uint32_t refcount; - - /** - * Payload - */ - struct GNUNET_CREDENTIAL_Credential *credential; -}; - -/** - * DLL for record - */ struct DelegateRecordEntry { /** @@ -128,7 +102,7 @@ struct DelegateRecordEntry /** * Payload */ - struct GNUNET_CREDENTIAL_Delegate *delegate; + struct GNUNET_ABD_Delegate *delegate; }; /** @@ -338,7 +312,7 @@ struct VerifyRequestHandle /** * Direction of the resolution algo */ - enum GNUNET_CREDENTIAL_AlgoDirectionFlags resolution_algo; + enum GNUNET_ABD_AlgoDirectionFlags resolution_algo; /** * Delegate iterator for lookup @@ -463,7 +437,7 @@ shutdown_task (void *cls) while (NULL != (vrh = vrh_head)) { - // CREDENTIAL_resolver_lookup_cancel (clh->lookup); + // ABD_resolver_lookup_cancel (clh->lookup); GNUNET_CONTAINER_DLL_remove (vrh_head, vrh_tail, vrh); cleanup_handle (vrh); } @@ -489,14 +463,14 @@ static void send_intermediate_response(struct VerifyRequestHandle *vrh, struct DelegationChainEntry *ch_entry, bool is_bw){ struct DelegationChainIntermediateMessage *rmsg; struct GNUNET_MQ_Envelope *env; - struct GNUNET_CREDENTIAL_Delegation *dd; + struct GNUNET_ABD_Delegation *dd; size_t size; // Don't report immediate results during collect if(vrh->is_collect) return; - dd = GNUNET_new (struct GNUNET_CREDENTIAL_Delegation); + dd = GNUNET_new (struct GNUNET_ABD_Delegation); dd->issuer_key = ch_entry->issuer_key; dd->subject_key = ch_entry->subject_key; dd->issuer_attribute = ch_entry->issuer_attribute; @@ -510,21 +484,21 @@ send_intermediate_response(struct VerifyRequestHandle *vrh, struct DelegationCha } - size = GNUNET_CREDENTIAL_delegation_chain_get_size (1, + size = GNUNET_ABD_delegation_chain_get_size (1, dd, 0, NULL); env = GNUNET_MQ_msg_extra (rmsg, size, - GNUNET_MESSAGE_TYPE_CREDENTIAL_INTERMEDIATE_RESULT); + GNUNET_MESSAGE_TYPE_ABD_INTERMEDIATE_RESULT); // Assign id so that client can find associated request rmsg->id = vrh->request_id; rmsg->is_bw = htons(is_bw); rmsg->size = htonl(size); GNUNET_assert ( - -1 != GNUNET_CREDENTIAL_delegation_chain_serialize (1, + -1 != GNUNET_ABD_delegation_chain_serialize (1, dd, 0, NULL, @@ -539,8 +513,8 @@ send_lookup_response (struct VerifyRequestHandle *vrh) struct GNUNET_MQ_Envelope *env; struct DelegationChainResultMessage *rmsg; struct DelegationChainEntry *dce; - struct GNUNET_CREDENTIAL_Delegation dd[vrh->delegation_chain_size]; - struct GNUNET_CREDENTIAL_Delegate dele[vrh->del_chain_size]; + struct GNUNET_ABD_Delegation dd[vrh->delegation_chain_size]; + struct GNUNET_ABD_Delegate dele[vrh->del_chain_size]; struct DelegateRecordEntry *del; struct DelegateRecordEntry *tmp; size_t size; @@ -595,13 +569,13 @@ send_lookup_response (struct VerifyRequestHandle *vrh) del = del->next; } size = - GNUNET_CREDENTIAL_delegation_chain_get_size (vrh->delegation_chain_size, + GNUNET_ABD_delegation_chain_get_size (vrh->delegation_chain_size, dd, vrh->del_chain_size, dele); env = GNUNET_MQ_msg_extra (rmsg, size, - GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY_RESULT); + GNUNET_MESSAGE_TYPE_ABD_VERIFY_RESULT); // Assign id so that client can find associated request rmsg->id = vrh->request_id; rmsg->d_count = htonl (vrh->delegation_chain_size); @@ -614,7 +588,7 @@ send_lookup_response (struct VerifyRequestHandle *vrh) GNUNET_assert ( -1 != - GNUNET_CREDENTIAL_delegation_chain_serialize (vrh->delegation_chain_size, + GNUNET_ABD_delegation_chain_serialize (vrh->delegation_chain_size, dd, vrh->del_chain_size, dele, @@ -775,8 +749,8 @@ forward_resolution (void *cls, continue; // Start deserialize into Delegate - struct GNUNET_CREDENTIAL_Delegate *del; - del = GNUNET_CREDENTIAL_delegate_deserialize (rd[i].data, rd[i].data_size); + struct GNUNET_ABD_Delegate *del; + del = GNUNET_ABD_delegate_deserialize (rd[i].data, rd[i].data_size); // Start: Create DQ Entry dq_entry = GNUNET_new (struct DelegationQueueEntry); @@ -996,7 +970,7 @@ backward_resolution (void *cls, const struct GNUNET_GNSRECORD_Data *rd) { struct VerifyRequestHandle *vrh; - const struct GNUNET_CREDENTIAL_DelegationRecord *sets; + const struct GNUNET_ABD_DelegationRecord *sets; struct DelegateRecordEntry *del_pointer; struct DelegationSetQueueEntry *current_set; struct DelegationSetQueueEntry *ds_entry; @@ -1017,13 +991,13 @@ backward_resolution (void *cls, continue; sets = rd[i].data; - struct GNUNET_CREDENTIAL_DelegationSet set[ntohl (sets->set_count)]; + struct GNUNET_ABD_DelegationSet set[ntohl (sets->set_count)]; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found new attribute delegation with %d sets. Creating new Job...\n", ntohl (sets->set_count)); if (GNUNET_OK != - GNUNET_CREDENTIAL_delegation_set_deserialize (GNUNET_ntohll ( + GNUNET_ABD_delegation_set_deserialize (GNUNET_ntohll ( sets->data_size), (const char *) &sets[1], ntohl (sets->set_count), @@ -1430,14 +1404,14 @@ check_verify (void *cls, const struct VerifyMessage *v_msg) GNUNET_break (0); return GNUNET_SYSERR; } - if (ntohs (v_msg->issuer_attribute_len) > GNUNET_CREDENTIAL_MAX_LENGTH) + if (ntohs (v_msg->issuer_attribute_len) > GNUNET_ABD_MAX_LENGTH) { GNUNET_break (0); return GNUNET_SYSERR; } attr = (const char *) &v_msg[1]; - if (strlen (attr) > GNUNET_CREDENTIAL_MAX_LENGTH) + if (strlen (attr) > GNUNET_ABD_MAX_LENGTH) { GNUNET_break (0); return GNUNET_SYSERR; @@ -1453,8 +1427,8 @@ handle_verify (void *cls, const struct VerifyMessage *v_msg) struct DelegateRecordEntry *del_entry; uint32_t delegate_count; uint32_t delegate_data_size; - char attr[GNUNET_CREDENTIAL_MAX_LENGTH + 1]; - char issuer_attribute[GNUNET_CREDENTIAL_MAX_LENGTH + 1]; + char attr[GNUNET_ABD_MAX_LENGTH + 1]; + char issuer_attribute[GNUNET_ABD_MAX_LENGTH + 1]; char *attrptr = attr; char *delegate_data; const char *utf_in; @@ -1494,12 +1468,12 @@ handle_verify (void *cls, const struct VerifyMessage *v_msg) delegate_data_size = ntohs (v_msg->header.size) - sizeof (struct VerifyMessage) - ntohs (v_msg->issuer_attribute_len) - 1; - struct GNUNET_CREDENTIAL_Delegate delegates[delegate_count]; + struct GNUNET_ABD_Delegate delegates[delegate_count]; memset (delegates, 0, - sizeof (struct GNUNET_CREDENTIAL_Delegate) * delegate_count); + sizeof (struct GNUNET_ABD_Delegate) * delegate_count); delegate_data = (char *) &v_msg[1] + ntohs (v_msg->issuer_attribute_len) + 1; - if (GNUNET_OK != GNUNET_CREDENTIAL_delegates_deserialize (delegate_data_size, + if (GNUNET_OK != GNUNET_ABD_delegates_deserialize (delegate_data_size, delegate_data, delegate_count, delegates)) @@ -1514,11 +1488,11 @@ handle_verify (void *cls, const struct VerifyMessage *v_msg) { del_entry = GNUNET_new (struct DelegateRecordEntry); del_entry->delegate = - GNUNET_malloc (sizeof (struct GNUNET_CREDENTIAL_Delegate) + + GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) + delegates[i].issuer_attribute_len + 1); GNUNET_memcpy (del_entry->delegate, &delegates[i], - sizeof (struct GNUNET_CREDENTIAL_Delegate)); + sizeof (struct GNUNET_ABD_Delegate)); GNUNET_memcpy (&del_entry->delegate[1], delegates[i].issuer_attribute, delegates[i].issuer_attribute_len); @@ -1532,18 +1506,18 @@ handle_verify (void *cls, const struct VerifyMessage *v_msg) } // Switch resolution algo - if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo && - GNUNET_CREDENTIAL_FLAG_FORWARD & vrh->resolution_algo) + if (GNUNET_ABD_FLAG_BACKWARD & vrh->resolution_algo && + GNUNET_ABD_FLAG_FORWARD & vrh->resolution_algo) { if(1 == delegation_chain_fw_resolution_start (vrh)) return; delegation_chain_bw_resolution_start (vrh); } - else if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo) + else if (GNUNET_ABD_FLAG_BACKWARD & vrh->resolution_algo) { delegation_chain_bw_resolution_start (vrh); } - else if (GNUNET_CREDENTIAL_FLAG_FORWARD & vrh->resolution_algo) + else if (GNUNET_ABD_FLAG_FORWARD & vrh->resolution_algo) { delegation_chain_fw_resolution_start (vrh); } @@ -1566,19 +1540,19 @@ delegate_collection_finished (void *cls) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Done collecting delegates.\n"); // if both are set: bidirectional search, meaning start both chain resolutions - if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo && - GNUNET_CREDENTIAL_FLAG_FORWARD & vrh->resolution_algo) + if (GNUNET_ABD_FLAG_BACKWARD & vrh->resolution_algo && + GNUNET_ABD_FLAG_FORWARD & vrh->resolution_algo) { // if premature match found don't start bw resultion if(1 == delegation_chain_fw_resolution_start (vrh)) return; delegation_chain_bw_resolution_start (vrh); } - else if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo) + else if (GNUNET_ABD_FLAG_BACKWARD & vrh->resolution_algo) { delegation_chain_bw_resolution_start (vrh); } - else if (GNUNET_CREDENTIAL_FLAG_FORWARD & vrh->resolution_algo) + else if (GNUNET_ABD_FLAG_FORWARD & vrh->resolution_algo) { delegation_chain_fw_resolution_start (vrh); } @@ -1592,7 +1566,7 @@ handle_delegate_collection_cb (void *cls, const struct GNUNET_GNSRECORD_Data *rd) { struct VerifyRequestHandle *vrh = cls; - struct GNUNET_CREDENTIAL_Delegate *del; + struct GNUNET_ABD_Delegate *del; struct DelegateRecordEntry *del_entry; int cred_record_count; cred_record_count = 0; @@ -1603,7 +1577,7 @@ handle_delegate_collection_cb (void *cls, if (GNUNET_GNSRECORD_TYPE_DELEGATE != rd[i].record_type) continue; cred_record_count++; - del = GNUNET_CREDENTIAL_delegate_deserialize (rd[i].data, rd[i].data_size); + del = GNUNET_ABD_delegate_deserialize (rd[i].data, rd[i].data_size); if (NULL == del) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Invalid delegate found\n"); @@ -1628,8 +1602,8 @@ handle_delegate_collection_cb (void *cls, static void handle_collect (void *cls, const struct CollectMessage *c_msg) { - char attr[GNUNET_CREDENTIAL_MAX_LENGTH + 1]; - char issuer_attribute[GNUNET_CREDENTIAL_MAX_LENGTH + 1]; + char attr[GNUNET_ABD_MAX_LENGTH + 1]; + char issuer_attribute[GNUNET_ABD_MAX_LENGTH + 1]; struct VerifyRequestHandle *vrh; struct GNUNET_SERVICE_Client *client = cls; char *attrptr = attr; @@ -1692,7 +1666,7 @@ check_collect (void *cls, const struct CollectMessage *c_msg) GNUNET_break (0); return GNUNET_SYSERR; } - if (ntohs (c_msg->issuer_attribute_len) > GNUNET_CREDENTIAL_MAX_LENGTH) + if (ntohs (c_msg->issuer_attribute_len) > GNUNET_ABD_MAX_LENGTH) { GNUNET_break (0); return GNUNET_SYSERR; @@ -1700,7 +1674,7 @@ check_collect (void *cls, const struct CollectMessage *c_msg) attr = (const char *) &c_msg[1]; if (('\0' != attr[msg_size - sizeof (struct CollectMessage) - 1]) || - (strlen (attr) > GNUNET_CREDENTIAL_MAX_LENGTH)) + (strlen (attr) > GNUNET_ABD_MAX_LENGTH)) { GNUNET_break (0); return GNUNET_SYSERR; @@ -1749,7 +1723,7 @@ run (void *cls, fprintf (stderr, _ ("Failed to connect to namestore\n")); } - statistics = GNUNET_STATISTICS_create ("credential", c); + statistics = GNUNET_STATISTICS_create ("abd", c); GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); } @@ -1758,20 +1732,20 @@ run (void *cls, * Define "main" method using service macro */ GNUNET_SERVICE_MAIN ( - "credential", + "abd", GNUNET_SERVICE_OPTION_NONE, &run, &client_connect_cb, &client_disconnect_cb, NULL, GNUNET_MQ_hd_var_size (verify, - GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY, + GNUNET_MESSAGE_TYPE_ABD_VERIFY, struct VerifyMessage, NULL), GNUNET_MQ_hd_var_size (collect, - GNUNET_MESSAGE_TYPE_CREDENTIAL_COLLECT, + GNUNET_MESSAGE_TYPE_ABD_COLLECT, struct CollectMessage, NULL), GNUNET_MQ_handler_end ()); -/* end of gnunet-service-credential.c */ +/* end of gnunet-service-abd.c */ diff --git a/src/credential/plugin_gnsrecord_credential.c b/src/abd/plugin_gnsrecord_abd.c index 088c4dd0e..811878627 100644 --- a/src/credential/plugin_gnsrecord_credential.c +++ b/src/abd/plugin_gnsrecord_abd.c @@ -19,8 +19,8 @@ */ /** - * @file credential/plugin_gnsrecord_credential.c - * @brief gnsrecord plugin to provide the API for CREDENTIAL records + * @file abd/plugin_gnsrecord_abd.c + * @brief gnsrecord plugin to provide the API for ABD records * @author Martin Schanzenbach */ #include "platform.h" @@ -28,8 +28,8 @@ #include "gnunet_util_lib.h" #include "delegate_misc.h" -#include "credential_serialization.h" -#include "gnunet_credential_service.h" +#include "abd_serialization.h" +#include "gnunet_abd_service.h" #include "gnunet_gnsrecord_lib.h" #include "gnunet_gnsrecord_plugin.h" #include "gnunet_signatures.h" @@ -43,7 +43,7 @@ * @return NULL on error, otherwise human-readable representation of the value */ static char * -credential_value_to_string (void *cls, +abd_value_to_string (void *cls, uint32_t type, const void *data, size_t data_size) @@ -54,20 +54,20 @@ credential_value_to_string (void *cls, { case GNUNET_GNSRECORD_TYPE_ATTRIBUTE: { - struct GNUNET_CREDENTIAL_DelegationRecord sets; + struct GNUNET_ABD_DelegationRecord sets; char *attr_str; char *subject_pkey; char *tmp_str; int i; - if (data_size < sizeof (struct GNUNET_CREDENTIAL_DelegationRecord)) + if (data_size < sizeof (struct GNUNET_ABD_DelegationRecord)) return NULL; /* malformed */ GNUNET_memcpy (&sets, data, sizeof (sets)); cdata = data; - struct GNUNET_CREDENTIAL_DelegationSet set[ntohl (sets.set_count)]; + struct GNUNET_ABD_DelegationSet set[ntohl (sets.set_count)]; if (GNUNET_OK != - GNUNET_CREDENTIAL_delegation_set_deserialize (GNUNET_ntohll ( + GNUNET_ABD_delegation_set_deserialize (GNUNET_ntohll ( sets.data_size), &cdata[sizeof (sets)], ntohl (sets.set_count), @@ -118,11 +118,11 @@ credential_value_to_string (void *cls, } case GNUNET_GNSRECORD_TYPE_DELEGATE: { - struct GNUNET_CREDENTIAL_Delegate *cred; + struct GNUNET_ABD_Delegate *cred; char *cred_str; - cred = GNUNET_CREDENTIAL_delegate_deserialize (data, data_size); - cred_str = GNUNET_CREDENTIAL_delegate_to_string (cred); + cred = GNUNET_ABD_delegate_deserialize (data, data_size); + cred_str = GNUNET_ABD_delegate_to_string (cred); GNUNET_free (cred); return cred_str; } @@ -144,7 +144,7 @@ credential_value_to_string (void *cls, * @return #GNUNET_OK on success */ static int -credential_string_to_value (void *cls, +abd_string_to_value (void *cls, uint32_t type, const char *s, void **data, @@ -156,7 +156,7 @@ credential_string_to_value (void *cls, { case GNUNET_GNSRECORD_TYPE_ATTRIBUTE: { - struct GNUNET_CREDENTIAL_DelegationRecord *sets; + struct GNUNET_ABD_DelegationRecord *sets; char attr_str[253 + 1]; char subject_pkey[52 + 1]; char *token; @@ -170,7 +170,7 @@ credential_string_to_value (void *cls, token = strtok (tmp_str, ","); entries = 0; tmp_data_size = 0; - *data_size = sizeof (struct GNUNET_CREDENTIAL_DelegationRecord); + *data_size = sizeof (struct GNUNET_ABD_DelegationRecord); while (NULL != token) { // also fills the variables subject_pley and attr_str if "regex"-like match @@ -199,9 +199,9 @@ credential_string_to_value (void *cls, return GNUNET_SYSERR; } - struct GNUNET_CREDENTIAL_DelegationSet set[entries]; + struct GNUNET_ABD_DelegationSet set[entries]; // sets memory to be 0, starting at *set for the size of struct * entries - memset (set, 0, sizeof (struct GNUNET_CREDENTIAL_DelegationSet) * entries); + memset (set, 0, sizeof (struct GNUNET_ABD_DelegationSet) * entries); for (i = 0; i < entries; i++) { matches = SSCANF (token, "%s %s", subject_pkey, attr_str); @@ -220,7 +220,7 @@ credential_string_to_value (void *cls, // If more entries, then token string can take the next entry (separated by ',') by calling strtok again token = strtok (NULL, ","); } - tmp_data_size = GNUNET_CREDENTIAL_delegation_set_get_size (entries, set); + tmp_data_size = GNUNET_ABD_delegation_set_get_size (entries, set); if (-1 == tmp_data_size) { @@ -229,7 +229,7 @@ credential_string_to_value (void *cls, } *data_size += tmp_data_size; *data = sets = GNUNET_malloc (*data_size); - GNUNET_CREDENTIAL_delegation_set_serialize (entries, + GNUNET_ABD_delegation_set_serialize (entries, set, tmp_data_size, (char *) &sets[1]); @@ -246,10 +246,10 @@ credential_string_to_value (void *cls, } case GNUNET_GNSRECORD_TYPE_DELEGATE: { - struct GNUNET_CREDENTIAL_Delegate *cred; - cred = GNUNET_CREDENTIAL_delegate_from_string (s); + struct GNUNET_ABD_Delegate *cred; + cred = GNUNET_ABD_delegate_from_string (s); - *data_size = GNUNET_CREDENTIAL_delegate_serialize (cred, (char **) data); + *data_size = GNUNET_ABD_delegate_serialize (cred, (char **) data); return GNUNET_OK; } @@ -267,8 +267,7 @@ static struct { const char *name; uint32_t number; -} name_map[] = {{"CRED", GNUNET_GNSRECORD_TYPE_CREDENTIAL}, - {"ATTR", GNUNET_GNSRECORD_TYPE_ATTRIBUTE}, +} name_map[] = {{"ATTR", GNUNET_GNSRECORD_TYPE_ATTRIBUTE}, {"DEL", GNUNET_GNSRECORD_TYPE_DELEGATE}, {NULL, UINT32_MAX}}; @@ -281,7 +280,7 @@ static struct * @return corresponding number, UINT32_MAX on error */ static uint32_t -credential_typename_to_number (void *cls, const char *gns_typename) +abd_typename_to_number (void *cls, const char *gns_typename) { unsigned int i; @@ -301,7 +300,7 @@ credential_typename_to_number (void *cls, const char *gns_typename) * @return corresponding typestring, NULL on error */ static const char * -credential_number_to_typename (void *cls, uint32_t type) +abd_number_to_typename (void *cls, uint32_t type) { unsigned int i; @@ -319,15 +318,15 @@ credential_number_to_typename (void *cls, uint32_t type) * @return the exported block API */ void * -libgnunet_plugin_gnsrecord_credential_init (void *cls) +libgnunet_plugin_gnsrecord_abd_init (void *cls) { struct GNUNET_GNSRECORD_PluginFunctions *api; api = GNUNET_new (struct GNUNET_GNSRECORD_PluginFunctions); - api->value_to_string = &credential_value_to_string; - api->string_to_value = &credential_string_to_value; - api->typename_to_number = &credential_typename_to_number; - api->number_to_typename = &credential_number_to_typename; + api->value_to_string = &abd_value_to_string; + api->string_to_value = &abd_string_to_value; + api->typename_to_number = &abd_typename_to_number; + api->number_to_typename = &abd_number_to_typename; return api; } @@ -339,7 +338,7 @@ libgnunet_plugin_gnsrecord_credential_init (void *cls) * @return NULL */ void * -libgnunet_plugin_gnsrecord_credential_done (void *cls) +libgnunet_plugin_gnsrecord_abd_done (void *cls) { struct GNUNET_GNSRECORD_PluginFunctions *api = cls; @@ -347,4 +346,4 @@ libgnunet_plugin_gnsrecord_credential_done (void *cls) return NULL; } -/* end of plugin_gnsrecord_credential.c */ +/* end of plugin_gnsrecord_abd.c */ diff --git a/src/credential/plugin_rest_credential.c b/src/abd/plugin_rest_credential.c index 513ddfff9..513ddfff9 100644 --- a/src/credential/plugin_rest_credential.c +++ b/src/abd/plugin_rest_credential.c diff --git a/src/abd/test_abd_bi_and.sh b/src/abd/test_abd_bi_and.sh new file mode 100755 index 000000000..b32313636 --- /dev/null +++ b/src/abd/test_abd_bi_and.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash +trap "gnunet-arm -e -c test_abd_lookup.conf" SIGINT + +LOCATION=$(which gnunet-config) +if [ -z $LOCATION ] +then + LOCATION="gnunet-config" +fi +$LOCATION --version 1> /dev/null +if test $? != 0 +then + echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" + exit 77 +fi + +rm -rf `gnunet-config -c test_abd_lookup.conf -s PATHS -o GNUNET_HOME -f` + + + + +which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" +gnunet-arm -s -c test_abd_lookup.conf + +gnunet-identity -C a -c test_abd_lookup.conf +gnunet-identity -C b -c test_abd_lookup.conf +gnunet-identity -C c -c test_abd_lookup.conf +gnunet-identity -C d -c test_abd_lookup.conf +gnunet-identity -C e -c test_abd_lookup.conf +gnunet-identity -C f -c test_abd_lookup.conf +gnunet-identity -C g -c test_abd_lookup.conf +gnunet-identity -C h -c test_abd_lookup.conf +AKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep a | awk '{print $3}') +BKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep b | awk '{print $3}') +CKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep c | awk '{print $3}') +DKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep d | awk '{print $3}') +EKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep e | awk '{print $3}') +FKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep f | awk '{print $3}') +GKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep g | awk '{print $3}') +HKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep h | awk '{print $3}') +gnunet-identity -d + +# (1) (A.a) <- B.b +# (2) (B.b) <- C.c AND G.g +# (3) C.c <- (D.D) +# (4) D.d <- (E.e) +# (5) E.e <- (F) priv +# (6) (G.g) <- H.h +# (7) H.h <- (F) priv + +# BIDIRECTIONAL +gnunet-abd --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_abd_lookup.conf +gnunet-namestore -D -z a +gnunet-abd --createIssuerSide --ego=b --attribute="b" --subject="$CKEY c, $GKEY g" --ttl=5m -c test_abd_lookup.conf +gnunet-namestore -D -z b +gnunet-abd --createIssuerSide --ego=g --attribute="g" --subject="$HKEY h" --ttl=5m -c test_abd_lookup.conf +gnunet-namestore -D -z b + +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=c --attribute="c" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=d --import="$SIGNED" +gnunet-namestore -D -z d +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=d --attribute="d" --subject="$EKEY e" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=e --import="$SIGNED" +gnunet-namestore -D -z e +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=e --attribute="e" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=f --import="$SIGNED" --private +gnunet-namestore -D -z f +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=h --attribute="h" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=f --import="$SIGNED" --private +gnunet-namestore -D -z h + +# Starting to resolve +echo "+++ Starting to Resolve +++" + +DELS=`$DO_TIMEOUT gnunet-abd --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_abd_lookup.conf | paste -d, -s - -` +echo $DELS +echo gnunet-abd --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_abd_lookup.conf +gnunet-abd --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_abd_lookup.conf + +RES=$? + +# Cleanup properly +gnunet-namestore -z a -d -n "a" -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z b -d -n "b" -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z g -d -n "g" -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z d -d -n "@" -t DEL -c test_abd_lookup.conf +gnunet-namestore -z e -d -n "@" -t DEL -c test_abd_lookup.conf +gnunet-namestore -z f -d -n "@" -t DEL -c test_abd_lookup.conf + +gnunet-arm -e -c test_abd_lookup.conf + +if [ "$RES" == 0 ] +then + exit 0 +else + echo "FAIL: Failed to verify credential." + exit 1 +fi + diff --git a/src/abd/test_abd_bi_and2.sh b/src/abd/test_abd_bi_and2.sh new file mode 100755 index 000000000..8d1601ef4 --- /dev/null +++ b/src/abd/test_abd_bi_and2.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash +trap "gnunet-arm -e -c test_abd_lookup.conf" SIGINT + +LOCATION=$(which gnunet-config) +if [ -z $LOCATION ] +then + LOCATION="gnunet-config" +fi +$LOCATION --version 1> /dev/null +if test $? != 0 +then + echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" + exit 77 +fi + +rm -rf `gnunet-config -c test_abd_lookup.conf -s PATHS -o GNUNET_HOME -f` + + + + +which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" +gnunet-arm -s -c test_abd_lookup.conf + +gnunet-identity -C a -c test_abd_lookup.conf +gnunet-identity -C b -c test_abd_lookup.conf +gnunet-identity -C c -c test_abd_lookup.conf +gnunet-identity -C d -c test_abd_lookup.conf +gnunet-identity -C e -c test_abd_lookup.conf +gnunet-identity -C f -c test_abd_lookup.conf +gnunet-identity -C g -c test_abd_lookup.conf +gnunet-identity -C h -c test_abd_lookup.conf +AKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep a | awk '{print $3}') +BKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep b | awk '{print $3}') +CKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep c | awk '{print $3}') +DKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep d | awk '{print $3}') +EKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep e | awk '{print $3}') +FKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep f | awk '{print $3}') +GKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep g | awk '{print $3}') +HKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep h | awk '{print $3}') +gnunet-identity -d + +# (1) (A.a) <- B.b +# (2) (B.b) <- C.c AND G.g +# (3) C.c <- (D.D) +# (4) D.d <- (E.e) +# (5) E.e <- (F) priv +# (6) G.g <- (F) priv + +# BIDIRECTIONAL +gnunet-abd --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_abd_lookup.conf +gnunet-namestore -D -z a +gnunet-abd --createIssuerSide --ego=b --attribute="b" --subject="$CKEY c, $GKEY g" --ttl=5m -c test_abd_lookup.conf +gnunet-namestore -D -z b + +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=c --attribute="c" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=d --import="$SIGNED" +gnunet-namestore -D -z d +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=d --attribute="d" --subject="$EKEY e" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=e --import="$SIGNED" +gnunet-namestore -D -z e +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=e --attribute="e" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=f --import="$SIGNED" --private +gnunet-namestore -D -z f +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=g --attribute="g" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=f --import="$SIGNED" --private +gnunet-namestore -D -z h + +# Starting to resolve +echo "+++ Starting to Resolve +++" + +DELS=`$DO_TIMEOUT gnunet-abd --collect --issuer=$AKEY --attribute="a" --ego=f -c test_abd_lookup.conf | paste -d, -s - -` +echo $DELS +echo gnunet-abd --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_abd_lookup.conf +gnunet-abd --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_abd_lookup.conf + +RES=$? + +# Cleanup properly +gnunet-namestore -z a -d -n "a" -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z b -d -n "b" -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z d -d -n "@" -t DEL -c test_abd_lookup.conf +gnunet-namestore -z e -d -n "@" -t DEL -c test_abd_lookup.conf +gnunet-namestore -z f -d -n "@" -t DEL -c test_abd_lookup.conf + +gnunet-arm -e -c test_abd_lookup.conf + +if [ "$RES" == 0 ] +then + exit 0 +else + echo "FAIL: Failed to verify credential." + exit 1 +fi + diff --git a/src/abd/test_abd_bi_and3.sh b/src/abd/test_abd_bi_and3.sh new file mode 100755 index 000000000..cde2a020b --- /dev/null +++ b/src/abd/test_abd_bi_and3.sh @@ -0,0 +1,96 @@ +#!/usr/bin/env bash +trap "gnunet-arm -e -c test_abd_lookup.conf" SIGINT + +LOCATION=$(which gnunet-config) +if [ -z $LOCATION ] +then + LOCATION="gnunet-config" +fi +$LOCATION --version 1> /dev/null +if test $? != 0 +then + echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" + exit 77 +fi + +rm -rf `gnunet-config -c test_abd_lookup.conf -s PATHS -o GNUNET_HOME -f` + + + +which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" +gnunet-arm -s -c test_abd_lookup.conf + +gnunet-identity -C a -c test_abd_lookup.conf +gnunet-identity -C b -c test_abd_lookup.conf +gnunet-identity -C c -c test_abd_lookup.conf +gnunet-identity -C d -c test_abd_lookup.conf +gnunet-identity -C e -c test_abd_lookup.conf +gnunet-identity -C f -c test_abd_lookup.conf +gnunet-identity -C g -c test_abd_lookup.conf +gnunet-identity -C h -c test_abd_lookup.conf +AKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep a | awk '{print $3}') +BKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep b | awk '{print $3}') +CKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep c | awk '{print $3}') +DKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep d | awk '{print $3}') +EKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep e | awk '{print $3}') +FKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep f | awk '{print $3}') +GKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep g | awk '{print $3}') +HKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep h | awk '{print $3}') +gnunet-identity -d + +# (1) (A.a) <- B.b +# (2) (B.b) <- C.c AND G.g +# (3) C.c <- (D.d) +# (4) D.d <- (E.e) +# (5) E.e <- (F) priv +# (6) G.g <- (H.h) +# (7) H.h <- (F) priv + +# BIDIRECTIONAL +gnunet-abd --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_abd_lookup.conf +gnunet-namestore -D -z a +gnunet-abd --createIssuerSide --ego=b --attribute="b" --subject="$CKEY c, $GKEY g" --ttl=5m -c test_abd_lookup.conf +gnunet-namestore -D -z b + +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=c --attribute="c" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=d --import="$SIGNED" +gnunet-namestore -D -z d +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=d --attribute="d" --subject="$EKEY e" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=e --import="$SIGNED" +gnunet-namestore -D -z e +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=g --attribute="g" --subject="$HKEY h" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=h --import="$SIGNED" +gnunet-namestore -D -z h +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=e --attribute="e" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=f --import="$SIGNED" --private +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=h --attribute="h" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=f --import="$SIGNED" --private +gnunet-namestore -D -z f + +# Starting to resolve +echo "+++ Starting to Resolve +++" + +DELS=`$DO_TIMEOUT gnunet-abd --collect --issuer=$AKEY --attribute="a" --ego=f -c test_abd_lookup.conf | paste -d, -s - -` +echo $DELS +echo gnunet-abd --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_abd_lookup.conf +gnunet-abd --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_abd_lookup.conf + +RES=$? + +# Cleanup properly +gnunet-namestore -z a -d -n "a" -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z b -d -n "b" -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z d -d -n "@" -t DEL -c test_abd_lookup.conf +gnunet-namestore -z e -d -n "@" -t DEL -c test_abd_lookup.conf +gnunet-namestore -z f -d -n "@" -t DEL -c test_abd_lookup.conf +gnunet-namestore -z h -d -n "@" -t DEL -c test_abd_lookup.conf + +gnunet-arm -e -c test_abd_lookup.conf + +if [ "$RES" == 0 ] +then + exit 0 +else + echo "FAIL: Failed to verify credential." + exit 1 +fi diff --git a/src/abd/test_abd_bi_and4.sh b/src/abd/test_abd_bi_and4.sh new file mode 100755 index 000000000..e8cd6efd6 --- /dev/null +++ b/src/abd/test_abd_bi_and4.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash +trap "gnunet-arm -e -c test_abd_lookup.conf" SIGINT + +LOCATION=$(which gnunet-config) +if [ -z $LOCATION ] +then + LOCATION="gnunet-config" +fi +$LOCATION --version 1> /dev/null +if test $? != 0 +then + echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" + exit 77 +fi + +rm -rf `gnunet-config -c test_abd_lookup.conf -s PATHS -o GNUNET_HOME -f` + + + + +which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" +gnunet-arm -s -c test_abd_lookup.conf + +gnunet-identity -C a -c test_abd_lookup.conf +gnunet-identity -C b -c test_abd_lookup.conf +gnunet-identity -C c -c test_abd_lookup.conf +gnunet-identity -C d -c test_abd_lookup.conf +gnunet-identity -C e -c test_abd_lookup.conf +gnunet-identity -C f -c test_abd_lookup.conf +gnunet-identity -C g -c test_abd_lookup.conf +gnunet-identity -C h -c test_abd_lookup.conf +AKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep a | awk '{print $3}') +BKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep b | awk '{print $3}') +CKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep c | awk '{print $3}') +DKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep d | awk '{print $3}') +EKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep e | awk '{print $3}') +FKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep f | awk '{print $3}') +GKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep g | awk '{print $3}') +HKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep h | awk '{print $3}') +gnunet-identity -d + +# (1) (A.a) <- B.b +# (2) (B.b) <- C.c AND G.g +# (3) C.c <- (F) priv +# (4) G.g <- (F) priv + +# BIDIRECTIONAL +gnunet-abd --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_abd_lookup.conf +gnunet-namestore -D -z a +gnunet-abd --createIssuerSide --ego=b --attribute="b" --subject="$CKEY c, $GKEY g" --ttl=5m -c test_abd_lookup.conf +gnunet-namestore -D -z b + +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=g --attribute="g" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=f --import="$SIGNED" --private +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=c --attribute="c" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=f --import="$SIGNED" --private +gnunet-namestore -D -z f + +# Starting to resolve +echo "+++ Starting to Resolve +++" + +DELS=`$DO_TIMEOUT gnunet-abd --collect --issuer=$AKEY --attribute="a" --ego=f --backward -c test_abd_lookup.conf | paste -d, -s - -` +echo $DELS +echo gnunet-abd --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --backward -c test_abd_lookup.conf +gnunet-abd --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --backward -c test_abd_lookup.conf + +RES=$? + +# Cleanup properly +gnunet-namestore -z a -d -n "a" -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z b -d -n "b" -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z f -d -n "@" -t DEL -c test_abd_lookup.conf + +gnunet-arm -e -c test_abd_lookup.conf + +if [ "$RES" == 0 ] +then + exit 0 +else + echo "FAIL: Failed to verify credential." + exit 1 +fi + diff --git a/src/abd/test_abd_bi_bw.sh b/src/abd/test_abd_bi_bw.sh new file mode 100755 index 000000000..6b0e51722 --- /dev/null +++ b/src/abd/test_abd_bi_bw.sh @@ -0,0 +1,87 @@ +#!/usr/bin/env bash +trap "gnunet-arm -e -c test_abd_lookup.conf" SIGINT + +LOCATION=$(which gnunet-config) +if [ -z $LOCATION ] +then + LOCATION="gnunet-config" +fi +$LOCATION --version 1> /dev/null +if test $? != 0 +then + echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" + exit 77 +fi + +rm -rf `gnunet-config -c test_abd_lookup.conf -s PATHS -o GNUNET_HOME -f` + + + + +which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" +gnunet-arm -s -c test_abd_lookup.conf + +gnunet-identity -C a -c test_abd_lookup.conf +gnunet-identity -C b -c test_abd_lookup.conf +gnunet-identity -C c -c test_abd_lookup.conf +gnunet-identity -C d -c test_abd_lookup.conf +gnunet-identity -C e -c test_abd_lookup.conf +gnunet-identity -C f -c test_abd_lookup.conf +gnunet-identity -C g -c test_abd_lookup.conf +AKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep a | awk '{print $3}') +BKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep b | awk '{print $3}') +CKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep c | awk '{print $3}') +DKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep d | awk '{print $3}') +EKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep e | awk '{print $3}') +FKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep f | awk '{print $3}') +GKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep g | awk '{print $3}') +gnunet-identity -d + +# (1) (A.a) <- B.b +# (2) (B.b) <- C.c +# (3) C.c <- (D.D) +# (4) D.d <- (E.e) +# (5) E.e <- (F) + +# BIDIRECTIONAL +gnunet-abd --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_abd_lookup.conf +gnunet-namestore -D -z a +gnunet-abd --createIssuerSide --ego=b --attribute="b" --subject="$CKEY c" --ttl=5m -c test_abd_lookup.conf +gnunet-namestore -D -z b + +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=c --attribute="c" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=d --import="$SIGNED" +gnunet-namestore -D -z d +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=d --attribute="d" --subject="$EKEY e" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=e --import="$SIGNED" +gnunet-namestore -D -z e +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=e --attribute="e" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=f --import="$SIGNED" --private +gnunet-namestore -D -z f + +# Starting to resolve +echo "+++ Starting to Resolve +++" + +DELS=`$DO_TIMEOUT gnunet-abd --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_abd_lookup.conf | paste -d, -s - -` +echo $DELS +echo gnunet-abd --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_abd_lookup.conf +gnunet-abd --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_abd_lookup.conf + +RES=$? + +# Cleanup properly +gnunet-namestore -z a -d -n "a" -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z b -d -n "b" -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z d -d -n "@" -t DEL -c test_abd_lookup.conf +gnunet-namestore -z e -d -n "@" -t DEL -c test_abd_lookup.conf +gnunet-namestore -z f -d -n "@" -t DEL -c test_abd_lookup.conf + +gnunet-arm -e -c test_abd_lookup.conf + +if [ "$RES" == 0 ] +then + exit 0 +else + echo "FAIL: Failed to verify credential." + exit 1 +fi diff --git a/src/abd/test_abd_bi_bw_link.sh b/src/abd/test_abd_bi_bw_link.sh new file mode 100755 index 000000000..f60f78827 --- /dev/null +++ b/src/abd/test_abd_bi_bw_link.sh @@ -0,0 +1,92 @@ +#!/usr/bin/env bash +trap "gnunet-arm -e -c test_abd_lookup.conf" SIGINT + +LOCATION=$(which gnunet-config) +if [ -z $LOCATION ] +then + LOCATION="gnunet-config" +fi +$LOCATION --version 1> /dev/null +if test $? != 0 +then + echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" + exit 77 +fi + +rm -rf `gnunet-config -c test_abd_lookup.conf -s PATHS -o GNUNET_HOME -f` + + + + +which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" +gnunet-arm -s -c test_abd_lookup.conf + +gnunet-identity -C a -c test_abd_lookup.conf +gnunet-identity -C b -c test_abd_lookup.conf +gnunet-identity -C c -c test_abd_lookup.conf +gnunet-identity -C d -c test_abd_lookup.conf +gnunet-identity -C e -c test_abd_lookup.conf +gnunet-identity -C f -c test_abd_lookup.conf +gnunet-identity -C g -c test_abd_lookup.conf +AKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep a | awk '{print $3}') +BKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep b | awk '{print $3}') +CKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep c | awk '{print $3}') +DKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep d | awk '{print $3}') +EKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep e | awk '{print $3}') +FKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep f | awk '{print $3}') +GKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep g | awk '{print $3}') +gnunet-identity -d + +# (1) (A.a) <- B.b +# (2) (B.b) <- G.g.c +# (3) (G.g) <- C +# (3) C.c <- (D.D) +# (4) D.d <- (E.e) +# (5) E.e <- (F) + +# BIDIRECTIONAL +gnunet-abd --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_abd_lookup.conf +gnunet-namestore -D -z a +gnunet-abd --createIssuerSide --ego=b --attribute="b" --subject="$GKEY g.c" --ttl=5m -c test_abd_lookup.conf +gnunet-namestore -D -z b +gnunet-abd --createIssuerSide --ego=g --attribute="g" --subject="$CKEY" --ttl=5m -c test_abd_lookup.conf +gnunet-namestore -D -z b + +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=c --attribute="c" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=d --import="$SIGNED" +gnunet-namestore -D -z d +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=d --attribute="d" --subject="$EKEY e" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=e --import="$SIGNED" +gnunet-namestore -D -z e +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=e --attribute="e" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=f --import="$SIGNED" --private +gnunet-namestore -D -z f + +# Starting to resolve +echo "+++ Starting to Resolve +++" + +DELS=`$DO_TIMEOUT gnunet-abd --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_abd_lookup.conf | paste -d, -s - -` +echo $DELS +echo gnunet-abd --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_abd_lookup.conf +gnunet-abd --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_abd_lookup.conf + +RES=$? + +# Cleanup properly +gnunet-namestore -z a -d -n "a" -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z b -d -n "b" -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z g -d -n "g" -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z d -d -n "@" -t DEL -c test_abd_lookup.conf +gnunet-namestore -z e -d -n "@" -t DEL -c test_abd_lookup.conf +gnunet-namestore -z f -d -n "@" -t DEL -c test_abd_lookup.conf + +gnunet-arm -e -c test_abd_lookup.conf + +if [ "$RES" == 0 ] +then + exit 0 +else + echo "FAIL: Failed to verify credential." + exit 1 +fi + diff --git a/src/abd/test_abd_bi_bw_link2.sh b/src/abd/test_abd_bi_bw_link2.sh new file mode 100755 index 000000000..b0fb49b8e --- /dev/null +++ b/src/abd/test_abd_bi_bw_link2.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env bash +trap "gnunet-arm -e -c test_abd_lookup.conf" SIGINT + +LOCATION=$(which gnunet-config) +if [ -z $LOCATION ] +then + LOCATION="gnunet-config" +fi +$LOCATION --version 1> /dev/null +if test $? != 0 +then + echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" + exit 77 +fi + +rm -rf `gnunet-config -c test_abd_lookup.conf -s PATHS -o GNUNET_HOME -f` + + + + +which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" +gnunet-arm -s -c test_abd_lookup.conf + +gnunet-identity -C a -c test_abd_lookup.conf +gnunet-identity -C b -c test_abd_lookup.conf +gnunet-identity -C c -c test_abd_lookup.conf +gnunet-identity -C d -c test_abd_lookup.conf +gnunet-identity -C e -c test_abd_lookup.conf +gnunet-identity -C f -c test_abd_lookup.conf +gnunet-identity -C g -c test_abd_lookup.conf +AKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep a | awk '{print $3}') +BKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep b | awk '{print $3}') +CKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep c | awk '{print $3}') +DKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep d | awk '{print $3}') +EKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep e | awk '{print $3}') +FKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep f | awk '{print $3}') +GKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep g | awk '{print $3}') +gnunet-identity -d + +# (1) (A.a) <- B.b +# (2) (B.b) <- G.g.c +# (3) G.g <- (C) +# (3) C.c <- (D.d) +# (4) D.d <- (E.e) +# (5) E.e <- (F) + +# BIDIRECTIONAL +gnunet-abd --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_abd_lookup.conf +gnunet-namestore -D -z a +gnunet-abd --createIssuerSide --ego=b --attribute="b" --subject="$GKEY g.c" --ttl=5m -c test_abd_lookup.conf +gnunet-namestore -D -z b + +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=g --attribute="g" --subject="$CKEY" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=c --import="$SIGNED" +gnunet-namestore -D -z c +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=c --attribute="c" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=d --import="$SIGNED" +gnunet-namestore -D -z d +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=d --attribute="d" --subject="$EKEY e" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=e --import="$SIGNED" +gnunet-namestore -D -z e +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=e --attribute="e" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=f --import="$SIGNED" --private +gnunet-namestore -D -z f + +# Starting to resolve +echo "+++ Starting to Resolve +++" + +DELS=`$DO_TIMEOUT gnunet-abd --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_abd_lookup.conf | paste -d, -s - -` +echo $DELS +echo gnunet-abd --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_abd_lookup.conf +gnunet-abd --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_abd_lookup.conf + +RES=$? + +# Cleanup properly +gnunet-namestore -z a -d -n "a" -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z b -d -n "b" -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z c -d -n "@" -t DEL -c test_abd_lookup.conf +gnunet-namestore -z d -d -n "@" -t DEL -c test_abd_lookup.conf +gnunet-namestore -z e -d -n "@" -t DEL -c test_abd_lookup.conf +gnunet-namestore -z f -d -n "@" -t DEL -c test_abd_lookup.conf + +gnunet-arm -e -c test_abd_lookup.conf + +if [ "$RES" == 0 ] +then + exit 0 +else + echo "FAIL: Failed to verify credential." + exit 1 +fi + diff --git a/src/abd/test_abd_bi_fw.sh b/src/abd/test_abd_bi_fw.sh new file mode 100755 index 000000000..75a940fbe --- /dev/null +++ b/src/abd/test_abd_bi_fw.sh @@ -0,0 +1,92 @@ +#!/usr/bin/env bash +trap "gnunet-arm -e -c test_abd_lookup.conf" SIGINT + +LOCATION=$(which gnunet-config) +if [ -z $LOCATION ] +then + LOCATION="gnunet-config" +fi +$LOCATION --version 1> /dev/null +if test $? != 0 +then + echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" + exit 77 +fi + +rm -rf `gnunet-config -c test_abd_lookup.conf -s PATHS -o GNUNET_HOME -f` + + + + +which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" +gnunet-arm -s -c test_abd_lookup.conf + +gnunet-identity -C a -c test_abd_lookup.conf +gnunet-identity -C b -c test_abd_lookup.conf +gnunet-identity -C c -c test_abd_lookup.conf +gnunet-identity -C d -c test_abd_lookup.conf +gnunet-identity -C e -c test_abd_lookup.conf +gnunet-identity -C f -c test_abd_lookup.conf +gnunet-identity -C g -c test_abd_lookup.conf +AKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep a | awk '{print $3}') +BKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep b | awk '{print $3}') +CKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep c | awk '{print $3}') +DKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep d | awk '{print $3}') +EKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep e | awk '{print $3}') +FKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep f | awk '{print $3}') +GKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep g | awk '{print $3}') +gnunet-identity -d + +# (1) (A.a) <- B.b +# (2) (B.b) <- C.c +# (3) C.c <- (D.D) +# (4) D.d <- (E.e) +# (5) E.e <- (F.f) +# (6) F.f <- (G) + +# BIDIRECTIONAL +gnunet-abd --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_abd_lookup.conf +gnunet-namestore -D -z a +gnunet-abd --createIssuerSide --ego=b --attribute="b" --subject="$CKEY c" --ttl=5m -c test_abd_lookup.conf +gnunet-namestore -D -z b + +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=c --attribute="c" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=d --import="$SIGNED" +gnunet-namestore -D -z d +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=d --attribute="d" --subject="$EKEY e" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=e --import="$SIGNED" +gnunet-namestore -D -z e +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=e --attribute="e" --subject="$FKEY f" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=f --import="$SIGNED" +gnunet-namestore -D -z f +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=f --attribute="f" --subject="$GKEY" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=g --import="$SIGNED" --private +gnunet-namestore -D -z g + +# Starting to resolve +echo "+++ Starting to Resolve +++" + +DELS=`$DO_TIMEOUT gnunet-abd --collect --issuer=$AKEY --attribute="a" --ego=g --forward --backward -c test_abd_lookup.conf | paste -d, -s - -` +echo $DELS +echo gnunet-abd --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate=\'$DELS\' --forward --backward -c test_abd_lookup.conf +gnunet-abd --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate="$DELS" --forward --backward -c test_abd_lookup.conf + +RES=$? + +# Cleanup properly +gnunet-namestore -z a -d -n "a" -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z b -d -n "b" -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z d -d -n "@" -t DEL -c test_abd_lookup.conf +gnunet-namestore -z e -d -n "@" -t DEL -c test_abd_lookup.conf +gnunet-namestore -z f -d -n "@" -t DEL -c test_abd_lookup.conf +gnunet-namestore -z g -d -n "@" -t DEL -c test_abd_lookup.conf + +gnunet-arm -e -c test_abd_lookup.conf + +if [ "$RES" == 0 ] +then + exit 0 +else + echo "FAIL: Failed to verify credential." + exit 1 +fi diff --git a/src/credential/test_credential_defaults.conf b/src/abd/test_abd_defaults.conf index 39f82ad16..7b4cb576d 100644 --- a/src/credential/test_credential_defaults.conf +++ b/src/abd/test_abd_defaults.conf @@ -1,7 +1,7 @@ @INLINE@ ../../contrib/conf/gnunet/no_forcestart.conf [PATHS] -GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-credential-testing/ +GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-abd-testing/ [namestore-sqlite] FILENAME = $GNUNET_TEST_HOME/namestore/sqlite_test.db diff --git a/src/abd/test_abd_issue.sh b/src/abd/test_abd_issue.sh new file mode 100755 index 000000000..8076aa921 --- /dev/null +++ b/src/abd/test_abd_issue.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +trap "gnunet-arm -e -c test_abd_lookup.conf" SIGINT + +LOCATION=$(which gnunet-config) +if [ -z $LOCATION ] +then + LOCATION="gnunet-config" +fi +$LOCATION --version 1> /dev/null +if test $? != 0 +then + echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" + exit 77 +fi + +rm -rf `gnunet-config -c test_abd_lookup.conf -s PATHS -o GNUNET_HOME -f` + +# (1) PKEY1.user -> PKEY2.resu.user +# (2) PKEY2.resu -> PKEY3 +# (3) PKEY3.user -> PKEY4 + + +which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" + +TEST_ATTR="test" +gnunet-arm -s -c test_abd_lookup.conf +gnunet-identity -C testissuer -c test_abd_lookup.conf +gnunet-identity -C testsubject -c test_abd_lookup.conf +SUBJECT_KEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep testsubject | awk '{print $3}') +ISSUER_KEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep testissuer | awk '{print $3}') + +# Get abd and store it with subject (3) +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=testissuer --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --ttl="2019-12-12 10:00:00" -c test_abd_lookup.conf` + +STATUS=$? + +if test $? != 0 +then + echo "Error issuing..." + exit 1 +fi +#Try import +$DO_TIMEOUT gnunet-abd --createSubjectSide --ego=testsubject --import="$SIGNED" --private -c test_abd_lookup.conf +RES=$? +gnunet-arm -e -c test_abd_lookup.conf +exit $RES diff --git a/src/credential/test_credential_lookup.conf b/src/abd/test_abd_lookup.conf index 9cd16605d..4072ba23b 100644 --- a/src/credential/test_credential_lookup.conf +++ b/src/abd/test_abd_lookup.conf @@ -1,7 +1,7 @@ -@INLINE@ test_credential_defaults.conf +@INLINE@ test_abd_defaults.conf [PATHS] -GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-credential-peer-1/ +GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-abd-peer-1/ [dht] START_ON_DEMAND = YES @@ -9,7 +9,7 @@ START_ON_DEMAND = YES [transport] PLUGINS = -[credential] +[abd] START_ON_DEMAND = YES #PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/credlog diff --git a/src/abd/test_abd_own.sh b/src/abd/test_abd_own.sh new file mode 100755 index 000000000..f4780ea90 --- /dev/null +++ b/src/abd/test_abd_own.sh @@ -0,0 +1,140 @@ +#!/usr/bin/env bash +trap "gnunet-arm -e -c test_abd_lookup.conf" SIGINT + +LOCATION=$(which gnunet-config) +if [ -z $LOCATION ] +then + LOCATION="gnunet-config" +fi +$LOCATION --version 1> /dev/null +if test $? != 0 +then + echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" + exit 77 +fi + +rm -rf `gnunet-config -c test_abd_lookup.conf -s PATHS -o GNUNET_HOME -f` + + + +which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" +gnunet-arm -s -c test_abd_lookup.conf + +gnunet-identity -C a -c test_abd_lookup.conf +gnunet-identity -C d -c test_abd_lookup.conf +gnunet-identity -C e -c test_abd_lookup.conf +gnunet-identity -C f -c test_abd_lookup.conf +gnunet-identity -C g -c test_abd_lookup.conf +AKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep a | awk '{print $3}') +DKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep d | awk '{print $3}') +EKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep e | awk '{print $3}') +FKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep f | awk '{print $3}') +GKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep g | awk '{print $3}') + +############################################################################################ +# (1) EPub.discount <- EOrg.preferred +# (2) EOrg.preferred <- StateU.student +# (3) StateU.student <- RegistrarB.student +# (4) RegistrarB.student <- Alice + +gnunet-identity -C epub -c test_abd_lookup.conf +gnunet-identity -C eorg -c test_abd_lookup.conf +gnunet-identity -C stateu -c test_abd_lookup.conf +gnunet-identity -C registrarb -c test_abd_lookup.conf +gnunet-identity -C alice -c test_abd_lookup.conf + +EPUB_KEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep epub | awk '{print $3}') +EORG_KEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep eorg | awk '{print $3}') +STATEU_KEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep stateu | awk '{print $3}') +REGISTRARB_KEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep registrarb | awk '{print $3}') +ALICE_KEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep alice | awk '{print $3}') + + +DISC_ATTR="discount" +PREF_ATTR="preferred" +STATE_STUD_ATTR="student" +REG_STUD_ATTR="student" +END_ATTR="end" + +gnunet-identity -d + +# FORWARD, subject side stored (different constallations) +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=a --attribute="a" --subject="$AKEY b.c" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=a --import="$SIGNED" +gnunet-namestore -D -z a + +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=a --attribute="b" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=d --import="$SIGNED" +gnunet-namestore -D -z d + +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=d --attribute="d" --subject="$EKEY" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=e --import="$SIGNED" +gnunet-namestore -D -z e + +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=e --attribute="c" --subject="$FKEY c" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=f --import="$SIGNED" +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=e --attribute="k" --subject="$FKEY c.k" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=f --import="$SIGNED" +gnunet-namestore -D -z f + +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=f --attribute="c" --subject="$GKEY" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=g --import="$SIGNED" --private +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=a --attribute="c" --subject="$GKEY" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=g --import="$SIGNED" --private +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=d --attribute="h.o" --subject="$GKEY" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=g --import="$SIGNED" +gnunet-namestore -D -z g + + +# BACKWARD, issuer side stored +# (1) EPub assigns the attribute "discount" to all entities that have been assigned "preferred" by EOrg +gnunet-abd --createIssuerSide --ego=epub --attribute=$DISC_ATTR --subject="$EORG_KEY $PREF_ATTR" --ttl=5m -c test_abd_lookup.conf + +# (2) EOrg assigns the attribute "preferred" to all entities that have been assigned "student" by StateU +gnunet-abd --createIssuerSide --ego=eorg --attribute=$PREF_ATTR --subject="$STATEU_KEY $STATE_STUD_ATTR" --ttl=5m -c test_abd_lookup.conf + +# (3) StateU assigns the attribute "student" to all entities that have been asssigned "student" by RegistrarB +gnunet-abd --createIssuerSide --ego=stateu --attribute=$STATE_STUD_ATTR --subject="$REGISTRARB_KEY $REG_STUD_ATTR" --ttl=5m -c test_abd_lookup.conf + +# (4) RegistrarB issues Alice the credential "student" +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=registrarb --attribute="$REG_STUD_ATTR" --subject="$ALICE_KEY" --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=alice --import="$SIGNED" --private + +# Starting to resolve +echo "+++ Starting to Resolve +++" + +# FORWARD +#DELS=`$DO_TIMEOUT gnunet-abd --collect --issuer=$AKEY --attribute="a" --ego=g --forward -c test_abd_lookup.conf | paste -d, -s - -` +#echo $DELS +#echo gnunet-abd --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate=\'$DELS\' --forward -c test_abd_lookup.conf +#RES_DELS=`gnunet-abd --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate="$DELS" --forward -c test_abd_lookup.conf` + +# BACKWARD +DELS=`$DO_TIMEOUT gnunet-abd --collect --issuer=$EPUB_KEY --attribute=$DISC_ATTR --ego=alice --backward -c test_abd_lookup.conf | paste -d, -s - -` +echo $DELS +echo gnunet-abd --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --delegate=\'$DELS\' --backward -c test_abd_lookup.conf +gnunet-abd --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --delegate="$DELS" --backward -c test_abd_lookup.conf + +RES=$? + +# Cleanup properly +gnunet-namestore -z epub -d -n $DISC_ATTR -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z eorg -d -n $PREF_ATTR -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z stateu -d -n $STATE_STUD_ATTR -t ATTR -c test_abd_lookup.conf +#gnunet-namestore -z a -d -n "@" -t DEL -c test_abd_lookup.conf +#gnunet-namestore -z d -d -n "@" -t DEL -c test_abd_lookup.conf +#gnunet-namestore -z e -d -n "@" -t DEL -c test_abd_lookup.conf +#gnunet-namestore -z f -d -n "@" -t DEL -c test_abd_lookup.conf +#gnunet-namestore -z g -d -n "@" -t DEL -c test_abd_lookup.conf + + +gnunet-arm -e -c test_abd_lookup.conf + +if [ "$RES" == 0 ] +then + exit 0 +else + echo "FAIL: Failed to verify credential." + exit 1 +fi + diff --git a/src/abd/test_abd_verify.sh b/src/abd/test_abd_verify.sh new file mode 100755 index 000000000..9ece91c62 --- /dev/null +++ b/src/abd/test_abd_verify.sh @@ -0,0 +1,87 @@ +#!/usr/bin/env bash +trap "gnunet-arm -e -c test_abd_lookup.conf" SIGINT + +LOCATION=$(which gnunet-config) +if [ -z $LOCATION ] +then + LOCATION="gnunet-config" +fi +$LOCATION --version 1> /dev/null +if test $? != 0 +then + echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" + exit 77 +fi + +rm -rf `gnunet-config -c test_abd_lookup.conf -s PATHS -o GNUNET_HOME -f` + +# (1) Service.user -> GNU.project.member +# (2) GNU.project -> GNUnet +# (3) GNUnet.member -> GNUnet.developer +# (4) GNUnet.member -> GNUnet.user +# (5) GNUnet.developer -> Alice + + +which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" +gnunet-arm -s -c test_abd_lookup.conf +gnunet-identity -C service -c test_abd_lookup.conf +gnunet-identity -C alice -c test_abd_lookup.conf +gnunet-identity -C gnu -c test_abd_lookup.conf +gnunet-identity -C gnunet -c test_abd_lookup.conf + +GNU_KEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep gnu | grep -v gnunet | awk '{print $3}') +ALICE_KEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep alice | awk '{print $3}') +GNUNET_KEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep gnunet | awk '{print $3}') +SERVICE_KEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep service | awk '{print $3}') + +USER_ATTR="user" +GNU_PROJECT_ATTR="project" +MEMBER_ATTR="member" +DEVELOPER_ATTR="developer" +DEV_ATTR="developer" +TEST_CREDENTIAL="mygnunetcreds" + +gnunet-identity -d + +# (1) A service assigns the attribute "user" to all entities that have been assigned "member" by entities that werde assigned "project" from GNU +gnunet-abd --createIssuerSide --ego=service --attribute="$USER_ATTR" --subject="$GNU_KEY $GNU_PROJECT_ATTR.$MEMBER_ATTR" --ttl="2019-12-12 10:00:00" -c test_abd_lookup.conf +gnunet-namestore -D -z service + +# (2) GNU recognized GNUnet as a GNU project and delegates the "project" attribute +gnunet-abd --createIssuerSide --ego=gnu --attribute="$GNU_PROJECT_ATTR" --subject="$GNUNET_KEY" --ttl="2019-12-12 10:00:00" -c test_abd_lookup.conf +gnunet-namestore -D -z gnu + +# (3+4) GNUnet assigns the attribute "member" to all entities gnunet has also assigned "developer" or "user" +gnunet-abd --createIssuerSide --ego=gnunet --attribute="$MEMBER_ATTR" --subject="$GNUNET_KEY $DEVELOPER_ATTR" --ttl="2019-12-12 10:00:00" -c test_abd_lookup.conf +gnunet-abd --createIssuerSide --ego=gnunet --attribute="$MEMBER_ATTR" --subject="$GNUNET_KEY $USER_ATTR" --ttl="2019-12-12 10:00:00" -c test_abd_lookup.conf +gnunet-namestore -D -z gnunet + +# (5) GNUnet signes the delegate and Alice stores it +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=gnunet --attribute=$DEV_ATTR --subject=$ALICE_KEY --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=alice --import="$SIGNED" --private +gnunet-namestore -D -z alice + +# Starting to resolve +echo "+++ Starting to Resolve +++" + +DELS=`$DO_TIMEOUT gnunet-abd --collect --issuer=$SERVICE_KEY --attribute=$USER_ATTR --ego=alice --backward -c test_abd_lookup.conf | paste -d, -s - -` +echo $DELS +echo gnunet-abd --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --delegate=\'$DELS\' --backward -c test_abd_lookup.conf +gnunet-abd --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --delegate="$DELS" --backward -c test_abd_lookup.conf + +RES=$? + +# Cleanup properly +gnunet-namestore -z alice -d -n "@" -t DEL -c test_abd_lookup.conf +gnunet-namestore -z gnu -d -n $GNU_PROJECT_ATTR -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z gnunet -d -n $MEMBER_ATTR -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z service -d -n $USER_ATTR -t ATTR -c test_abd_lookup.conf +gnunet-arm -e -c test_abd_lookup.conf + +if [ "$RES" == 0 ] +then + exit 0 +else + echo "FAIL: Failed to verify credential." + exit 1 +fi diff --git a/src/abd/test_abd_verify_and.sh b/src/abd/test_abd_verify_and.sh new file mode 100755 index 000000000..c6287055e --- /dev/null +++ b/src/abd/test_abd_verify_and.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash +trap "gnunet-arm -e -c test_abd_lookup.conf" SIGINT + +LOCATION=$(which gnunet-config) +if [ -z $LOCATION ] +then + LOCATION="gnunet-config" +fi +$LOCATION --version 1> /dev/null +if test $? != 0 +then + echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" + exit 77 +fi + +rm -rf `gnunet-config -c test_abd_lookup.conf -s PATHS -o GNUNET_HOME -f` + +# (1) Service.user -> GNU.project.member +# (2) GNU.project -> GNUnet +# (3) GNUnet.member -> GNUnet.developer AND GNUnet.user +# (4) GNUnet.developer -> Alice + + +which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" +gnunet-arm -s -c test_abd_lookup.conf +gnunet-identity -C service -c test_abd_lookup.conf +gnunet-identity -C alice -c test_abd_lookup.conf +gnunet-identity -C gnu -c test_abd_lookup.conf +gnunet-identity -C gnunet -c test_abd_lookup.conf + +GNU_KEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep gnu | grep -v gnunet | awk '{print $3}') +ALICE_KEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep alice | awk '{print $3}') +GNUNET_KEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep gnunet | awk '{print $3}') +SERVICE_KEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep service | awk '{print $3}') + +USER_ATTR="user" +GNU_PROJECT_ATTR="project" +MEMBER_ATTR="member" +DEVELOPER_ATTR="developer" +DEV_ATTR="developer" + +gnunet-identity -d + +# (1) A service assigns the attribute "user" to all entities that have been assigned "member" by entities that werde assigned "project" from GNU +gnunet-abd --createIssuerSide --ego=service --attribute="$USER_ATTR" --subject="$GNU_KEY $GNU_PROJECT_ATTR.$MEMBER_ATTR" --ttl="2019-12-12 10:00:00" -c test_abd_lookup.conf +gnunet-namestore -D -z service + +# (2) GNU recognized GNUnet as a GNU project and delegates the "project" attribute +gnunet-abd --createIssuerSide --ego=gnu --attribute="$GNU_PROJECT_ATTR" --subject="$GNUNET_KEY" --ttl="2019-12-12 10:00:00" -c test_abd_lookup.conf +gnunet-namestore -D -z gnu + +# (3+4) GNUnet assigns the attribute "member" to all entities gnunet has also assigned "developer" or "user" +gnunet-abd --createIssuerSide --ego=gnunet --attribute="$MEMBER_ATTR" --subject="$GNUNET_KEY $DEVELOPER_ATTR, $GNUNET_KEY $USER_ATTR" --ttl="2019-12-12 10:00:00" -c test_abd_lookup.conf +gnunet-namestore -D -z gnunet + +# (5) GNUnet signes the delegates and Alice stores it +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=gnunet --attribute=$DEV_ATTR --subject=$ALICE_KEY --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=alice --import="$SIGNED" --private +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=gnunet --attribute=$USER_ATTR --subject=$ALICE_KEY --ttl="2019-12-12 10:00:00"` +gnunet-abd --createSubjectSide --ego=alice --import="$SIGNED" --private +gnunet-namestore -D -z alice + +# Starting to resolve +echo "+++ Starting to Resolve +++" + +DELS=`$DO_TIMEOUT gnunet-abd --collect --issuer=$SERVICE_KEY --attribute=$USER_ATTR --ego=alice --backward -c test_abd_lookup.conf | paste -d, -s - -` +echo $DELS +echo gnunet-abd --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --delegate=\'$DELS\' --backward -c test_abd_lookup.conf +gnunet-abd --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --delegate="$DELS" --backward -c test_abd_lookup.conf + +RES=$? + +# Cleanup properly +gnunet-namestore -z alice -d -n "@" -t DEL -c test_abd_lookup.conf +gnunet-namestore -z gnu -d -n $GNU_PROJECT_ATTR -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z gnunet -d -n $MEMBER_ATTR -t ATTR -c test_abd_lookup.conf +gnunet-namestore -z service -d -n $USER_ATTR -t ATTR -c test_abd_lookup.conf +gnunet-arm -e -c test_abd_lookup.conf + +if [ "$RES" == 0 ] +then + exit 0 +else + echo "FAIL: Failed to verify credentials." + exit 1 +fi diff --git a/src/abd/test_abd_verify_simple.sh b/src/abd/test_abd_verify_simple.sh new file mode 100755 index 000000000..e917f8793 --- /dev/null +++ b/src/abd/test_abd_verify_simple.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash +trap "gnunet-arm -e -c test_abd_lookup.conf" SIGINT + +LOCATION=$(which gnunet-config) +if [ -z $LOCATION ] +then + LOCATION="gnunet-config" +fi +$LOCATION --version 1> /dev/null +if test $? != 0 +then + echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" + exit 77 +fi + +rm -rf `gnunet-config -c test_abd_lookup.conf -s PATHS -o GNUNET_HOME -f` + +# (1) Issuer.user -> Subject + + +which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" +gnunet-arm -s -c test_abd_lookup.conf +gnunet-identity -C testissuer -c test_abd_lookup.conf +gnunet-identity -C testsubject -c test_abd_lookup.conf + +TEST_ATTR="user" +SUBJECT_KEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep testsubject | awk '{print $3}') +ISSUER_KEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep testissuer | awk '{print $3}') + +gnunet-identity -d + +# Create delegate (1) +SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=testissuer --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --ttl="2019-12-12 10:00:00" -c test_abd_lookup.conf` +gnunet-abd --createSubjectSide --ego=testsubject --import="$SIGNED" --private +gnunet-namestore -D -z testsubject + +# Starting to resolve +echo "+++ Starting to Resolve +++" + +DELS=`$DO_TIMEOUT gnunet-abd --collect --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --ego=testsubject -c test_abd_lookup.conf | paste -d, -s - -` +echo $DELS +gnunet-abd --verify --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --delegate="$DELS" -c test_abd_lookup.conf + +RES=$? + +# Cleanup properly +gnunet-namestore -z testsubject -d -n "@" -t DEL -c test_abd_lookup.conf +gnunet-arm -e -c test_abd_lookup.conf + +if [ "$RES" == 0 ] +then + exit 0 +else + echo "FAIL: Failed to verify credential." + exit 1 +fi
\ No newline at end of file diff --git a/src/credential/test_credential_collect.sh b/src/abd/test_credential_collect.sh index 0ae063eda..0ae063eda 100755 --- a/src/credential/test_credential_collect.sh +++ b/src/abd/test_credential_collect.sh diff --git a/src/credential/test_credential_collect_rest.sh b/src/abd/test_credential_collect_rest.sh index fe59d9399..fe59d9399 100755 --- a/src/credential/test_credential_collect_rest.sh +++ b/src/abd/test_credential_collect_rest.sh diff --git a/src/credential/test_credential_issue_rest.sh b/src/abd/test_credential_issue_rest.sh index c518c08ec..c518c08ec 100755 --- a/src/credential/test_credential_issue_rest.sh +++ b/src/abd/test_credential_issue_rest.sh diff --git a/src/credential/test_credential_verify_rest.sh b/src/abd/test_credential_verify_rest.sh index 99db5da8a..99db5da8a 100755 --- a/src/credential/test_credential_verify_rest.sh +++ b/src/abd/test_credential_verify_rest.sh diff --git a/src/credential/credential.conf.in b/src/credential/credential.conf.in deleted file mode 100644 index d5a0b1c88..000000000 --- a/src/credential/credential.conf.in +++ /dev/null @@ -1,5 +0,0 @@ -[credential] -BINARY = gnunet-service-credential -UNIXPATH = $GNUNET_USER_RUNTIME_DIR/gnunet-service-credential.sock -RUN_PER_USER = YES -OPTIONS = -L DEBUG diff --git a/src/credential/test_credential_bi_and.sh b/src/credential/test_credential_bi_and.sh deleted file mode 100755 index d52fb5dbe..000000000 --- a/src/credential/test_credential_bi_and.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env bash -trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT - -LOCATION=$(which gnunet-config) -if [ -z $LOCATION ] -then - LOCATION="gnunet-config" -fi -$LOCATION --version 1> /dev/null -if test $? != 0 -then - echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" - exit 77 -fi - -rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` - - - - -which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" -gnunet-arm -s -c test_credential_lookup.conf - -gnunet-identity -C a -c test_credential_lookup.conf -gnunet-identity -C b -c test_credential_lookup.conf -gnunet-identity -C c -c test_credential_lookup.conf -gnunet-identity -C d -c test_credential_lookup.conf -gnunet-identity -C e -c test_credential_lookup.conf -gnunet-identity -C f -c test_credential_lookup.conf -gnunet-identity -C g -c test_credential_lookup.conf -gnunet-identity -C h -c test_credential_lookup.conf -AKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep a | awk '{print $3}') -BKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep b | awk '{print $3}') -CKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep c | awk '{print $3}') -DKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep d | awk '{print $3}') -EKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep e | awk '{print $3}') -FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print $3}') -GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}') -HKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep h | awk '{print $3}') -gnunet-identity -d - -# (1) (A.a) <- B.b -# (2) (B.b) <- C.c AND G.g -# (3) C.c <- (D.D) -# (4) D.d <- (E.e) -# (5) E.e <- (F) priv -# (6) (G.g) <- H.h -# (7) H.h <- (F) priv - -# BIDIRECTIONAL -gnunet-credential --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_credential_lookup.conf -gnunet-namestore -D -z a -gnunet-credential --createIssuerSide --ego=b --attribute="b" --subject="$CKEY c, $GKEY g" --ttl=5m -c test_credential_lookup.conf -gnunet-namestore -D -z b -gnunet-credential --createIssuerSide --ego=g --attribute="g" --subject="$HKEY h" --ttl=5m -c test_credential_lookup.conf -gnunet-namestore -D -z b - -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=c --attribute="c" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=d --import="$SIGNED" -gnunet-namestore -D -z d -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=d --attribute="d" --subject="$EKEY e" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=e --import="$SIGNED" -gnunet-namestore -D -z e -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=e --attribute="e" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=f --import="$SIGNED" --private -gnunet-namestore -D -z f -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=h --attribute="h" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=f --import="$SIGNED" --private -gnunet-namestore -D -z h - -# Starting to resolve -echo "+++ Starting to Resolve +++" - -DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` -echo $DELS -echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf -gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf - -RES=$? - -# Cleanup properly -gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z b -d -n "b" -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z g -d -n "g" -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z d -d -n "@" -t DEL -c test_credential_lookup.conf -gnunet-namestore -z e -d -n "@" -t DEL -c test_credential_lookup.conf -gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf - -gnunet-arm -e -c test_credential_lookup.conf - -if [ "$RES" == 0 ] -then - exit 0 -else - echo "FAIL: Failed to verify credential." - exit 1 -fi - diff --git a/src/credential/test_credential_bi_and2.sh b/src/credential/test_credential_bi_and2.sh deleted file mode 100755 index f076c1c5c..000000000 --- a/src/credential/test_credential_bi_and2.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env bash -trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT - -LOCATION=$(which gnunet-config) -if [ -z $LOCATION ] -then - LOCATION="gnunet-config" -fi -$LOCATION --version 1> /dev/null -if test $? != 0 -then - echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" - exit 77 -fi - -rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` - - - - -which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" -gnunet-arm -s -c test_credential_lookup.conf - -gnunet-identity -C a -c test_credential_lookup.conf -gnunet-identity -C b -c test_credential_lookup.conf -gnunet-identity -C c -c test_credential_lookup.conf -gnunet-identity -C d -c test_credential_lookup.conf -gnunet-identity -C e -c test_credential_lookup.conf -gnunet-identity -C f -c test_credential_lookup.conf -gnunet-identity -C g -c test_credential_lookup.conf -gnunet-identity -C h -c test_credential_lookup.conf -AKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep a | awk '{print $3}') -BKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep b | awk '{print $3}') -CKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep c | awk '{print $3}') -DKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep d | awk '{print $3}') -EKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep e | awk '{print $3}') -FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print $3}') -GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}') -HKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep h | awk '{print $3}') -gnunet-identity -d - -# (1) (A.a) <- B.b -# (2) (B.b) <- C.c AND G.g -# (3) C.c <- (D.D) -# (4) D.d <- (E.e) -# (5) E.e <- (F) priv -# (6) G.g <- (F) priv - -# BIDIRECTIONAL -gnunet-credential --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_credential_lookup.conf -gnunet-namestore -D -z a -gnunet-credential --createIssuerSide --ego=b --attribute="b" --subject="$CKEY c, $GKEY g" --ttl=5m -c test_credential_lookup.conf -gnunet-namestore -D -z b - -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=c --attribute="c" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=d --import="$SIGNED" -gnunet-namestore -D -z d -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=d --attribute="d" --subject="$EKEY e" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=e --import="$SIGNED" -gnunet-namestore -D -z e -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=e --attribute="e" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=f --import="$SIGNED" --private -gnunet-namestore -D -z f -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=g --attribute="g" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=f --import="$SIGNED" --private -gnunet-namestore -D -z h - -# Starting to resolve -echo "+++ Starting to Resolve +++" - -DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f -c test_credential_lookup.conf | paste -d, -s - -` -echo $DELS -echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf -gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf - -RES=$? - -# Cleanup properly -gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z b -d -n "b" -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z d -d -n "@" -t DEL -c test_credential_lookup.conf -gnunet-namestore -z e -d -n "@" -t DEL -c test_credential_lookup.conf -gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf - -gnunet-arm -e -c test_credential_lookup.conf - -if [ "$RES" == 0 ] -then - exit 0 -else - echo "FAIL: Failed to verify credential." - exit 1 -fi - diff --git a/src/credential/test_credential_bi_and3.sh b/src/credential/test_credential_bi_and3.sh deleted file mode 100755 index 80dddcc14..000000000 --- a/src/credential/test_credential_bi_and3.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env bash -trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT - -LOCATION=$(which gnunet-config) -if [ -z $LOCATION ] -then - LOCATION="gnunet-config" -fi -$LOCATION --version 1> /dev/null -if test $? != 0 -then - echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" - exit 77 -fi - -rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` - - - -which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" -gnunet-arm -s -c test_credential_lookup.conf - -gnunet-identity -C a -c test_credential_lookup.conf -gnunet-identity -C b -c test_credential_lookup.conf -gnunet-identity -C c -c test_credential_lookup.conf -gnunet-identity -C d -c test_credential_lookup.conf -gnunet-identity -C e -c test_credential_lookup.conf -gnunet-identity -C f -c test_credential_lookup.conf -gnunet-identity -C g -c test_credential_lookup.conf -gnunet-identity -C h -c test_credential_lookup.conf -AKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep a | awk '{print $3}') -BKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep b | awk '{print $3}') -CKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep c | awk '{print $3}') -DKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep d | awk '{print $3}') -EKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep e | awk '{print $3}') -FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print $3}') -GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}') -HKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep h | awk '{print $3}') -gnunet-identity -d - -# (1) (A.a) <- B.b -# (2) (B.b) <- C.c AND G.g -# (3) C.c <- (D.d) -# (4) D.d <- (E.e) -# (5) E.e <- (F) priv -# (6) G.g <- (H.h) -# (7) H.h <- (F) priv - -# BIDIRECTIONAL -gnunet-credential --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_credential_lookup.conf -gnunet-namestore -D -z a -gnunet-credential --createIssuerSide --ego=b --attribute="b" --subject="$CKEY c, $GKEY g" --ttl=5m -c test_credential_lookup.conf -gnunet-namestore -D -z b - -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=c --attribute="c" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=d --import="$SIGNED" -gnunet-namestore -D -z d -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=d --attribute="d" --subject="$EKEY e" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=e --import="$SIGNED" -gnunet-namestore -D -z e -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=g --attribute="g" --subject="$HKEY h" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=h --import="$SIGNED" -gnunet-namestore -D -z h -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=e --attribute="e" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=f --import="$SIGNED" --private -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=h --attribute="h" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=f --import="$SIGNED" --private -gnunet-namestore -D -z f - -# Starting to resolve -echo "+++ Starting to Resolve +++" - -DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f -c test_credential_lookup.conf | paste -d, -s - -` -echo $DELS -echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf -gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf - -RES=$? - -# Cleanup properly -gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z b -d -n "b" -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z d -d -n "@" -t DEL -c test_credential_lookup.conf -gnunet-namestore -z e -d -n "@" -t DEL -c test_credential_lookup.conf -gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf -gnunet-namestore -z h -d -n "@" -t DEL -c test_credential_lookup.conf - -gnunet-arm -e -c test_credential_lookup.conf - -if [ "$RES" == 0 ] -then - exit 0 -else - echo "FAIL: Failed to verify credential." - exit 1 -fi diff --git a/src/credential/test_credential_bi_and4.sh b/src/credential/test_credential_bi_and4.sh deleted file mode 100755 index 18731d5d1..000000000 --- a/src/credential/test_credential_bi_and4.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env bash -trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT - -LOCATION=$(which gnunet-config) -if [ -z $LOCATION ] -then - LOCATION="gnunet-config" -fi -$LOCATION --version 1> /dev/null -if test $? != 0 -then - echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" - exit 77 -fi - -rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` - - - - -which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" -gnunet-arm -s -c test_credential_lookup.conf - -gnunet-identity -C a -c test_credential_lookup.conf -gnunet-identity -C b -c test_credential_lookup.conf -gnunet-identity -C c -c test_credential_lookup.conf -gnunet-identity -C d -c test_credential_lookup.conf -gnunet-identity -C e -c test_credential_lookup.conf -gnunet-identity -C f -c test_credential_lookup.conf -gnunet-identity -C g -c test_credential_lookup.conf -gnunet-identity -C h -c test_credential_lookup.conf -AKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep a | awk '{print $3}') -BKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep b | awk '{print $3}') -CKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep c | awk '{print $3}') -DKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep d | awk '{print $3}') -EKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep e | awk '{print $3}') -FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print $3}') -GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}') -HKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep h | awk '{print $3}') -gnunet-identity -d - -# (1) (A.a) <- B.b -# (2) (B.b) <- C.c AND G.g -# (3) C.c <- (F) priv -# (4) G.g <- (F) priv - -# BIDIRECTIONAL -gnunet-credential --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_credential_lookup.conf -gnunet-namestore -D -z a -gnunet-credential --createIssuerSide --ego=b --attribute="b" --subject="$CKEY c, $GKEY g" --ttl=5m -c test_credential_lookup.conf -gnunet-namestore -D -z b - -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=g --attribute="g" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=f --import="$SIGNED" --private -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=c --attribute="c" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=f --import="$SIGNED" --private -gnunet-namestore -D -z f - -# Starting to resolve -echo "+++ Starting to Resolve +++" - -DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --backward -c test_credential_lookup.conf | paste -d, -s - -` -echo $DELS -echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf -gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --backward -c test_credential_lookup.conf - -RES=$? - -# Cleanup properly -gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z b -d -n "b" -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf - -gnunet-arm -e -c test_credential_lookup.conf - -if [ "$RES" == 0 ] -then - exit 0 -else - echo "FAIL: Failed to verify credential." - exit 1 -fi - diff --git a/src/credential/test_credential_bi_bw.sh b/src/credential/test_credential_bi_bw.sh deleted file mode 100755 index 618fae95f..000000000 --- a/src/credential/test_credential_bi_bw.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env bash -trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT - -LOCATION=$(which gnunet-config) -if [ -z $LOCATION ] -then - LOCATION="gnunet-config" -fi -$LOCATION --version 1> /dev/null -if test $? != 0 -then - echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" - exit 77 -fi - -rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` - - - - -which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" -gnunet-arm -s -c test_credential_lookup.conf - -gnunet-identity -C a -c test_credential_lookup.conf -gnunet-identity -C b -c test_credential_lookup.conf -gnunet-identity -C c -c test_credential_lookup.conf -gnunet-identity -C d -c test_credential_lookup.conf -gnunet-identity -C e -c test_credential_lookup.conf -gnunet-identity -C f -c test_credential_lookup.conf -gnunet-identity -C g -c test_credential_lookup.conf -AKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep a | awk '{print $3}') -BKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep b | awk '{print $3}') -CKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep c | awk '{print $3}') -DKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep d | awk '{print $3}') -EKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep e | awk '{print $3}') -FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print $3}') -GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}') -gnunet-identity -d - -# (1) (A.a) <- B.b -# (2) (B.b) <- C.c -# (3) C.c <- (D.D) -# (4) D.d <- (E.e) -# (5) E.e <- (F) - -# BIDIRECTIONAL -gnunet-credential --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_credential_lookup.conf -gnunet-namestore -D -z a -gnunet-credential --createIssuerSide --ego=b --attribute="b" --subject="$CKEY c" --ttl=5m -c test_credential_lookup.conf -gnunet-namestore -D -z b - -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=c --attribute="c" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=d --import="$SIGNED" -gnunet-namestore -D -z d -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=d --attribute="d" --subject="$EKEY e" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=e --import="$SIGNED" -gnunet-namestore -D -z e -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=e --attribute="e" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=f --import="$SIGNED" --private -gnunet-namestore -D -z f - -# Starting to resolve -echo "+++ Starting to Resolve +++" - -DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` -echo $DELS -echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf -gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf - -RES=$? - -# Cleanup properly -gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z b -d -n "b" -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z d -d -n "@" -t DEL -c test_credential_lookup.conf -gnunet-namestore -z e -d -n "@" -t DEL -c test_credential_lookup.conf -gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf - -gnunet-arm -e -c test_credential_lookup.conf - -if [ "$RES" == 0 ] -then - exit 0 -else - echo "FAIL: Failed to verify credential." - exit 1 -fi diff --git a/src/credential/test_credential_bi_bw_link.sh b/src/credential/test_credential_bi_bw_link.sh deleted file mode 100755 index f002c2141..000000000 --- a/src/credential/test_credential_bi_bw_link.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env bash -trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT - -LOCATION=$(which gnunet-config) -if [ -z $LOCATION ] -then - LOCATION="gnunet-config" -fi -$LOCATION --version 1> /dev/null -if test $? != 0 -then - echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" - exit 77 -fi - -rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` - - - - -which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" -gnunet-arm -s -c test_credential_lookup.conf - -gnunet-identity -C a -c test_credential_lookup.conf -gnunet-identity -C b -c test_credential_lookup.conf -gnunet-identity -C c -c test_credential_lookup.conf -gnunet-identity -C d -c test_credential_lookup.conf -gnunet-identity -C e -c test_credential_lookup.conf -gnunet-identity -C f -c test_credential_lookup.conf -gnunet-identity -C g -c test_credential_lookup.conf -AKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep a | awk '{print $3}') -BKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep b | awk '{print $3}') -CKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep c | awk '{print $3}') -DKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep d | awk '{print $3}') -EKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep e | awk '{print $3}') -FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print $3}') -GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}') -gnunet-identity -d - -# (1) (A.a) <- B.b -# (2) (B.b) <- G.g.c -# (3) (G.g) <- C -# (3) C.c <- (D.D) -# (4) D.d <- (E.e) -# (5) E.e <- (F) - -# BIDIRECTIONAL -gnunet-credential --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_credential_lookup.conf -gnunet-namestore -D -z a -gnunet-credential --createIssuerSide --ego=b --attribute="b" --subject="$GKEY g.c" --ttl=5m -c test_credential_lookup.conf -gnunet-namestore -D -z b -gnunet-credential --createIssuerSide --ego=g --attribute="g" --subject="$CKEY" --ttl=5m -c test_credential_lookup.conf -gnunet-namestore -D -z b - -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=c --attribute="c" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=d --import="$SIGNED" -gnunet-namestore -D -z d -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=d --attribute="d" --subject="$EKEY e" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=e --import="$SIGNED" -gnunet-namestore -D -z e -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=e --attribute="e" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=f --import="$SIGNED" --private -gnunet-namestore -D -z f - -# Starting to resolve -echo "+++ Starting to Resolve +++" - -DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` -echo $DELS -echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf -gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf - -RES=$? - -# Cleanup properly -gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z b -d -n "b" -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z g -d -n "g" -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z d -d -n "@" -t DEL -c test_credential_lookup.conf -gnunet-namestore -z e -d -n "@" -t DEL -c test_credential_lookup.conf -gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf - -gnunet-arm -e -c test_credential_lookup.conf - -if [ "$RES" == 0 ] -then - exit 0 -else - echo "FAIL: Failed to verify credential." - exit 1 -fi - diff --git a/src/credential/test_credential_bi_bw_link2.sh b/src/credential/test_credential_bi_bw_link2.sh deleted file mode 100755 index f6055a7bb..000000000 --- a/src/credential/test_credential_bi_bw_link2.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env bash -trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT - -LOCATION=$(which gnunet-config) -if [ -z $LOCATION ] -then - LOCATION="gnunet-config" -fi -$LOCATION --version 1> /dev/null -if test $? != 0 -then - echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" - exit 77 -fi - -rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` - - - - -which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" -gnunet-arm -s -c test_credential_lookup.conf - -gnunet-identity -C a -c test_credential_lookup.conf -gnunet-identity -C b -c test_credential_lookup.conf -gnunet-identity -C c -c test_credential_lookup.conf -gnunet-identity -C d -c test_credential_lookup.conf -gnunet-identity -C e -c test_credential_lookup.conf -gnunet-identity -C f -c test_credential_lookup.conf -gnunet-identity -C g -c test_credential_lookup.conf -AKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep a | awk '{print $3}') -BKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep b | awk '{print $3}') -CKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep c | awk '{print $3}') -DKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep d | awk '{print $3}') -EKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep e | awk '{print $3}') -FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print $3}') -GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}') -gnunet-identity -d - -# (1) (A.a) <- B.b -# (2) (B.b) <- G.g.c -# (3) G.g <- (C) -# (3) C.c <- (D.d) -# (4) D.d <- (E.e) -# (5) E.e <- (F) - -# BIDIRECTIONAL -gnunet-credential --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_credential_lookup.conf -gnunet-namestore -D -z a -gnunet-credential --createIssuerSide --ego=b --attribute="b" --subject="$GKEY g.c" --ttl=5m -c test_credential_lookup.conf -gnunet-namestore -D -z b - -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=g --attribute="g" --subject="$CKEY" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=c --import="$SIGNED" -gnunet-namestore -D -z c -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=c --attribute="c" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=d --import="$SIGNED" -gnunet-namestore -D -z d -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=d --attribute="d" --subject="$EKEY e" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=e --import="$SIGNED" -gnunet-namestore -D -z e -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=e --attribute="e" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=f --import="$SIGNED" --private -gnunet-namestore -D -z f - -# Starting to resolve -echo "+++ Starting to Resolve +++" - -DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` -echo $DELS -echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf -gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf - -RES=$? - -# Cleanup properly -gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z b -d -n "b" -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z c -d -n "@" -t DEL -c test_credential_lookup.conf -gnunet-namestore -z d -d -n "@" -t DEL -c test_credential_lookup.conf -gnunet-namestore -z e -d -n "@" -t DEL -c test_credential_lookup.conf -gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf - -gnunet-arm -e -c test_credential_lookup.conf - -if [ "$RES" == 0 ] -then - exit 0 -else - echo "FAIL: Failed to verify credential." - exit 1 -fi - diff --git a/src/credential/test_credential_bi_fw.sh b/src/credential/test_credential_bi_fw.sh deleted file mode 100755 index 7cd5e5c52..000000000 --- a/src/credential/test_credential_bi_fw.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env bash -trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT - -LOCATION=$(which gnunet-config) -if [ -z $LOCATION ] -then - LOCATION="gnunet-config" -fi -$LOCATION --version 1> /dev/null -if test $? != 0 -then - echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" - exit 77 -fi - -rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` - - - - -which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" -gnunet-arm -s -c test_credential_lookup.conf - -gnunet-identity -C a -c test_credential_lookup.conf -gnunet-identity -C b -c test_credential_lookup.conf -gnunet-identity -C c -c test_credential_lookup.conf -gnunet-identity -C d -c test_credential_lookup.conf -gnunet-identity -C e -c test_credential_lookup.conf -gnunet-identity -C f -c test_credential_lookup.conf -gnunet-identity -C g -c test_credential_lookup.conf -AKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep a | awk '{print $3}') -BKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep b | awk '{print $3}') -CKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep c | awk '{print $3}') -DKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep d | awk '{print $3}') -EKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep e | awk '{print $3}') -FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print $3}') -GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}') -gnunet-identity -d - -# (1) (A.a) <- B.b -# (2) (B.b) <- C.c -# (3) C.c <- (D.D) -# (4) D.d <- (E.e) -# (5) E.e <- (F.f) -# (6) F.f <- (G) - -# BIDIRECTIONAL -gnunet-credential --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_credential_lookup.conf -gnunet-namestore -D -z a -gnunet-credential --createIssuerSide --ego=b --attribute="b" --subject="$CKEY c" --ttl=5m -c test_credential_lookup.conf -gnunet-namestore -D -z b - -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=c --attribute="c" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=d --import="$SIGNED" -gnunet-namestore -D -z d -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=d --attribute="d" --subject="$EKEY e" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=e --import="$SIGNED" -gnunet-namestore -D -z e -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=e --attribute="e" --subject="$FKEY f" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=f --import="$SIGNED" -gnunet-namestore -D -z f -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=f --attribute="f" --subject="$GKEY" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=g --import="$SIGNED" --private -gnunet-namestore -D -z g - -# Starting to resolve -echo "+++ Starting to Resolve +++" - -DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=g --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` -echo $DELS -echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf -gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf - -RES=$? - -# Cleanup properly -gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z b -d -n "b" -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z d -d -n "@" -t DEL -c test_credential_lookup.conf -gnunet-namestore -z e -d -n "@" -t DEL -c test_credential_lookup.conf -gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf -gnunet-namestore -z g -d -n "@" -t DEL -c test_credential_lookup.conf - -gnunet-arm -e -c test_credential_lookup.conf - -if [ "$RES" == 0 ] -then - exit 0 -else - echo "FAIL: Failed to verify credential." - exit 1 -fi diff --git a/src/credential/test_credential_issue.sh b/src/credential/test_credential_issue.sh deleted file mode 100755 index 3d4b82cf6..000000000 --- a/src/credential/test_credential_issue.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash -trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT - -LOCATION=$(which gnunet-config) -if [ -z $LOCATION ] -then - LOCATION="gnunet-config" -fi -$LOCATION --version 1> /dev/null -if test $? != 0 -then - echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" - exit 77 -fi - -rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` - -# (1) PKEY1.user -> PKEY2.resu.user -# (2) PKEY2.resu -> PKEY3 -# (3) PKEY3.user -> PKEY4 - - -which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" - -TEST_ATTR="test" -gnunet-arm -s -c test_credential_lookup.conf -gnunet-identity -C testissuer -c test_credential_lookup.conf -gnunet-identity -C testsubject -c test_credential_lookup.conf -SUBJECT_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testsubject | awk '{print $3}') -ISSUER_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testissuer | awk '{print $3}') - -# Get credential and store it with subject (3) -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=testissuer --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf` - -STATUS=$? - -if test $? != 0 -then - echo "Error issuing..." - exit 1 -fi -#Try import -$DO_TIMEOUT gnunet-credential --createSubjectSide --ego=testsubject --import="$SIGNED" --private -c test_credential_lookup.conf -RES=$? -gnunet-arm -e -c test_credential_lookup.conf -exit $RES diff --git a/src/credential/test_credential_own.sh b/src/credential/test_credential_own.sh deleted file mode 100755 index 8a94f90e7..000000000 --- a/src/credential/test_credential_own.sh +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/env bash -trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT - -LOCATION=$(which gnunet-config) -if [ -z $LOCATION ] -then - LOCATION="gnunet-config" -fi -$LOCATION --version 1> /dev/null -if test $? != 0 -then - echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" - exit 77 -fi - -rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` - - - -which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" -gnunet-arm -s -c test_credential_lookup.conf - -gnunet-identity -C a -c test_credential_lookup.conf -gnunet-identity -C d -c test_credential_lookup.conf -gnunet-identity -C e -c test_credential_lookup.conf -gnunet-identity -C f -c test_credential_lookup.conf -gnunet-identity -C g -c test_credential_lookup.conf -AKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep a | awk '{print $3}') -DKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep d | awk '{print $3}') -EKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep e | awk '{print $3}') -FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print $3}') -GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}') - -############################################################################################ -# (1) EPub.discount <- EOrg.preferred -# (2) EOrg.preferred <- StateU.student -# (3) StateU.student <- RegistrarB.student -# (4) RegistrarB.student <- Alice - -gnunet-identity -C epub -c test_credential_lookup.conf -gnunet-identity -C eorg -c test_credential_lookup.conf -gnunet-identity -C stateu -c test_credential_lookup.conf -gnunet-identity -C registrarb -c test_credential_lookup.conf -gnunet-identity -C alice -c test_credential_lookup.conf - -EPUB_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep epub | awk '{print $3}') -EORG_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep eorg | awk '{print $3}') -STATEU_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep stateu | awk '{print $3}') -REGISTRARB_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep registrarb | awk '{print $3}') -ALICE_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep alice | awk '{print $3}') - - -DISC_ATTR="discount" -PREF_ATTR="preferred" -STATE_STUD_ATTR="student" -REG_STUD_ATTR="student" -END_ATTR="end" - -gnunet-identity -d - -# FORWARD, subject side stored (different constallations) -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=a --attribute="a" --subject="$AKEY b.c" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=a --import="$SIGNED" -gnunet-namestore -D -z a - -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=a --attribute="b" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=d --import="$SIGNED" -gnunet-namestore -D -z d - -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=d --attribute="d" --subject="$EKEY" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=e --import="$SIGNED" -gnunet-namestore -D -z e - -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=e --attribute="c" --subject="$FKEY c" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=f --import="$SIGNED" -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=e --attribute="k" --subject="$FKEY c.k" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=f --import="$SIGNED" -gnunet-namestore -D -z f - -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=f --attribute="c" --subject="$GKEY" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=g --import="$SIGNED" --private -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=a --attribute="c" --subject="$GKEY" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=g --import="$SIGNED" --private -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=d --attribute="h.o" --subject="$GKEY" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=g --import="$SIGNED" -gnunet-namestore -D -z g - - -# BACKWARD, issuer side stored -# (1) EPub assigns the attribute "discount" to all entities that have been assigned "preferred" by EOrg -gnunet-credential --createIssuerSide --ego=epub --attribute=$DISC_ATTR --subject="$EORG_KEY $PREF_ATTR" --ttl=5m -c test_credential_lookup.conf - -# (2) EOrg assigns the attribute "preferred" to all entities that have been assigned "student" by StateU -gnunet-credential --createIssuerSide --ego=eorg --attribute=$PREF_ATTR --subject="$STATEU_KEY $STATE_STUD_ATTR" --ttl=5m -c test_credential_lookup.conf - -# (3) StateU assigns the attribute "student" to all entities that have been asssigned "student" by RegistrarB -gnunet-credential --createIssuerSide --ego=stateu --attribute=$STATE_STUD_ATTR --subject="$REGISTRARB_KEY $REG_STUD_ATTR" --ttl=5m -c test_credential_lookup.conf - -# (4) RegistrarB issues Alice the credential "student" -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=registrarb --attribute="$REG_STUD_ATTR" --subject="$ALICE_KEY" --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=alice --import="$SIGNED" --private - -# Starting to resolve -echo "+++ Starting to Resolve +++" - -# FORWARD -#DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=g --forward -c test_credential_lookup.conf | paste -d, -s - -` -#echo $DELS -#echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate=\'$DELS\' --forward -c test_credential_lookup.conf -#RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate="$DELS" --forward -c test_credential_lookup.conf` - -# BACKWARD -DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$EPUB_KEY --attribute=$DISC_ATTR --ego=alice --backward -c test_credential_lookup.conf | paste -d, -s - -` -echo $DELS -echo gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf -gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --delegate="$DELS" --backward -c test_credential_lookup.conf - -RES=$? - -# Cleanup properly -gnunet-namestore -z epub -d -n $DISC_ATTR -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z eorg -d -n $PREF_ATTR -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z stateu -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf -#gnunet-namestore -z a -d -n "@" -t DEL -c test_credential_lookup.conf -#gnunet-namestore -z d -d -n "@" -t DEL -c test_credential_lookup.conf -#gnunet-namestore -z e -d -n "@" -t DEL -c test_credential_lookup.conf -#gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf -#gnunet-namestore -z g -d -n "@" -t DEL -c test_credential_lookup.conf - - -gnunet-arm -e -c test_credential_lookup.conf - -if [ "$RES" == 0 ] -then - exit 0 -else - echo "FAIL: Failed to verify credential." - exit 1 -fi - diff --git a/src/credential/test_credential_verify.sh b/src/credential/test_credential_verify.sh deleted file mode 100755 index 38492de8e..000000000 --- a/src/credential/test_credential_verify.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env bash -trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT - -LOCATION=$(which gnunet-config) -if [ -z $LOCATION ] -then - LOCATION="gnunet-config" -fi -$LOCATION --version 1> /dev/null -if test $? != 0 -then - echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" - exit 77 -fi - -rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` - -# (1) Service.user -> GNU.project.member -# (2) GNU.project -> GNUnet -# (3) GNUnet.member -> GNUnet.developer -# (4) GNUnet.member -> GNUnet.user -# (5) GNUnet.developer -> Alice - - -which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" -gnunet-arm -s -c test_credential_lookup.conf -gnunet-identity -C service -c test_credential_lookup.conf -gnunet-identity -C alice -c test_credential_lookup.conf -gnunet-identity -C gnu -c test_credential_lookup.conf -gnunet-identity -C gnunet -c test_credential_lookup.conf - -GNU_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep gnu | grep -v gnunet | awk '{print $3}') -ALICE_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep alice | awk '{print $3}') -GNUNET_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep gnunet | awk '{print $3}') -SERVICE_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep service | awk '{print $3}') - -USER_ATTR="user" -GNU_PROJECT_ATTR="project" -MEMBER_ATTR="member" -DEVELOPER_ATTR="developer" -DEV_ATTR="developer" -TEST_CREDENTIAL="mygnunetcreds" - -gnunet-identity -d - -# (1) A service assigns the attribute "user" to all entities that have been assigned "member" by entities that werde assigned "project" from GNU -gnunet-credential --createIssuerSide --ego=service --attribute="$USER_ATTR" --subject="$GNU_KEY $GNU_PROJECT_ATTR.$MEMBER_ATTR" --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf -gnunet-namestore -D -z service - -# (2) GNU recognized GNUnet as a GNU project and delegates the "project" attribute -gnunet-credential --createIssuerSide --ego=gnu --attribute="$GNU_PROJECT_ATTR" --subject="$GNUNET_KEY" --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf -gnunet-namestore -D -z gnu - -# (3+4) GNUnet assigns the attribute "member" to all entities gnunet has also assigned "developer" or "user" -gnunet-credential --createIssuerSide --ego=gnunet --attribute="$MEMBER_ATTR" --subject="$GNUNET_KEY $DEVELOPER_ATTR" --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf -gnunet-credential --createIssuerSide --ego=gnunet --attribute="$MEMBER_ATTR" --subject="$GNUNET_KEY $USER_ATTR" --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf -gnunet-namestore -D -z gnunet - -# (5) GNUnet signes the delegate and Alice stores it -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=gnunet --attribute=$DEV_ATTR --subject=$ALICE_KEY --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=alice --import="$SIGNED" --private -gnunet-namestore -D -z alice - -# Starting to resolve -echo "+++ Starting to Resolve +++" - -DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$SERVICE_KEY --attribute=$USER_ATTR --ego=alice --backward -c test_credential_lookup.conf | paste -d, -s - -` -echo $DELS -echo gnunet-credential --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf -gnunet-credential --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --delegate="$DELS" --backward -c test_credential_lookup.conf - -RES=$? - -# Cleanup properly -gnunet-namestore -z alice -d -n "@" -t DEL -c test_credential_lookup.conf -gnunet-namestore -z gnu -d -n $GNU_PROJECT_ATTR -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z gnunet -d -n $MEMBER_ATTR -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z service -d -n $USER_ATTR -t ATTR -c test_credential_lookup.conf -gnunet-arm -e -c test_credential_lookup.conf - -if [ "$RES" == 0 ] -then - exit 0 -else - echo "FAIL: Failed to verify credential." - exit 1 -fi diff --git a/src/credential/test_credential_verify_and.sh b/src/credential/test_credential_verify_and.sh deleted file mode 100755 index 3a2852dc6..000000000 --- a/src/credential/test_credential_verify_and.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env bash -trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT - -LOCATION=$(which gnunet-config) -if [ -z $LOCATION ] -then - LOCATION="gnunet-config" -fi -$LOCATION --version 1> /dev/null -if test $? != 0 -then - echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" - exit 77 -fi - -rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` - -# (1) Service.user -> GNU.project.member -# (2) GNU.project -> GNUnet -# (3) GNUnet.member -> GNUnet.developer AND GNUnet.user -# (4) GNUnet.developer -> Alice - - -which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" -gnunet-arm -s -c test_credential_lookup.conf -gnunet-identity -C service -c test_credential_lookup.conf -gnunet-identity -C alice -c test_credential_lookup.conf -gnunet-identity -C gnu -c test_credential_lookup.conf -gnunet-identity -C gnunet -c test_credential_lookup.conf - -GNU_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep gnu | grep -v gnunet | awk '{print $3}') -ALICE_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep alice | awk '{print $3}') -GNUNET_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep gnunet | awk '{print $3}') -SERVICE_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep service | awk '{print $3}') - -USER_ATTR="user" -GNU_PROJECT_ATTR="project" -MEMBER_ATTR="member" -DEVELOPER_ATTR="developer" -DEV_ATTR="developer" -TEST_CREDENTIAL="mygnunetcreds" - -gnunet-identity -d - -# (1) A service assigns the attribute "user" to all entities that have been assigned "member" by entities that werde assigned "project" from GNU -gnunet-credential --createIssuerSide --ego=service --attribute="$USER_ATTR" --subject="$GNU_KEY $GNU_PROJECT_ATTR.$MEMBER_ATTR" --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf -gnunet-namestore -D -z service - -# (2) GNU recognized GNUnet as a GNU project and delegates the "project" attribute -gnunet-credential --createIssuerSide --ego=gnu --attribute="$GNU_PROJECT_ATTR" --subject="$GNUNET_KEY" --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf -gnunet-namestore -D -z gnu - -# (3+4) GNUnet assigns the attribute "member" to all entities gnunet has also assigned "developer" or "user" -gnunet-credential --createIssuerSide --ego=gnunet --attribute="$MEMBER_ATTR" --subject="$GNUNET_KEY $DEVELOPER_ATTR, $GNUNET_KEY $USER_ATTR" --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf -gnunet-namestore -D -z gnunet - -# (5) GNUnet signes the delegates and Alice stores it -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=gnunet --attribute=$DEV_ATTR --subject=$ALICE_KEY --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=alice --import="$SIGNED" --private -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=gnunet --attribute=$USER_ATTR --subject=$ALICE_KEY --ttl="2019-12-12 10:00:00"` -gnunet-credential --createSubjectSide --ego=alice --import="$SIGNED" --private -gnunet-namestore -D -z alice - -# Starting to resolve -echo "+++ Starting to Resolve +++" - -DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$SERVICE_KEY --attribute=$USER_ATTR --ego=alice --backward -c test_credential_lookup.conf | paste -d, -s - -` -echo $DELS -echo gnunet-credential --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf -gnunet-credential --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --delegate="$DELS" --backward -c test_credential_lookup.conf - -RES=$? - -# Cleanup properly -gnunet-namestore -z alice -d -n "@" -t DEL -c test_credential_lookup.conf -gnunet-namestore -z gnu -d -n $GNU_PROJECT_ATTR -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z gnunet -d -n $MEMBER_ATTR -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z service -d -n $USER_ATTR -t ATTR -c test_credential_lookup.conf -gnunet-arm -e -c test_credential_lookup.conf - -if [ "$RES" == 0 ] -then - exit 0 -else - echo "FAIL: Failed to verify credential $RES_CRED." - exit 1 -fi diff --git a/src/credential/test_credential_verify_simple.sh b/src/credential/test_credential_verify_simple.sh deleted file mode 100755 index 3a3b0832b..000000000 --- a/src/credential/test_credential_verify_simple.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash -trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT - -LOCATION=$(which gnunet-config) -if [ -z $LOCATION ] -then - LOCATION="gnunet-config" -fi -$LOCATION --version 1> /dev/null -if test $? != 0 -then - echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" - exit 77 -fi - -rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` - -# (1) Issuer.user -> Subject - - -which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" -gnunet-arm -s -c test_credential_lookup.conf -gnunet-identity -C testissuer -c test_credential_lookup.conf -gnunet-identity -C testsubject -c test_credential_lookup.conf - -TEST_ATTR="user" -SUBJECT_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testsubject | awk '{print $3}') -ISSUER_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testissuer | awk '{print $3}') - -gnunet-identity -d - -# Create delegate (1) -SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=testissuer --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf` -gnunet-credential --createSubjectSide --ego=testsubject --import="$SIGNED" --private -gnunet-namestore -D -z testsubject - -# Starting to resolve -echo "+++ Starting to Resolve +++" - -DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --ego=testsubject -c test_credential_lookup.conf | paste -d, -s - -` -echo $DELS -gnunet-credential --verify --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --delegate="$DELS" -c test_credential_lookup.conf - -RES=$? - -# Cleanup properly -gnunet-namestore -z testsubject -d -n "@" -t DEL -c test_credential_lookup.conf -gnunet-arm -e -c test_credential_lookup.conf - -if [ "$RES" == 0 ] -then - exit 0 -else - echo "FAIL: Failed to verify credential." - exit 1 -fi
\ No newline at end of file diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 9e0813425..c81f8e7d8 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am @@ -23,6 +23,7 @@ else gnunetinclude_HEADERS = \ platform.h gettext.h \ compat.h \ + gnunet_abd_service.h \ gnunet_applications.h \ gnunet_arm_service.h \ gnunet_ats_service.h \ @@ -42,7 +43,6 @@ gnunetinclude_HEADERS = \ gnunet_container_lib.h \ gnunet_conversation_service.h \ gnunet_core_service.h \ - gnunet_credential_service.h \ gnunet_crypto_lib.h \ gnunet_curl_lib.h \ gnunet_datacache_lib.h \ diff --git a/src/include/gnunet_credential_service.h b/src/include/gnunet_abd_service.h index 325296ecc..b50ff8b86 100644 --- a/src/include/gnunet_credential_service.h +++ b/src/include/gnunet_abd_service.h @@ -24,13 +24,13 @@ * @file * API to the Credential service * - * @defgroup credential Credential service + * @defgroup abd Credential service * Credentials * * @{ */ -#ifndef GNUNET_CREDENTIAL_SERVICE_H -#define GNUNET_CREDENTIAL_SERVICE_H +#ifndef GNUNET_ABD_SERVICE_H +#define GNUNET_ABD_SERVICE_H #include "gnunet_util_lib.h" #include "gnunet_gns_service.h" @@ -48,26 +48,26 @@ extern "C" /** * Connection to the Credential service. */ -struct GNUNET_CREDENTIAL_Handle; +struct GNUNET_ABD_Handle; /** * Handle to control a lookup operation. */ -struct GNUNET_CREDENTIAL_Request; +struct GNUNET_ABD_Request; /* * Enum used for checking whether the issuer has the authority to issue credentials or is just a subject */ -enum GNUNET_CREDENTIAL_CredentialFlags { +enum GNUNET_ABD_CredentialFlags { //Subject had credentials before, but have been revoked now - GNUNET_CREDENTIAL_FLAG_REVOKED=0, + GNUNET_ABD_FLAG_REVOKED=0, //Subject flag indicates that the subject is a holder of this credential and may present it as such - GNUNET_CREDENTIAL_FLAG_SUBJECT=1, + GNUNET_ABD_FLAG_SUBJECT=1, //Issuer flag is used to signify that the subject is allowed to issue this credential and delegate issuance - GNUNET_CREDENTIAL_FLAG_ISSUER=2 + GNUNET_ABD_FLAG_ISSUER=2 }; @@ -75,7 +75,7 @@ GNUNET_NETWORK_STRUCT_BEGIN /** * The attribute delegation record */ -struct GNUNET_CREDENTIAL_DelegationRecord { +struct GNUNET_ABD_DelegationRecord { /** * Number of delegation sets in this record @@ -95,7 +95,7 @@ struct GNUNET_CREDENTIAL_DelegationRecord { /** * The attribute delegation record */ -struct GNUNET_CREDENTIAL_DelegationRecordSet { +struct GNUNET_ABD_DelegationRecordSet { /** * Public key of the subject this attribute was delegated to @@ -114,7 +114,7 @@ GNUNET_NETWORK_STRUCT_END /** * The attribute delegation record */ -struct GNUNET_CREDENTIAL_DelegationSet { +struct GNUNET_ABD_DelegationSet { /** * Public key of the subject this attribute was delegated to @@ -133,7 +133,7 @@ struct GNUNET_CREDENTIAL_DelegationSet { /** * A delegation */ -struct GNUNET_CREDENTIAL_Delegation { +struct GNUNET_ABD_Delegation { /** * The issuer of the delegation @@ -170,7 +170,7 @@ struct GNUNET_CREDENTIAL_Delegation { /** * A delegate */ -struct GNUNET_CREDENTIAL_Delegate { +struct GNUNET_ABD_Delegate { /** * The issuer of the credential @@ -217,13 +217,13 @@ struct GNUNET_CREDENTIAL_Delegate { /* * Enum used for checking whether the issuer has the authority to issue credentials or is just a subject */ -enum GNUNET_CREDENTIAL_AlgoDirectionFlags { +enum GNUNET_ABD_AlgoDirectionFlags { //Subject had credentials before, but have been revoked now - GNUNET_CREDENTIAL_FLAG_FORWARD=1 << 0, + GNUNET_ABD_FLAG_FORWARD=1 << 0, //Subject flag indicates that the subject is a holder of this credential and may present it as such - GNUNET_CREDENTIAL_FLAG_BACKWARD=1 << 1 + GNUNET_ABD_FLAG_BACKWARD=1 << 1 }; @@ -233,8 +233,8 @@ enum GNUNET_CREDENTIAL_AlgoDirectionFlags { * @param cfg configuration to use * @return handle to the Credential service, or NULL on error */ -struct GNUNET_CREDENTIAL_Handle * -GNUNET_CREDENTIAL_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); +struct GNUNET_ABD_Handle * +GNUNET_ABD_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); /** @@ -243,7 +243,7 @@ GNUNET_CREDENTIAL_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); * @param handle connection to shut down */ void -GNUNET_CREDENTIAL_disconnect (struct GNUNET_CREDENTIAL_Handle *handle); +GNUNET_ABD_disconnect (struct GNUNET_ABD_Handle *handle); /** @@ -252,17 +252,17 @@ GNUNET_CREDENTIAL_disconnect (struct GNUNET_CREDENTIAL_Handle *handle); * @param cls closure * @param d_count the number of delegations processed * @param delegation_chain the delegations processed - * @param c_count the number of credentials found - * @param credential the credentials + * @param c_count the number of delegates found + * @param delegate the delegates */ -typedef void (*GNUNET_CREDENTIAL_CredentialResultProcessor) (void *cls, +typedef void (*GNUNET_ABD_CredentialResultProcessor) (void *cls, unsigned int d_count, - struct GNUNET_CREDENTIAL_Delegation *delegation_chain, + struct GNUNET_ABD_Delegation *delegation_chain, unsigned int c_count, - struct GNUNET_CREDENTIAL_Delegate *delegte); + struct GNUNET_ABD_Delegate *delegte); -typedef void (*GNUNET_CREDENTIAL_IntermediateResultProcessor) (void *cls, - struct GNUNET_CREDENTIAL_Delegation *delegation, +typedef void (*GNUNET_ABD_IntermediateResultProcessor) (void *cls, + struct GNUNET_ABD_Delegation *delegation, bool is_bw); /** @@ -272,7 +272,7 @@ typedef void (*GNUNET_CREDENTIAL_IntermediateResultProcessor) (void *cls, * @param success GNUNET_YES if successful * @param result the record data that can be handed to the subject */ -typedef void (*GNUNET_CREDENTIAL_DelegateResultProcessor) (void *cls, +typedef void (*GNUNET_ABD_DelegateResultProcessor) (void *cls, uint32_t success); /** @@ -282,7 +282,7 @@ typedef void (*GNUNET_CREDENTIAL_DelegateResultProcessor) (void *cls, * @param success GNUNET_YES if successful * @param result the record data that can be handed to the subject */ -typedef void (*GNUNET_CREDENTIAL_RemoveDelegateResultProcessor) (void *cls, +typedef void (*GNUNET_ABD_RemoveDelegateResultProcessor) (void *cls, uint32_t success); @@ -298,34 +298,34 @@ 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 credential_count number of credentials - * @param credentials the subject credentials + * @param delegate_count number of delegates + * @param delegates the subject delegates * @param proc function to call on result * @param proc_cls closure for processor * @return handle to the queued request */ -struct GNUNET_CREDENTIAL_Request* -GNUNET_CREDENTIAL_verify (struct GNUNET_CREDENTIAL_Handle *handle, +struct GNUNET_ABD_Request* +GNUNET_ABD_verify (struct GNUNET_ABD_Handle *handle, const struct GNUNET_CRYPTO_EcdsaPublicKey *issuer_key, const char *issuer_attribute, const struct GNUNET_CRYPTO_EcdsaPublicKey *subject_key, - uint32_t credential_count, - const struct GNUNET_CREDENTIAL_Delegate *delegates, - enum GNUNET_CREDENTIAL_AlgoDirectionFlags direction, - GNUNET_CREDENTIAL_CredentialResultProcessor proc, + uint32_t delegate_count, + const struct GNUNET_ABD_Delegate *delegates, + enum GNUNET_ABD_AlgoDirectionFlags direction, + GNUNET_ABD_CredentialResultProcessor proc, void *proc_cls, - GNUNET_CREDENTIAL_IntermediateResultProcessor, + GNUNET_ABD_IntermediateResultProcessor, void *proc2_cls); -struct GNUNET_CREDENTIAL_Request* -GNUNET_CREDENTIAL_collect (struct GNUNET_CREDENTIAL_Handle *handle, +struct GNUNET_ABD_Request* +GNUNET_ABD_collect (struct GNUNET_ABD_Handle *handle, const struct GNUNET_CRYPTO_EcdsaPublicKey *issuer_key, const char *issuer_attribute, const struct GNUNET_CRYPTO_EcdsaPrivateKey *subject_key, - enum GNUNET_CREDENTIAL_AlgoDirectionFlags direction, - GNUNET_CREDENTIAL_CredentialResultProcessor proc, + enum GNUNET_ABD_AlgoDirectionFlags direction, + GNUNET_ABD_CredentialResultProcessor proc, void *proc_cls, - GNUNET_CREDENTIAL_IntermediateResultProcessor, + GNUNET_ABD_IntermediateResultProcessor, void *proc2_cls); /** @@ -340,13 +340,13 @@ GNUNET_CREDENTIAL_collect (struct GNUNET_CREDENTIAL_Handle *handle, * @param proc_cls the result closure context * @return handle to the queued request */ -struct GNUNET_CREDENTIAL_Request * -GNUNET_CREDENTIAL_add_delegation (struct GNUNET_CREDENTIAL_Handle *handle, +struct GNUNET_ABD_Request * +GNUNET_ABD_add_delegation (struct GNUNET_ABD_Handle *handle, struct GNUNET_IDENTITY_Ego *issuer, const char *attribute, struct GNUNET_CRYPTO_EcdsaPublicKey *subject, const char *delegated_attribute, - GNUNET_CREDENTIAL_DelegateResultProcessor proc, + GNUNET_ABD_DelegateResultProcessor proc, void *proc_cls); /** @@ -359,11 +359,11 @@ GNUNET_CREDENTIAL_add_delegation (struct GNUNET_CREDENTIAL_Handle *handle, * @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_ABD_Request * +GNUNET_ABD_remove_delegation (struct GNUNET_ABD_Handle *handle, struct GNUNET_IDENTITY_Ego *issuer, const char *attribute, - GNUNET_CREDENTIAL_RemoveDelegateResultProcessor proc, + GNUNET_ABD_RemoveDelegateResultProcessor proc, void *proc_cls); @@ -377,8 +377,8 @@ GNUNET_CREDENTIAL_remove_delegation (struct GNUNET_CREDENTIAL_Handle *handle, * @param expiration the TTL of the credential * @return handle to the queued request */ -struct GNUNET_CREDENTIAL_Delegate* -GNUNET_CREDENTIAL_delegate_issue (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, +struct GNUNET_ABD_Delegate* +GNUNET_ABD_delegate_issue (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, struct GNUNET_CRYPTO_EcdsaPublicKey *subject, const char *iss_attr, const char *sub_attr, @@ -391,7 +391,7 @@ GNUNET_CREDENTIAL_delegate_issue (const struct GNUNET_CRYPTO_EcdsaPrivateKey *is * @param lr the lookup request to cancel */ void -GNUNET_CREDENTIAL_request_cancel (struct GNUNET_CREDENTIAL_Request *lr); +GNUNET_ABD_request_cancel (struct GNUNET_ABD_Request *lr); #if 0 /* keep Emacsens' auto-indent happy */ diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h index ea91f9eb9..3a49d98b9 100644 --- a/src/include/gnunet_gnsrecord_lib.h +++ b/src/include/gnunet_gnsrecord_lib.h @@ -107,9 +107,8 @@ extern "C" { */ /** - * Record type for credential + * 65547 deleted, free to use */ -#define GNUNET_GNSRECORD_TYPE_CREDENTIAL 65547 /** * Record type for policies diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index 4ca1ad47a..cd7cb50de 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h @@ -2716,17 +2716,17 @@ extern "C" { /************************************************** * - * CREDENTIAL MESSAGE TYPES + * ABD MESSAGE TYPES */ -#define GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY 981 +#define GNUNET_MESSAGE_TYPE_ABD_VERIFY 981 -#define GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY_RESULT 982 +#define GNUNET_MESSAGE_TYPE_ABD_VERIFY_RESULT 982 -#define GNUNET_MESSAGE_TYPE_CREDENTIAL_COLLECT 983 +#define GNUNET_MESSAGE_TYPE_ABD_COLLECT 983 -#define GNUNET_MESSAGE_TYPE_CREDENTIAL_COLLECT_RESULT 984 +#define GNUNET_MESSAGE_TYPE_ABD_COLLECT_RESULT 984 -#define GNUNET_MESSAGE_TYPE_CREDENTIAL_INTERMEDIATE_RESULT 985 +#define GNUNET_MESSAGE_TYPE_ABD_INTERMEDIATE_RESULT 985 /******************************************************************************/ |