gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated (79243b3d2 -> 007bba133)


From: gnunet
Subject: [gnunet] branch master updated (79243b3d2 -> 007bba133)
Date: Thu, 13 Feb 2020 22:31:00 +0100

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a change to branch master
in repository gnunet.

    from 79243b3d2 add concept of supplemental records
     new 5b6bb2ce4 move to 256-bit identifier; some cleanups
     new 55f6d26b7 Refactoring reclaim attestations
     new ad342b7e0 add attestation API
     new 73de82ef8 add attestation API to CLI
     new 065ecd9a0 bugfixes
     new 5fb277e8d towards better API
     new 02daf09b5 bugfixes
     new a80090ffc more bugfixes and REST API change
     new d06446f14 add base64url encoding to util (RFC7515)
     new 141a279fb bugfixes; CLI improvements
     new 5f9f9cae1 consolidate reclaim attribute lib
     new e8ea1f3e3 add expiration
     new d8cb147dc move to 256-bit identifier; some cleanups
     new 6e43cf789 Refactoring reclaim attestations
     new de8925d37 add attestation API
     new 7be1fcc01 add attestation API to CLI
     new 68ddf5330 bugfixes
     new f0b0359dd towards better API
     new 13be935f0 bugfixes
     new 2d34965f9 more bugfixes and REST API change
     new 0493510aa add base64url encoding to util (RFC7515)
     new b1b1aed7e bugfixes; CLI improvements
     new 6ab7faf76 consolidate reclaim attribute lib
     new 4aae05d2a add expiration
     new f992f8337 Merge branch 'schanzen/reclaim_256bit' of 
ssh://gnunet.org/gnunet into schanzen/reclaim_256bit
     new 15d3fe8a0 Merge branch 'master' into schanzen/reclaim_256bit
     new 3ea10b00b Merge branch 'master' into schanzen/reclaim_256bit
     new 967128436 Merge branch 'master' into schanzen/reclaim_256bit
     new f0b50570e Merge branch 'master' into schanzen/reclaim_256bit
     new 007bba133 Merge branch 'master' into schanzen/reclaim_256bit

The 30 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 configure.ac                                       |    1 -
 po/POTFILES.in                                     |    8 +-
 src/Makefile.am                                    |    1 -
 src/include/Makefile.am                            |    4 +-
 src/include/gnunet_gnsrecord_lib.h                 |   12 +-
 src/include/gnunet_protocols.h                     |   17 +-
 src/include/gnunet_reclaim_attribute_plugin.h      |  176 ----
 ...eclaim_attribute_lib.h => gnunet_reclaim_lib.h} |  368 ++++---
 src/include/gnunet_reclaim_plugin.h                |  296 ++++++
 src/include/gnunet_reclaim_service.h               |  145 ++-
 src/include/gnunet_strings_lib.h                   |   26 +
 src/reclaim-attribute/Makefile.am                  |   41 -
 .../plugin_reclaim_attribute_gnuid.c               |  290 ------
 src/reclaim-attribute/reclaim_attribute.c          | 1055 --------------------
 src/reclaim/Makefile.am                            |   32 +-
 src/reclaim/gnunet-reclaim.c                       |  330 ++++--
 src/reclaim/gnunet-service-reclaim.c               |  958 ++++++------------
 src/reclaim/gnunet-service-reclaim_tickets.c       |  365 +++----
 src/reclaim/gnunet-service-reclaim_tickets.h       |    7 +-
 src/reclaim/json_reclaim.c                         |  162 +--
 src/reclaim/json_reclaim.h                         |   16 +-
 src/reclaim/oidc_helper.c                          |  302 ++----
 src/reclaim/oidc_helper.h                          |    9 +-
 src/reclaim/plugin_gnsrecord_reclaim.c             |   30 +-
 src/reclaim/plugin_reclaim_attestation_jwt.c       |  321 ++++++
 src/reclaim/plugin_reclaim_attribute_basic.c       |  180 ++++
 src/reclaim/plugin_rest_openid_connect.c           |  358 ++++---
 src/reclaim/plugin_rest_reclaim.c                  |  671 +++----------
 src/reclaim/reclaim.h                              |   82 +-
 src/reclaim/reclaim_api.c                          |  558 ++++++-----
 src/reclaim/reclaim_attestation.c                  |  563 +++++++++++
 .../reclaim_attestation.h}                         |   76 +-
 src/reclaim/reclaim_attribute.c                    |  539 ++++++++++
 .../reclaim_attribute.h                            |   46 +-
 src/util/strings.c                                 |   85 +-
 35 files changed, 3989 insertions(+), 4141 deletions(-)
 delete mode 100644 src/include/gnunet_reclaim_attribute_plugin.h
 rename src/include/{gnunet_reclaim_attribute_lib.h => gnunet_reclaim_lib.h} 
(53%)
 create mode 100644 src/include/gnunet_reclaim_plugin.h
 delete mode 100644 src/reclaim-attribute/Makefile.am
 delete mode 100644 src/reclaim-attribute/plugin_reclaim_attribute_gnuid.c
 delete mode 100644 src/reclaim-attribute/reclaim_attribute.c
 create mode 100644 src/reclaim/plugin_reclaim_attestation_jwt.c
 create mode 100644 src/reclaim/plugin_reclaim_attribute_basic.c
 create mode 100644 src/reclaim/reclaim_attestation.c
 copy src/{reclaim-attribute/reclaim_attribute.h => 
reclaim/reclaim_attestation.h} (53%)
 create mode 100644 src/reclaim/reclaim_attribute.c
 rename src/{reclaim-attribute => reclaim}/reclaim_attribute.h (75%)

diff --git a/configure.ac b/configure.ac
index 23ca78dbb..c57a56f9f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1933,7 +1933,6 @@ src/zonemaster/Makefile
 src/zonemaster/zonemaster.conf
 src/rest/Makefile
 src/abe/Makefile
-src/reclaim-attribute/Makefile
 src/reclaim/Makefile
 pkgconfig/Makefile
 pkgconfig/gnunetarm.pc
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 441d0f91d..aaeed979c 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -264,17 +264,19 @@ src/pq/pq_prepare.c
 src/pq/pq_query_helper.c
 src/pq/pq_result_helper.c
 src/pt/gnunet-daemon-pt.c
-src/reclaim-attribute/plugin_reclaim_attribute_gnuid.c
-src/reclaim-attribute/reclaim_attribute.c
 src/reclaim/gnunet-reclaim.c
 src/reclaim/gnunet-service-reclaim.c
 src/reclaim/gnunet-service-reclaim_tickets.c
 src/reclaim/json_reclaim.c
 src/reclaim/oidc_helper.c
 src/reclaim/plugin_gnsrecord_reclaim.c
+src/reclaim/plugin_reclaim_attestation_jwt.c
+src/reclaim/plugin_reclaim_attribute_basic.c
 src/reclaim/plugin_rest_openid_connect.c
 src/reclaim/plugin_rest_reclaim.c
 src/reclaim/reclaim_api.c
+src/reclaim/reclaim_attestation.c
+src/reclaim/reclaim_attribute.c
 src/regex/gnunet-daemon-regexprofiler.c
 src/regex/gnunet-regex-profiler.c
 src/regex/gnunet-regex-simulation-profiler.c
@@ -428,6 +430,7 @@ src/transport/transport_api_offer_hello.c
 src/util/bandwidth.c
 src/util/benchmark.c
 src/util/bio.c
+src/util/buffer.c
 src/util/client.c
 src/util/common_allocation.c
 src/util/common_endian.c
@@ -464,6 +467,7 @@ src/util/getopt.c
 src/util/getopt_helpers.c
 src/util/gnunet-config-diff.c
 src/util/gnunet-config.c
+src/util/gnunet-crypto-tvg.c
 src/util/gnunet-ecc.c
 src/util/gnunet-qr.c
 src/util/gnunet-resolver.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 7b73a4bb8..e1d73ab01 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -60,7 +60,6 @@ if HAVE_MHD
 if HAVE_JSON
  REST_DIR = rest
  RECLAIM_DIR = \
-  reclaim-attribute \
   reclaim
 endif
 endif
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index b53f2420d..5c57b5be2 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -56,8 +56,8 @@ gnunetinclude_HEADERS = \
   gnunet_helper_lib.h \
   gnunet_identity_service.h \
   gnunet_abe_lib.h \
-  gnunet_reclaim_attribute_lib.h \
-  gnunet_reclaim_attribute_plugin.h \
+  gnunet_reclaim_lib.h \
+  gnunet_reclaim_plugin.h \
   gnunet_reclaim_service.h \
   gnunet_json_lib.h \
   gnunet_load_lib.h \
diff --git a/src/include/gnunet_gnsrecord_lib.h 
b/src/include/gnunet_gnsrecord_lib.h
index 196ea2970..c976c89c5 100644
--- a/src/include/gnunet_gnsrecord_lib.h
+++ b/src/include/gnunet_gnsrecord_lib.h
@@ -95,7 +95,7 @@ extern "C" {
 /**
  * Record type for identity attributes (of RECLAIM).
  */
-#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR 65544
+#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE 65544
 
 /**
  * Record type for local ticket references
@@ -123,7 +123,7 @@ extern "C" {
 /**
  * Record type for reclaim records
  */
-#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF 65550
+#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF 65550
 
 /**
  * Record type for RECLAIM master
@@ -141,14 +141,14 @@ extern "C" {
 #define GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT 65553
 
 /**
- * Record type for reclaim identity attestation
+ * Record type for an attribute attestation
  */
-#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR 65554
+#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION 65554
 
 /**
- * Record type for reclaim identity references
+ * Record type for an attestation reference in a ticket
  */
-#define GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE 65555
+#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF 65555
 
 
 /**
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 8091fb367..e67e35f38 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -2720,21 +2720,26 @@ extern "C" {
 
 #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT 979
 
-#define GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_STORE 980
+#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START 980
+
+#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP 981
+
+#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT 982
+
 
 /**************************************************
  *
  * ABD MESSAGE TYPES
  */
-#define GNUNET_MESSAGE_TYPE_ABD_VERIFY 981
+#define GNUNET_MESSAGE_TYPE_ABD_VERIFY 991
 
-#define GNUNET_MESSAGE_TYPE_ABD_VERIFY_RESULT 982
+#define GNUNET_MESSAGE_TYPE_ABD_VERIFY_RESULT 992
 
-#define GNUNET_MESSAGE_TYPE_ABD_COLLECT 983
+#define GNUNET_MESSAGE_TYPE_ABD_COLLECT 993
 
-#define GNUNET_MESSAGE_TYPE_ABD_COLLECT_RESULT 984
+#define GNUNET_MESSAGE_TYPE_ABD_COLLECT_RESULT 994
 
-#define GNUNET_MESSAGE_TYPE_ABD_INTERMEDIATE_RESULT 985
+#define GNUNET_MESSAGE_TYPE_ABD_INTERMEDIATE_RESULT 995
 
 
/******************************************************************************/
 
diff --git a/src/include/gnunet_reclaim_attribute_plugin.h 
b/src/include/gnunet_reclaim_attribute_plugin.h
deleted file mode 100644
index e61cca5b2..000000000
--- a/src/include/gnunet_reclaim_attribute_plugin.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
-     This file is part of GNUnet
-     Copyright (C) 2012, 2013 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     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
- */
-
-/**
- * @author Martin Schanzenbach
- *
- * @file
- * Plugin API for reclaim attribute types
- *
- * @defgroup reclaim-attribute-plugin  reclaim plugin API for attributes/claims
- * @{
- */
-#ifndef GNUNET_RECLAIM_ATTRIBUTE_PLUGIN_H
-#define GNUNET_RECLAIM_ATTRIBUTE_PLUGIN_H
-
-#include "gnunet_util_lib.h"
-#include "gnunet_reclaim_attribute_lib.h"
-
-#ifdef __cplusplus
-extern "C" {
-#if 0 /* keep Emacsens' auto-indent happy */
-}
-#endif
-#endif
-
-
-/**
- * Function called to convert the binary value @a data of an attribute of
- * type @a type to a human-readable string.
- *
- * @param cls closure
- * @param type type of the attribute
- * @param data value in binary encoding
- * @param data_size number of bytes in @a data
- * @return NULL on error, otherwise human-readable representation of the value
- */
-typedef char *(*GNUNET_RECLAIM_ATTRIBUTE_ValueToStringFunction) (
-  void *cls,
-  uint32_t type,
-  const void *data,
-  size_t data_size);
-
-
-/**
- * Function called to convert human-readable version of the value @a s
- * of an attribute of type @a type to the respective binary
- * representation.
- *
- * @param cls closure
- * @param type type of the attribute
- * @param s human-readable string
- * @param data set to value in binary encoding (will be allocated)
- * @param data_size set to number of bytes in @a data
- * @return #GNUNET_OK on success
- */
-typedef int (*GNUNET_RECLAIM_ATTRIBUTE_StringToValueFunction) (
-  void *cls,
-  uint32_t type,
-  const char *s,
-  void **data,
-  size_t *data_size);
-
-
-/**
- * Function called to convert a type name to the
- * corresponding number.
- *
- * @param cls closure
- * @param typename name to convert
- * @return corresponding number, UINT32_MAX on error
- */
-typedef uint32_t (*GNUNET_RECLAIM_ATTRIBUTE_TypenameToNumberFunction) (
-  void *cls,
-  const char *typename);
-
-
-/**
- * Function called to convert a type number (i.e. 1) to the
- * corresponding type string
- *
- * @param cls closure
- * @param type number of a type to convert
- * @return corresponding typestring, NULL on error
- */
-typedef const char *(*GNUNET_RECLAIM_ATTRIBUTE_NumberToTypenameFunction) (
-  void *cls,
-  uint32_t type);
-
-
-/**
- * Each plugin is required to return a pointer to a struct of this
- * type as the return value from its entry point.
- */
-struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions
-{
-  /**
-   * Closure for all of the callbacks.
-   */
-  void *cls;
-
-  /**
-   * Conversion to string.
-   */
-  GNUNET_RECLAIM_ATTRIBUTE_ValueToStringFunction value_to_string;
-
-  /**
-   * Conversion to binary.
-   */
-  GNUNET_RECLAIM_ATTRIBUTE_StringToValueFunction string_to_value;
-
-  /**
-   * Typename to number.
-   */
-  GNUNET_RECLAIM_ATTRIBUTE_TypenameToNumberFunction typename_to_number;
-
-  /**
-   * Number to typename.
-   */
-  GNUNET_RECLAIM_ATTRIBUTE_NumberToTypenameFunction number_to_typename;
-
-  /**
-   * FIXME: It is odd that attestation functions are withing the attribute
-   * plugin. An attribute type may be backed by an attestation, but not
-   * necessarily.
-   * Maybe it would make more sense to refactor this into an attestation
-   * plugin?
-   *
-   * Attestation Conversion to string.
-   */
-  GNUNET_RECLAIM_ATTRIBUTE_ValueToStringFunction value_to_string_attest;
-
-  /**
-  * Attestation Conversion to binary.
-  */
-  GNUNET_RECLAIM_ATTRIBUTE_StringToValueFunction string_to_value_attest;
-
-  /**
-  * Attestation Typename to number.
-  */
-  GNUNET_RECLAIM_ATTRIBUTE_TypenameToNumberFunction typename_to_number_attest;
-
-  /**
-  * Attestation Number to typename.
-  */
-  GNUNET_RECLAIM_ATTRIBUTE_NumberToTypenameFunction number_to_typename_attest;
-
-};
-
-
-#if 0 /* keep Emacsens' auto-indent happy */
-{
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/** @} */ /* end of group */
diff --git a/src/include/gnunet_reclaim_attribute_lib.h 
b/src/include/gnunet_reclaim_lib.h
similarity index 53%
rename from src/include/gnunet_reclaim_attribute_lib.h
rename to src/include/gnunet_reclaim_lib.h
index 004f2bd10..54d284f3c 100644
--- a/src/include/gnunet_reclaim_attribute_lib.h
+++ b/src/include/gnunet_reclaim_lib.h
@@ -60,15 +60,53 @@ extern "C" {
 */
 #define GNUNET_RECLAIM_ATTESTATION_TYPE_JWT 11
 
+/**
+ * We want an ID to be a 256-bit symmetric key
+ */
+#define GNUNET_RECLAIM_ID_LENGTH (256 / 8)
+
+/**
+ * A reclaim identifier
+ * FIXME maybe put this in a different namespace
+ */
+struct GNUNET_RECLAIM_Identifier
+{
+  char id[GNUNET_RECLAIM_ID_LENGTH];
+};
+
+static const struct GNUNET_RECLAIM_Identifier GNUNET_RECLAIM_ID_ZERO;
+
+#define GNUNET_RECLAIM_id_is_equal(a,b) ((0 == \
+                                          memcmp (a, \
+                                                  b, \
+                                                  sizeof 
(GNUNET_RECLAIM_ID_ZERO))) \
+  ? \
+                                         GNUNET_YES : GNUNET_NO)
+
+
+#define GNUNET_RECLAIM_id_is_zero(a) GNUNET_RECLAIM_id_is_equal (a, \
+                                                                 & \
+                                                                 
GNUNET_RECLAIM_ID_ZERO)
+
+#define GNUNET_RECLAIM_id_generate(id) \
+  (GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG, \
+                               id, \
+                               sizeof (GNUNET_RECLAIM_ID_ZERO)))
+
 /**
  * An attribute.
  */
-struct GNUNET_RECLAIM_ATTRIBUTE_Claim
+struct GNUNET_RECLAIM_Attribute
 {
   /**
    * ID
    */
-  uint64_t id;
+  struct GNUNET_RECLAIM_Identifier id;
+
+  /**
+   * Referenced ID of Attestation (may be 0 if self-attested)
+   */
+  struct GNUNET_RECLAIM_Identifier attestation;
 
   /**
    * Type of Claim
@@ -79,6 +117,7 @@ struct GNUNET_RECLAIM_ATTRIBUTE_Claim
    * Flags
    */
   uint32_t flag;
+
   /**
    * The name of the attribute. Note "name" must never be individually
    * free'd
@@ -101,12 +140,12 @@ struct GNUNET_RECLAIM_ATTRIBUTE_Claim
 /**
  * An attestation.
  */
-struct GNUNET_RECLAIM_ATTESTATION_Claim
+struct GNUNET_RECLAIM_Attestation
 {
   /**
    * ID
    */
-  uint64_t id;
+  struct GNUNET_RECLAIM_Identifier id;
 
   /**
    * Type/Format of Claim
@@ -114,9 +153,9 @@ struct GNUNET_RECLAIM_ATTESTATION_Claim
   uint32_t type;
 
   /**
-   * Version
+   * Flag
    */
-  uint32_t version;
+  uint32_t flag;
 
   /**
    * The name of the attribute. Note "name" must never be individually
@@ -137,81 +176,77 @@ struct GNUNET_RECLAIM_ATTESTATION_Claim
   const void *data;
 };
 
+
 /**
- * A reference to an Attestatiom.
+ * A list of GNUNET_RECLAIM_Attribute structures.
  */
-struct GNUNET_RECLAIM_ATTESTATION_REFERENCE
+struct GNUNET_RECLAIM_AttributeList
 {
   /**
-   * ID
+   * List head
+   */
+  struct GNUNET_RECLAIM_AttributeListEntry *list_head;
+
+  /**
+   * List tail
    */
-  uint64_t id;
+  struct GNUNET_RECLAIM_AttributeListEntry *list_tail;
+};
+
 
+struct GNUNET_RECLAIM_AttributeListEntry
+{
   /**
-   * Referenced ID of Attestation
+   * DLL
    */
-  uint64_t id_attest;
+  struct GNUNET_RECLAIM_AttributeListEntry *prev;
 
   /**
-   * The name of the attribute/attestation reference value. Note "name" must 
never be individually
-   * free'd
+   * DLL
    */
-  const char *name;
+  struct GNUNET_RECLAIM_AttributeListEntry *next;
 
   /**
-   * The name of the attribute/attestation reference value. Note "name" must 
never be individually
-   * free'd
+   * The attribute claim
    */
-  const char *reference_value;
+  struct GNUNET_RECLAIM_Attribute *attribute;
+
 };
 
 /**
- * A list of GNUNET_RECLAIM_ATTRIBUTE_Claim structures.
+ * A list of GNUNET_RECLAIM_Attestation structures.
  */
-struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList
+struct GNUNET_RECLAIM_AttestationList
 {
   /**
    * List head
    */
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *list_head;
+  struct GNUNET_RECLAIM_AttestationListEntry *list_head;
 
   /**
    * List tail
    */
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *list_tail;
+  struct GNUNET_RECLAIM_AttestationListEntry *list_tail;
 };
 
 
-struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry
+struct GNUNET_RECLAIM_AttestationListEntry
 {
   /**
    * DLL
    */
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *prev;
+  struct GNUNET_RECLAIM_AttestationListEntry *prev;
 
   /**
    * DLL
    */
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *next;
+  struct GNUNET_RECLAIM_AttestationListEntry *next;
 
   /**
-   * The attribute claim
-   */
-  struct GNUNET_RECLAIM_ATTRIBUTE_Claim *claim;
-  /**
-   * The attestation claim
+   * The attestation
    */
-  struct GNUNET_RECLAIM_ATTESTATION_Claim *attest;
+  struct GNUNET_RECLAIM_Attestation *attestation;
 
-  /**
-  * The reference
-  */
-  struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference;
-};
-
-struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType
-{
-  uint32_t type;
 };
 
 
@@ -219,16 +254,19 @@ struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType
  * Create a new attribute claim.
  *
  * @param attr_name the attribute name
+ * @param attestation ID of the attestation (may be NULL)
  * @param type the attribute type
- * @param data the attribute value
+ * @param data the attribute value. Must be the mapped name if attestation not 
NULL
  * @param data_size the attribute value size
  * @return the new attribute
  */
-struct GNUNET_RECLAIM_ATTRIBUTE_Claim *
-GNUNET_RECLAIM_ATTRIBUTE_claim_new (const char *attr_name,
-                                    uint32_t type,
-                                    const void *data,
-                                    size_t data_size);
+struct GNUNET_RECLAIM_Attribute *
+GNUNET_RECLAIM_attribute_new (const char *attr_name,
+                              const struct
+                              GNUNET_RECLAIM_Identifier *attestation,
+                              uint32_t type,
+                              const void *data,
+                              size_t data_size);
 
 
 /**
@@ -238,8 +276,8 @@ GNUNET_RECLAIM_ATTRIBUTE_claim_new (const char *attr_name,
  * @return the required buffer size
  */
 size_t
-GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (
-  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
+GNUNET_RECLAIM_attribute_list_serialize_get_size (
+  const struct GNUNET_RECLAIM_AttributeList *attrs);
 
 
 /**
@@ -248,22 +286,25 @@ GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (
  * @param attrs list to destroy
  */
 void
-GNUNET_RECLAIM_ATTRIBUTE_list_destroy (
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
+GNUNET_RECLAIM_attribute_list_destroy (
+  struct GNUNET_RECLAIM_AttributeList *attrs);
 
 
 /**
  * Add a new attribute to a claim list
  *
+ * @param attrs the attribute list to add to
  * @param attr_name the name of the new attribute claim
+ * @param attestation attestation ID (may be NULL)
  * @param type the type of the claim
  * @param data claim payload
  * @param data_size claim payload size
  */
 void
-GNUNET_RECLAIM_ATTRIBUTE_list_add (
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
+GNUNET_RECLAIM_attribute_list_add (
+  struct GNUNET_RECLAIM_AttributeList *attrs,
   const char *attr_name,
+  const struct GNUNET_RECLAIM_Identifier *attestation,
   uint32_t type,
   const void *data,
   size_t data_size);
@@ -277,8 +318,8 @@ GNUNET_RECLAIM_ATTRIBUTE_list_add (
  * @return length of serialized data
  */
 size_t
-GNUNET_RECLAIM_ATTRIBUTE_list_serialize (
-  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
+GNUNET_RECLAIM_attribute_list_serialize (
+  const struct GNUNET_RECLAIM_AttributeList *attrs,
   char *result);
 
 
@@ -289,17 +330,8 @@ GNUNET_RECLAIM_ATTRIBUTE_list_serialize (
  * @param data_size the length of the serialized data
  * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller
  */
-struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *
-GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (const char *data, size_t data_size);
-
-/**
- * Count attestations in claim list
- *
- * @param attrs list
- */
-int
-GNUNET_RECLAIM_ATTRIBUTE_list_count_attest (
-  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
+struct GNUNET_RECLAIM_AttributeList *
+GNUNET_RECLAIM_attribute_list_deserialize (const char *data, size_t data_size);
 
 /**
  * Get required size for serialization buffer
@@ -308,8 +340,8 @@ GNUNET_RECLAIM_ATTRIBUTE_list_count_attest (
  * @return the required buffer size
  */
 size_t
-GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (
-  const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr);
+GNUNET_RECLAIM_attribute_serialize_get_size (
+  const struct GNUNET_RECLAIM_Attribute *attr);
 
 
 /**
@@ -320,9 +352,8 @@ GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (
  * @return length of serialized data
  */
 size_t
-GNUNET_RECLAIM_ATTRIBUTE_serialize (
-  const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-  char *result);
+GNUNET_RECLAIM_attribute_serialize (const struct GNUNET_RECLAIM_Attribute 
*attr,
+                                    char *result);
 
 
 /**
@@ -333,8 +364,8 @@ GNUNET_RECLAIM_ATTRIBUTE_serialize (
  *
  * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
  */
-struct GNUNET_RECLAIM_ATTRIBUTE_Claim *
-GNUNET_RECLAIM_ATTRIBUTE_deserialize (const char *data, size_t data_size);
+struct GNUNET_RECLAIM_Attribute *
+GNUNET_RECLAIM_attribute_deserialize (const char *data, size_t data_size);
 
 
 /**
@@ -342,9 +373,9 @@ GNUNET_RECLAIM_ATTRIBUTE_deserialize (const char *data, 
size_t data_size);
  * @param attrs claim list to copy
  * @return copied claim list
  */
-struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *
-GNUNET_RECLAIM_ATTRIBUTE_list_dup (
-  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
+struct GNUNET_RECLAIM_AttributeList *
+GNUNET_RECLAIM_attribute_list_dup (
+  const struct GNUNET_RECLAIM_AttributeList *attrs);
 
 
 /**
@@ -354,7 +385,7 @@ GNUNET_RECLAIM_ATTRIBUTE_list_dup (
  * @return corresponding number, UINT32_MAX on error
  */
 uint32_t
-GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (const char *typename);
+GNUNET_RECLAIM_attribute_typename_to_number (const char *typename);
 
 /**
  * Convert human-readable version of a 'claim' of an attribute to the binary
@@ -367,7 +398,7 @@ GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (const char 
*typename);
  * @return #GNUNET_OK on success
  */
 int
-GNUNET_RECLAIM_ATTRIBUTE_string_to_value (uint32_t type,
+GNUNET_RECLAIM_attribute_string_to_value (uint32_t type,
                                           const char *s,
                                           void **data,
                                           size_t *data_size);
@@ -382,11 +413,10 @@ GNUNET_RECLAIM_ATTRIBUTE_string_to_value (uint32_t type,
  * @return NULL on error, otherwise human-readable representation of the claim
  */
 char *
-GNUNET_RECLAIM_ATTRIBUTE_value_to_string (uint32_t type,
+GNUNET_RECLAIM_attribute_value_to_string (uint32_t type,
                                           const void *data,
                                           size_t data_size);
 
-
 /**
  * Convert a type number to the corresponding type string
  *
@@ -394,35 +424,91 @@ GNUNET_RECLAIM_ATTRIBUTE_value_to_string (uint32_t type,
  * @return corresponding typestring, NULL on error
  */
 const char *
-GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (uint32_t type);
-
-/**
-   * Get required size for serialization buffer
-   * FIXME:
-   * 1. The naming convention is violated here.
-   * It should GNUNET_RECLAIM_ATTRIBUTE_<lowercase from here>.
-   * It might make sense to refactor attestations into a separate folder.
-   * 2. The struct should be called GNUNET_RECLAIM_ATTESTATION_Data or
-   * GNUNET_RECLAIM_ATTRIBUTE_Attestation depending on location in source.
-   *
-   * @param attr the attestation to serialize
+GNUNET_RECLAIM_attribute_number_to_typename (uint32_t type);
+
+
+/**
+ * Get required size for serialization buffer
+ *
+ * @param attrs the attribute list to serialize
+ * @return the required buffer size
+ */
+size_t
+GNUNET_RECLAIM_attestation_list_serialize_get_size (
+  const struct GNUNET_RECLAIM_AttestationList *attestations);
+
+
+/**
+ * Destroy claim list
+ *
+ * @param attrs list to destroy
+ */
+void
+GNUNET_RECLAIM_attestation_list_destroy (
+  struct GNUNET_RECLAIM_AttestationList *attestations);
+
+
+/**
+ * Add a new attribute to a claim list
+ *
+ * @param attr_name the name of the new attribute claim
+ * @param type the type of the claim
+ * @param data claim payload
+ * @param data_size claim payload size
+ */
+void
+GNUNET_RECLAIM_attestation_list_add (
+  struct GNUNET_RECLAIM_AttestationList *attrs,
+  const char *att_name,
+  uint32_t type,
+  const void *data,
+  size_t data_size);
+
+
+/**
+ * Serialize an attribute list
+ *
+ * @param attrs the attribute list to serialize
+ * @param result the serialized attribute
+ * @return length of serialized data
+ */
+size_t
+GNUNET_RECLAIM_attestation_list_serialize (
+  const struct GNUNET_RECLAIM_AttestationList *attrs,
+  char *result);
+
+
+/**
+ * Deserialize an attribute list
+ *
+ * @param data the serialized attribute list
+ * @param data_size the length of the serialized data
+ * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller
+ */
+struct GNUNET_RECLAIM_AttestationList *
+GNUNET_RECLAIM_attestation_list_deserialize (const char *data,
+                                             size_t data_size);
+
+
+/**
+   * @param attestation the attestation to serialize
    * @return the required buffer size
    */
 size_t
-GNUNET_RECLAIM_ATTESTATION_serialize_get_size (
-  const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr);
+GNUNET_RECLAIM_attestation_serialize_get_size (
+  const struct GNUNET_RECLAIM_Attestation *attestation);
 
 
 /**
  * Serialize an attestation
  *
- * @param attr the attestation to serialize
+ * @param attestation the attestation to serialize
  * @param result the serialized attestation
  * @return length of serialized data
  */
 size_t
-GNUNET_RECLAIM_ATTESTATION_serialize (
-  const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr,
+GNUNET_RECLAIM_attestation_serialize (
+  const struct GNUNET_RECLAIM_Attestation *attestation,
   char *result);
 
 
@@ -434,24 +520,24 @@ GNUNET_RECLAIM_ATTESTATION_serialize (
  *
  * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
  */
-struct GNUNET_RECLAIM_ATTESTATION_Claim *
-GNUNET_RECLAIM_ATTESTATION_deserialize (const char *data, size_t data_size);
+struct GNUNET_RECLAIM_Attestation *
+GNUNET_RECLAIM_attestation_deserialize (const char *data, size_t data_size);
 
 
 /**
-   * Create a new attestation.
-   *
-   * @param attr_name the attestation name
-   * @param type the attestation type
-   * @param data the attestation value
-   * @param data_size the attestation value size
-   * @return the new attestation
-   */
-struct GNUNET_RECLAIM_ATTESTATION_Claim *
-GNUNET_RECLAIM_ATTESTATION_claim_new (const char *attr_name,
-                                      uint32_t type,
-                                      const void *data,
-                                      size_t data_size);
+ * Create a new attestation.
+ *
+ * @param name the attestation name
+ * @param type the attestation type
+ * @param data the attestation value
+ * @param data_size the attestation value size
+ * @return the new attestation
+ */
+struct GNUNET_RECLAIM_Attestation *
+GNUNET_RECLAIM_attestation_new (const char *name,
+                                uint32_t type,
+                                const void *data,
+                                size_t data_size);
 
 /**
  * Convert the 'claim' of an attestation to a string
@@ -462,7 +548,7 @@ GNUNET_RECLAIM_ATTESTATION_claim_new (const char *attr_name,
  * @return NULL on error, otherwise human-readable representation of the claim
  */
 char *
-GNUNET_RECLAIM_ATTESTATION_value_to_string (uint32_t type,
+GNUNET_RECLAIM_attestation_value_to_string (uint32_t type,
                                             const void *data,
                                             size_t data_size);
 
@@ -477,7 +563,7 @@ GNUNET_RECLAIM_ATTESTATION_value_to_string (uint32_t type,
  * @return #GNUNET_OK on success
  */
 int
-GNUNET_RECLAIM_ATTESTATION_string_to_value (uint32_t type,
+GNUNET_RECLAIM_attestation_string_to_value (uint32_t type,
                                             const char *s,
                                             void **data,
                                             size_t *data_size);
@@ -489,7 +575,7 @@ GNUNET_RECLAIM_ATTESTATION_string_to_value (uint32_t type,
  * @return corresponding typestring, NULL on error
  */
 const char *
-GNUNET_RECLAIM_ATTESTATION_number_to_typename (uint32_t type);
+GNUNET_RECLAIM_attestation_number_to_typename (uint32_t type);
 
 /**
  * Convert an attestation type name to the corresponding number
@@ -498,52 +584,26 @@ GNUNET_RECLAIM_ATTESTATION_number_to_typename (uint32_t 
type);
  * @return corresponding number, UINT32_MAX on error
  */
 uint32_t
-GNUNET_RECLAIM_ATTESTATION_typename_to_number (const char *typename);
+GNUNET_RECLAIM_attestation_typename_to_number (const char *typename);
 
 /**
- * Create a new attestation reference.
- *
- * @param attr_name the referenced claim name
- * @param ref_value the claim name in the attestation
- * @return the new reference
- */
-struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *
-GNUNET_RECLAIM_ATTESTATION_reference_new (const char *attr_name,
-                                          const char *ref_value);
-
-
-/**
- * Get required size for serialization buffer
+ * Convert an attestation type name to the corresponding number
  *
- * @param attr the reference to serialize
- * @return the required buffer size
+ * @param typename name to convert
+ * @return corresponding number, UINT32_MAX on error
  */
-size_t
-GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size (
-  const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr);
+struct GNUNET_RECLAIM_AttributeList*
+GNUNET_RECLAIM_attestation_get_attributes (const struct
+                                           GNUNET_RECLAIM_Attestation *attest);
 
-/**
- * Serialize a reference
- *
- * @param attr the reference to serialize
- * @param result the serialized reference
- * @return length of serialized data
- */
-size_t
-GNUNET_RECLAIM_ATTESTATION_REF_serialize (
-  const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr,
-  char *result);
+char*
+GNUNET_RECLAIM_attestation_get_issuer (const struct
+                                       GNUNET_RECLAIM_Attestation *attest);
 
-/**
- * Deserialize a reference
- *
- * @param data the serialized reference
- * @param data_size the length of the serialized data
- *
- * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
- */
-struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *
-GNUNET_RECLAIM_ATTESTATION_REF_deserialize (const char *data, size_t 
data_size);
+int
+GNUNET_RECLAIM_attestation_get_expiration (const struct
+                                           GNUNET_RECLAIM_Attestation *attest,
+                                           struct GNUNET_TIME_Absolute *exp);
 
 #if 0 /* keep Emacsens' auto-indent happy */
 {
diff --git a/src/include/gnunet_reclaim_plugin.h 
b/src/include/gnunet_reclaim_plugin.h
new file mode 100644
index 000000000..992ad0cc3
--- /dev/null
+++ b/src/include/gnunet_reclaim_plugin.h
@@ -0,0 +1,296 @@
+/*
+     This file is part of GNUnet
+     Copyright (C) 2012, 2013 GNUnet e.V.
+
+     GNUnet is free software: you can redistribute it and/or modify it
+     under the terms of the GNU Affero General Public License as published
+     by the Free Software Foundation, either version 3 of the License,
+     or (at your option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     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
+ */
+
+/**
+ * @author Martin Schanzenbach
+ *
+ * @file
+ * Plugin API for reclaim attribute types
+ *
+ * @defgroup reclaim-attribute-plugin  reclaim plugin API for attributes/claims
+ * @{
+ */
+#ifndef GNUNET_RECLAIM_AttributePLUGIN_H
+#define GNUNET_RECLAIM_AttributePLUGIN_H
+
+#include "gnunet_util_lib.h"
+#include "gnunet_reclaim_lib.h"
+
+#ifdef __cplusplus
+extern "C" {
+#if 0 /* keep Emacsens' auto-indent happy */
+}
+#endif
+#endif
+
+
+/**
+ * Function called to convert the binary value @a data of an attribute of
+ * type @a type to a human-readable string.
+ *
+ * @param cls closure
+ * @param type type of the attribute
+ * @param data value in binary encoding
+ * @param data_size number of bytes in @a data
+ * @return NULL on error, otherwise human-readable representation of the value
+ */
+typedef char *(*GNUNET_RECLAIM_AttributeValueToStringFunction) (
+  void *cls,
+  uint32_t type,
+  const void *data,
+  size_t data_size);
+
+
+/**
+ * Function called to convert human-readable version of the value @a s
+ * of an attribute of type @a type to the respective binary
+ * representation.
+ *
+ * @param cls closure
+ * @param type type of the attribute
+ * @param s human-readable string
+ * @param data set to value in binary encoding (will be allocated)
+ * @param data_size set to number of bytes in @a data
+ * @return #GNUNET_OK on success
+ */
+typedef int (*GNUNET_RECLAIM_AttributeStringToValueFunction) (
+  void *cls,
+  uint32_t type,
+  const char *s,
+  void **data,
+  size_t *data_size);
+
+
+/**
+ * Function called to convert a type name to the
+ * corresponding number.
+ *
+ * @param cls closure
+ * @param typename name to convert
+ * @return corresponding number, UINT32_MAX on error
+ */
+typedef uint32_t (*GNUNET_RECLAIM_AttributeTypenameToNumberFunction) (
+  void *cls,
+  const char *typename);
+
+
+/**
+ * Function called to convert a type number (i.e. 1) to the
+ * corresponding type string
+ *
+ * @param cls closure
+ * @param type number of a type to convert
+ * @return corresponding typestring, NULL on error
+ */
+typedef const char *(*GNUNET_RECLAIM_AttributeNumberToTypenameFunction) (
+  void *cls,
+  uint32_t type);
+
+/**
+ * Function called to convert the binary value @a data of an attribute of
+ * type @a type to a human-readable string.
+ *
+ * @param cls closure
+ * @param type type of the attribute
+ * @param data value in binary encoding
+ * @param data_size number of bytes in @a data
+ * @return NULL on error, otherwise human-readable representation of the value
+ */
+typedef char *(*GNUNET_RECLAIM_AttestationValueToStringFunction) (
+  void *cls,
+  uint32_t type,
+  const void *data,
+  size_t data_size);
+
+
+/**
+ * Function called to convert human-readable version of the value @a s
+ * of an attribute of type @a type to the respective binary
+ * representation.
+ *
+ * @param cls closure
+ * @param type type of the attribute
+ * @param s human-readable string
+ * @param data set to value in binary encoding (will be allocated)
+ * @param data_size set to number of bytes in @a data
+ * @return #GNUNET_OK on success
+ */
+typedef int (*GNUNET_RECLAIM_AttestationStringToValueFunction) (
+  void *cls,
+  uint32_t type,
+  const char *s,
+  void **data,
+  size_t *data_size);
+
+
+/**
+ * Function called to convert a type name to the
+ * corresponding number.
+ *
+ * @param cls closure
+ * @param typename name to convert
+ * @return corresponding number, UINT32_MAX on error
+ */
+typedef uint32_t (*GNUNET_RECLAIM_AttestationTypenameToNumberFunction) (
+  void *cls,
+  const char *typename);
+
+
+/**
+ * Function called to convert a type number (i.e. 1) to the
+ * corresponding type string
+ *
+ * @param cls closure
+ * @param type number of a type to convert
+ * @return corresponding typestring, NULL on error
+ */
+typedef const char *(*GNUNET_RECLAIM_AttestationNumberToTypenameFunction) (
+  void *cls,
+  uint32_t type);
+
+/**
+ * Function called to extract attributes from an attestation
+ *
+ * @param cls closure
+ * @param attest the attestation object
+ * @return an attribute list
+ */
+typedef struct GNUNET_RECLAIM_AttributeList 
*(*GNUNET_RECLAIM_AttestationGetAttributesFunction) (
+  void *cls,
+  const struct GNUNET_RECLAIM_Attestation *attest);
+
+/**
+ * Function called to get the issuer of the attestation (as string)
+ *
+ * @param cls closure
+ * @param attest the attestation object
+ * @return corresponding issuer string
+ */
+typedef char *(*GNUNET_RECLAIM_AttestationGetIssuerFunction) (
+  void *cls,
+  const struct GNUNET_RECLAIM_Attestation *attest);
+
+/**
+ * Function called to get the expiration of the attestation
+ *
+ * @param cls closure
+ * @param attest the attestation object
+ * @param where to write the value
+ * @return GNUNET_OK if successful
+ */
+typedef int (*GNUNET_RECLAIM_AttestationGetExpirationFunction) (
+  void *cls,
+  const struct GNUNET_RECLAIM_Attestation *attest,
+  struct GNUNET_TIME_Absolute *expiration);
+
+
+
+/**
+ * Each plugin is required to return a pointer to a struct of this
+ * type as the return value from its entry point.
+ */
+struct GNUNET_RECLAIM_AttributePluginFunctions
+{
+  /**
+   * Closure for all of the callbacks.
+   */
+  void *cls;
+
+  /**
+   * Conversion to string.
+   */
+  GNUNET_RECLAIM_AttributeValueToStringFunction value_to_string;
+
+  /**
+   * Conversion to binary.
+   */
+  GNUNET_RECLAIM_AttributeStringToValueFunction string_to_value;
+
+  /**
+   * Typename to number.
+   */
+  GNUNET_RECLAIM_AttributeTypenameToNumberFunction typename_to_number;
+
+  /**
+   * Number to typename.
+   */
+  GNUNET_RECLAIM_AttributeNumberToTypenameFunction number_to_typename;
+
+};
+
+/**
+ * Each plugin is required to return a pointer to a struct of this
+ * type as the return value from its entry point.
+ */
+struct GNUNET_RECLAIM_AttestationPluginFunctions
+{
+  /**
+   * Closure for all of the callbacks.
+   */
+  void *cls;
+
+  /**
+   * Conversion to string.
+   */
+  GNUNET_RECLAIM_AttestationValueToStringFunction value_to_string;
+
+  /**
+   * Conversion to binary.
+   */
+  GNUNET_RECLAIM_AttestationStringToValueFunction string_to_value;
+
+  /**
+   * Typename to number.
+   */
+  GNUNET_RECLAIM_AttestationTypenameToNumberFunction typename_to_number;
+
+  /**
+   * Number to typename.
+   */
+  GNUNET_RECLAIM_AttestationNumberToTypenameFunction number_to_typename;
+
+  /**
+   * Attesation attributes.
+   */
+  GNUNET_RECLAIM_AttestationGetAttributesFunction get_attributes;
+
+  /**
+   * Attesation issuer.
+   */
+  GNUNET_RECLAIM_AttestationGetIssuerFunction get_issuer;
+
+  /**
+   * Expiration.
+   */
+  GNUNET_RECLAIM_AttestationGetExpirationFunction get_expiration;
+};
+
+
+
+#if 0 /* keep Emacsens' auto-indent happy */
+{
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/** @} */ /* end of group */
diff --git a/src/include/gnunet_reclaim_service.h 
b/src/include/gnunet_reclaim_service.h
index 214cdba69..813bc1a59 100644
--- a/src/include/gnunet_reclaim_service.h
+++ b/src/include/gnunet_reclaim_service.h
@@ -38,7 +38,7 @@ extern "C" {
 #endif
 #endif
 
-#include "gnunet_reclaim_attribute_lib.h"
+#include "gnunet_reclaim_lib.h"
 #include "gnunet_util_lib.h"
 
 /**
@@ -77,9 +77,9 @@ struct GNUNET_RECLAIM_Ticket
   struct GNUNET_CRYPTO_EcdsaPublicKey audience;
 
   /**
-   * The ticket random (NBO)
+   * The ticket random identifier
    */
-  uint64_t rnd;
+  struct GNUNET_RECLAIM_Identifier rnd;
 };
 
 
@@ -107,19 +107,43 @@ typedef void (*GNUNET_RECLAIM_ContinuationWithStatus) 
(void *cls,
                                                        int32_t success,
                                                        const char *emsg);
 
-
 /**
  * Callback used to notify the client of attribute results.
  *
  * @param cls The callback closure
  * @param identity The identity authoritative over the attributes
  * @param attr The attribute
+ * @param attestation The attestation for the attribute (may be NULL)
  */
 typedef void (*GNUNET_RECLAIM_AttributeResult) (
   void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
-  const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-  const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
-  const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference);
+  const struct GNUNET_RECLAIM_Attribute *attr);
+
+/**
+ * Callback used to notify the client of attribute results.
+ *
+ * @param cls The callback closure
+ * @param identity The identity authoritative over the attributes
+ * @param attr The attribute
+ * @param attestation The attestation for the attribute (may be NULL)
+ */
+typedef void (*GNUNET_RECLAIM_AttributeTicketResult) (
+  void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
+  const struct GNUNET_RECLAIM_Attribute *attr,
+  const struct GNUNET_RECLAIM_Attestation *attestation);
+
+
+/**
+ * Callback used to notify the client of attestation results.
+ *
+ * @param cls The callback closure
+ * @param identity The identity authoritative over the attributes
+ * @param attestation The attestation
+ * @param attributes the parsed attributes
+ */
+typedef void (*GNUNET_RECLAIM_AttestationResult) (
+  void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
+  const struct GNUNET_RECLAIM_Attestation *attestation);
 
 
 /**
@@ -148,7 +172,7 @@ struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_attribute_store (
   struct GNUNET_RECLAIM_Handle *h,
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
-  const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
+  const struct GNUNET_RECLAIM_Attribute *attr,
   const struct GNUNET_TIME_Relative *exp_interval,
   GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls);
 
@@ -169,7 +193,7 @@ struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_attestation_store (
   struct GNUNET_RECLAIM_Handle *h,
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
-  const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr,
+  const struct GNUNET_RECLAIM_Attestation *attestation,
   const struct GNUNET_TIME_Relative *exp_interval,
   GNUNET_RECLAIM_ContinuationWithStatus cont,
   void *cont_cls);
@@ -190,7 +214,7 @@ struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_attribute_delete (
   struct GNUNET_RECLAIM_Handle *h,
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
-  const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
+  const struct GNUNET_RECLAIM_Attribute *attr,
   GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls);
 
 /**
@@ -208,28 +232,10 @@ struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_attestation_delete (
   struct GNUNET_RECLAIM_Handle *h,
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
-  const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr,
+  const struct GNUNET_RECLAIM_Attestation *attr,
   GNUNET_RECLAIM_ContinuationWithStatus cont,
   void *cont_cls);
 
-/**
- * Delete an attestation reference. Tickets used to share this reference are 
updated
- * accordingly.
- *
- * @param h handle to the re:claimID service
- * @param pkey Private key of the identity to delete the reference from
- * @param attr The reference
- * @param cont Continuation to call when done
- * @param cont_cls Closure for @a cont
- * @return handle Used to to abort the request
- */
-struct GNUNET_RECLAIM_Operation *
-GNUNET_RECLAIM_attestation_reference_delete (
-  struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
-  const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr,
-  GNUNET_RECLAIM_ContinuationWithStatus cont,
-  void *cont_cls);
 /**
  * List all attributes for a local identity.
  * This MUST lock the `struct GNUNET_RECLAIM_Handle`
@@ -262,26 +268,6 @@ GNUNET_RECLAIM_get_attributes_start (
   GNUNET_RECLAIM_AttributeResult proc, void *proc_cls,
   GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls);
 
-/**
-   * Store an attestation reference.  If the reference is already present,
-   * it is replaced with the new reference.
-   *
-   * @param h handle to the re:claimID service
-   * @param pkey private key of the identity
-   * @param attr the reference value
-   * @param exp_interval the relative expiration interval for the reference
-   * @param cont continuation to call when done
-   * @param cont_cls closure for @a cont
-   * @return handle to abort the request
-   */
-struct GNUNET_RECLAIM_Operation *
-GNUNET_RECLAIM_attestation_reference_store (
-  struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
-  const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr,
-  const struct GNUNET_TIME_Relative *exp_interval,
-  GNUNET_RECLAIM_ContinuationWithStatus cont,
-  void *cont_cls);
 
 /**
  * Calls the record processor specified in #GNUNET_RECLAIM_get_attributes_start
@@ -306,6 +292,63 @@ GNUNET_RECLAIM_get_attributes_stop (
   struct GNUNET_RECLAIM_AttributeIterator *it);
 
 
+/**
+ * List all attestations for a local identity.
+ * This MUST lock the `struct GNUNET_RECLAIM_Handle`
+ * for any other calls than #GNUNET_RECLAIM_get_attestations_next() and
+ * #GNUNET_RECLAIM_get_attestations_stop. @a proc will be called once
+ * immediately, and then again after
+ * #GNUNET_RECLAIM_get_attestations_next() is invoked.
+ *
+ * On error (disconnect), @a error_cb will be invoked.
+ * On normal completion, @a finish_cb proc will be
+ * invoked.
+ *
+ * @param h Handle to the re:claimID service
+ * @param identity Identity to iterate over
+ * @param error_cb Function to call on error (i.e. disconnect),
+ *        the handle is afterwards invalid
+ * @param error_cb_cls Closure for @a error_cb
+ * @param proc Function to call on each attestation
+ * @param proc_cls Closure for @a proc
+ * @param finish_cb Function to call on completion
+ *        the handle is afterwards invalid
+ * @param finish_cb_cls Closure for @a finish_cb
+ * @return an iterator Handle to use for iteration
+ */
+struct GNUNET_RECLAIM_AttestationIterator *
+GNUNET_RECLAIM_get_attestations_start (
+  struct GNUNET_RECLAIM_Handle *h,
+  const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
+  GNUNET_SCHEDULER_TaskCallback error_cb,
+  void *error_cb_cls,
+  GNUNET_RECLAIM_AttestationResult proc,
+  void *proc_cls,
+  GNUNET_SCHEDULER_TaskCallback finish_cb,
+  void *finish_cb_cls);
+
+
+/**
+ * Calls the record processor specified in 
#GNUNET_RECLAIM_get_attestation_start
+ * for the next record.
+ *
+ * @param it the iterator
+ */
+void
+GNUNET_RECLAIM_get_attestations_next (struct 
GNUNET_RECLAIM_AttestationIterator *ait);
+
+
+/**
+ * Stops iteration and releases the handle for further calls. Must
+ * be called on any iteration that has not yet completed prior to calling
+ * #GNUNET_RECLAIM_disconnect.
+ *
+ * @param it the iterator
+ */
+void
+GNUNET_RECLAIM_get_attestations_stop (struct 
GNUNET_RECLAIM_AttestationIterator *ait);
+
+
 /**
  * Issues a ticket to a relying party. The identity may use
  * GNUNET_RECLAIM_ticket_consume to consume the ticket
@@ -324,7 +367,7 @@ GNUNET_RECLAIM_ticket_issue (
   struct GNUNET_RECLAIM_Handle *h,
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss,
   const struct GNUNET_CRYPTO_EcdsaPublicKey *rp,
-  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
+  const struct GNUNET_RECLAIM_AttributeList *attrs,
   GNUNET_RECLAIM_TicketCallback cb, void *cb_cls);
 
 
@@ -366,7 +409,7 @@ GNUNET_RECLAIM_ticket_consume (
   struct GNUNET_RECLAIM_Handle *h,
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
   const struct GNUNET_RECLAIM_Ticket *ticket,
-  GNUNET_RECLAIM_AttributeResult cb, void *cb_cls);
+  GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls);
 
 
 /**
diff --git a/src/include/gnunet_strings_lib.h b/src/include/gnunet_strings_lib.h
index 5e8892c0d..4003590fc 100644
--- a/src/include/gnunet_strings_lib.h
+++ b/src/include/gnunet_strings_lib.h
@@ -348,6 +348,19 @@ GNUNET_STRINGS_base64_encode (const void *in,
                               char **output);
 
 
+/**
+ * Encode into Base64url. RFC7515
+ *
+ * @param in the data to encode
+ * @param len the length of the input
+ * @param output where to write the output (*output should be NULL,
+ *   is allocated)
+ * @return the size of the output
+ */
+size_t
+GNUNET_STRINGS_base64url_encode (const void *in, size_t len, char **output);
+
+
 /**
  * Decode from Base64.
  *
@@ -363,6 +376,19 @@ GNUNET_STRINGS_base64_decode (const char *data,
                               void **output);
 
 
+/**
+ * Decode from Base64url. RFC7515
+ *
+ * @param data the data to decode
+ * @param len the length of the input
+ * @param output where to write the output (*output should be NULL,
+ *   is allocated)
+ * @return the size of the output
+ */
+size_t
+GNUNET_STRINGS_base64url_decode (const char *data, size_t len, void **out);
+
+
 /**
  * Convert a peer path to a human-readable string.
  *
diff --git a/src/reclaim-attribute/Makefile.am 
b/src/reclaim-attribute/Makefile.am
deleted file mode 100644
index 490e77398..000000000
--- a/src/reclaim-attribute/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-# This Makefile.am is in the public domain
-AM_CPPFLAGS = -I$(top_srcdir)/src/include
-
-plugindir = $(libdir)/gnunet
-
-pkgcfgdir= $(pkgdatadir)/config.d/
-
-libexecdir= $(pkglibdir)/libexec/
-
-if USE_COVERAGE
-  AM_CFLAGS = --coverage -O0
-  XLIBS = -lgcov
-endif
-
-lib_LTLIBRARIES = \
-  libgnunetreclaimattribute.la
-
-libgnunetreclaimattribute_la_SOURCES = \
-  reclaim_attribute.h \
-  reclaim_attribute.c
-libgnunetreclaimattribute_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(GN_LIBINTL)
-libgnunetreclaimattribute_la_LDFLAGS = \
-  $(GN_LIB_LDFLAGS)  \
-  -version-info 0:0:0
-
-
-plugin_LTLIBRARIES = \
-  libgnunet_plugin_reclaim_attribute_gnuid.la
-
-
-libgnunet_plugin_reclaim_attribute_gnuid_la_SOURCES = \
-  plugin_reclaim_attribute_gnuid.c
-libgnunet_plugin_reclaim_attribute_gnuid_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(LTLIBINTL)
-libgnunet_plugin_reclaim_attribute_gnuid_la_LDFLAGS = \
- $(GN_PLUGIN_LDFLAGS)
-
-
diff --git a/src/reclaim-attribute/plugin_reclaim_attribute_gnuid.c 
b/src/reclaim-attribute/plugin_reclaim_attribute_gnuid.c
deleted file mode 100644
index ade2a27bb..000000000
--- a/src/reclaim-attribute/plugin_reclaim_attribute_gnuid.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
-     This file is part of GNUnet
-     Copyright (C) 2013, 2014, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     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 reclaim-attribute/plugin_reclaim_attribute_gnuid.c
- * @brief reclaim-attribute-plugin-gnuid attribute plugin to provide the API 
for
- *                                       fundamental
- *                                       attribute types.
- *
- * @author Martin Schanzenbach
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_reclaim_attribute_plugin.h"
-#include <inttypes.h>
-
-
-/**
- * Convert the 'value' of an attribute to a string.
- *
- * @param cls closure, unused
- * @param type type of the attribute
- * @param data value in binary encoding
- * @param data_size number of bytes in @a data
- * @return NULL on error, otherwise human-readable representation of the value
- */
-static char *
-gnuid_value_to_string (void *cls,
-                       uint32_t type,
-                       const void *data,
-                       size_t data_size)
-{
-  switch (type)
-  {
-  case GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING:
-    return GNUNET_strndup (data, data_size);
-
-  default:
-    return NULL;
-  }
-}
-
-
-/**
- * Convert human-readable version of a 'value' of an attribute to the binary
- * representation.
- *
- * @param cls closure, unused
- * @param type type of the attribute
- * @param s human-readable string
- * @param data set to value in binary encoding (will be allocated)
- * @param data_size set to number of bytes in @a data
- * @return #GNUNET_OK on success
- */
-static int
-gnuid_string_to_value (void *cls,
-                       uint32_t type,
-                       const char *s,
-                       void **data,
-                       size_t *data_size)
-{
-  if (NULL == s)
-    return GNUNET_SYSERR;
-  switch (type)
-  {
-  case GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING:
-    *data = GNUNET_strdup (s);
-    *data_size = strlen (s);
-    return GNUNET_OK;
-
-  default:
-    return GNUNET_SYSERR;
-  }
-}
-
-/**
-   * Convert the 'value' of an attestation to a string.
-   *
-   * @param cls closure, unused
-   * @param type type of the attestation
-   * @param data value in binary encoding
-   * @param data_size number of bytes in @a data
-   * @return NULL on error, otherwise human-readable representation of the 
value
-   */
-static char *
-gnuid_value_to_string_attest (void *cls,
-                              uint32_t type,
-                              const void *data,
-                              size_t data_size)
-{
-  switch (type)
-  {
-  case GNUNET_RECLAIM_ATTESTATION_TYPE_JWT:
-    return GNUNET_strndup (data, data_size);
-
-  default:
-    return NULL;
-  }
-}
-
-
-/**
- * Convert human-readable version of a 'value' of an attestation to the binary
- * representation.
- *
- * @param cls closure, unused
- * @param type type of the attestation
- * @param s human-readable string
- * @param data set to value in binary encoding (will be allocated)
- * @param data_size set to number of bytes in @a data
- * @return #GNUNET_OK on success
- */
-static int
-gnuid_string_to_value_attest (void *cls,
-                              uint32_t type,
-                              const char *s,
-                              void **data,
-                              size_t *data_size)
-{
-  if (NULL == s)
-    return GNUNET_SYSERR;
-  switch (type)
-  {
-  case GNUNET_RECLAIM_ATTESTATION_TYPE_JWT:
-    *data = GNUNET_strdup (s);
-    *data_size = strlen (s);
-    return GNUNET_OK;
-
-  default:
-    return GNUNET_SYSERR;
-  }
-}
-
-/**
- * Mapping of attribute type numbers to human-readable
- * attribute type names.
- */
-static struct
-{
-  const char *name;
-  uint32_t number;
-} gnuid_name_map[] = { { "STRING", GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING },
-                       { NULL, UINT32_MAX } };
-
-/**
- * Mapping of attestation type numbers to human-readable
- * attestation type names.
- */
-static struct
-{
-  const char *name;
-  uint32_t number;
-} gnuid_attest_name_map[] = { { "JWT", GNUNET_RECLAIM_ATTESTATION_TYPE_JWT },
-                              { NULL, UINT32_MAX } };
-
-/**
- * Convert a type name to the corresponding number.
- *
- * @param cls closure, unused
- * @param gnuid_typename name to convert
- * @return corresponding number, UINT32_MAX on error
- */
-static uint32_t
-gnuid_typename_to_number (void *cls, const char *gnuid_typename)
-{
-  unsigned int i;
-
-  i = 0;
-  while ((NULL != gnuid_name_map[i].name) &&
-         (0 != strcasecmp (gnuid_typename, gnuid_name_map[i].name)))
-    i++;
-  return gnuid_name_map[i].number;
-}
-
-
-/**
- * Convert a type number (i.e. 1) to the corresponding type string
- *
- * @param cls closure, unused
- * @param type number of a type to convert
- * @return corresponding typestring, NULL on error
- */
-static const char *
-gnuid_number_to_typename (void *cls, uint32_t type)
-{
-  unsigned int i;
-
-  i = 0;
-  while ((NULL != gnuid_name_map[i].name) && (type != 
gnuid_name_map[i].number))
-    i++;
-  return gnuid_name_map[i].name;
-}
-
-/**
-   * Convert a type name to the corresponding number.
-   *
-   * @param cls closure, unused
-   * @param gnuid_typename name to convert
-   * @return corresponding number, UINT32_MAX on error
-   */
-static uint32_t
-gnuid_typename_to_number_attest (void *cls, const char *gnuid_typename)
-{
-  unsigned int i;
-
-  i = 0;
-  while ((NULL != gnuid_attest_name_map[i].name) &&
-         (0 != strcasecmp (gnuid_typename, gnuid_attest_name_map[i].name)))
-    i++;
-  return gnuid_attest_name_map[i].number;
-}
-
-/**
- * Convert a type number (i.e. 1) to the corresponding type string
- *
- * @param cls closure, unused
- * @param type number of a type to convert
- * @return corresponding typestring, NULL on error
- */
-static const char *
-gnuid_number_to_typename_attest (void *cls, uint32_t type)
-{
-  unsigned int i;
-
-  i = 0;
-  while ((NULL != gnuid_attest_name_map[i].name) && (type !=
-                                                     gnuid_attest_name_map[i].
-                                                     number))
-    i++;
-  return gnuid_attest_name_map[i].name;
-}
-
-/**
- * Entry point for the plugin.
- *
- * @param cls NULL
- * @return the exported block API
- */
-void *
-libgnunet_plugin_reclaim_attribute_gnuid_init (void *cls)
-{
-  struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions *api;
-
-  api = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions);
-  api->value_to_string = &gnuid_value_to_string;
-  api->string_to_value = &gnuid_string_to_value;
-  api->typename_to_number = &gnuid_typename_to_number;
-  api->number_to_typename = &gnuid_number_to_typename;
-  api->value_to_string_attest = &gnuid_value_to_string_attest;
-  api->string_to_value_attest = &gnuid_string_to_value_attest;
-  api->typename_to_number_attest = &gnuid_typename_to_number_attest;
-  api->number_to_typename_attest = &gnuid_number_to_typename_attest;
-  return api;
-}
-
-
-/**
- * Exit point from the plugin.
- *
- * @param cls the return value from #libgnunet_plugin_block_test_init()
- * @return NULL
- */
-void *
-libgnunet_plugin_reclaim_attribute_gnuid_done (void *cls)
-{
-  struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions *api = cls;
-
-  GNUNET_free (api);
-  return NULL;
-}
-
-
-/* end of plugin_reclaim_attribute_type_gnuid.c */
diff --git a/src/reclaim-attribute/reclaim_attribute.c 
b/src/reclaim-attribute/reclaim_attribute.c
deleted file mode 100644
index 43199c108..000000000
--- a/src/reclaim-attribute/reclaim_attribute.c
+++ /dev/null
@@ -1,1055 +0,0 @@
-/*
-   This file is part of GNUnet
-   Copyright (C) 2010-2015 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   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 reclaim-attribute/reclaim_attribute.c
- * @brief helper library to manage identity attributes
- * @author Martin Schanzenbach
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_reclaim_attribute_plugin.h"
-#include "reclaim_attribute.h"
-
-
-/**
- * Handle for a plugin
- */
-struct Plugin
-{
-  /**
-   * Name of the plugin
-   */
-  char *library_name;
-
-  /**
-   * Plugin API
-   */
-  struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions *api;
-};
-
-
-/**
- * Plugins
- */
-static struct Plugin **attr_plugins;
-
-
-/**
- * Number of plugins
- */
-static unsigned int num_plugins;
-
-
-/**
- * Init canary
- */
-static int initialized;
-
-
-/**
- * Add a plugin
- *
- * @param cls closure
- * @param library_name name of the API library
- * @param lib_ret the plugin API pointer
- */
-static void
-add_plugin (void *cls, const char *library_name, void *lib_ret)
-{
-  struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions *api = lib_ret;
-  struct Plugin *plugin;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Loading attribute plugin `%s'\n",
-              library_name);
-  plugin = GNUNET_new (struct Plugin);
-  plugin->api = api;
-  plugin->library_name = GNUNET_strdup (library_name);
-  GNUNET_array_append (attr_plugins, num_plugins, plugin);
-}
-
-
-/**
- * Load plugins
- */
-static void
-init ()
-{
-  if (GNUNET_YES == initialized)
-    return;
-  initialized = GNUNET_YES;
-  GNUNET_PLUGIN_load_all ("libgnunet_plugin_reclaim_attribute_",
-                          NULL,
-                          &add_plugin,
-                          NULL);
-}
-
-
-/**
- * Convert a type name to the corresponding number
- *
- * @param typename name to convert
- * @return corresponding number, UINT32_MAX on error
- */
-uint32_t
-GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (const char *typename)
-{
-  unsigned int i;
-  struct Plugin *plugin;
-  uint32_t ret;
-
-  init ();
-  for (i = 0; i < num_plugins; i++)
-  {
-    plugin = attr_plugins[i];
-    if (UINT32_MAX !=
-        (ret = plugin->api->typename_to_number (plugin->api->cls, typename)))
-      return ret;
-  }
-  return UINT32_MAX;
-}
-
-
-/**
- * Convert a type number to the corresponding type string
- *
- * @param type number of a type
- * @return corresponding typestring, NULL on error
- */
-const char *
-GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (uint32_t type)
-{
-  unsigned int i;
-  struct Plugin *plugin;
-  const char *ret;
-
-  init ();
-  for (i = 0; i < num_plugins; i++)
-  {
-    plugin = attr_plugins[i];
-    if (NULL !=
-        (ret = plugin->api->number_to_typename (plugin->api->cls, type)))
-      return ret;
-  }
-  return NULL;
-}
-
-
-/**
- * Convert human-readable version of a 'claim' of an attribute to the binary
- * representation
- *
- * @param type type of the claim
- * @param s human-readable string
- * @param data set to value in binary encoding (will be allocated)
- * @param data_size set to number of bytes in @a data
- * @return #GNUNET_OK on success
- */
-int
-GNUNET_RECLAIM_ATTRIBUTE_string_to_value (uint32_t type,
-                                          const char *s,
-                                          void **data,
-                                          size_t *data_size)
-{
-  unsigned int i;
-  struct Plugin *plugin;
-
-  init ();
-  for (i = 0; i < num_plugins; i++)
-  {
-    plugin = attr_plugins[i];
-    if (GNUNET_OK == plugin->api->string_to_value (plugin->api->cls,
-                                                   type,
-                                                   s,
-                                                   data,
-                                                   data_size))
-      return GNUNET_OK;
-  }
-  return GNUNET_SYSERR;
-}
-
-
-/**
- * Convert the 'claim' of an attribute to a string
- *
- * @param type the type of attribute
- * @param data claim in binary encoding
- * @param data_size number of bytes in @a data
- * @return NULL on error, otherwise human-readable representation of the claim
- */
-char *
-GNUNET_RECLAIM_ATTRIBUTE_value_to_string (uint32_t type,
-                                          const void *data,
-                                          size_t data_size)
-{
-  unsigned int i;
-  struct Plugin *plugin;
-  char *ret;
-
-  init ();
-  for (i = 0; i < num_plugins; i++)
-  {
-    plugin = attr_plugins[i];
-    if (NULL != (ret = plugin->api->value_to_string (plugin->api->cls,
-                                                     type,
-                                                     data,
-                                                     data_size)))
-      return ret;
-  }
-  return NULL;
-}
-
-/**
-   * Convert an attestation type name to the corresponding number
-   *
-   * @param typename name to convert
-   * @return corresponding number, UINT32_MAX on error
-   */
-uint32_t
-GNUNET_RECLAIM_ATTESTATION_typename_to_number (const char *typename)
-{
-  unsigned int i;
-  struct Plugin *plugin;
-  uint32_t ret;
-  init ();
-  for (i = 0; i < num_plugins; i++)
-  {
-    plugin = attr_plugins[i];
-    if (UINT32_MAX !=
-        (ret = plugin->api->typename_to_number_attest (plugin->api->cls,
-                                                       typename)))
-      return ret;
-  }
-  return UINT32_MAX;
-}
-
-/**
- * Convert an attestation type number to the corresponding attestation type 
string
- *
- * @param type number of a type
- * @return corresponding typestring, NULL on error
- */
-const char *
-GNUNET_RECLAIM_ATTESTATION_number_to_typename (uint32_t type)
-{
-  unsigned int i;
-  struct Plugin *plugin;
-  const char *ret;
-
-  init ();
-  for (i = 0; i < num_plugins; i++)
-  {
-    plugin = attr_plugins[i];
-    if (NULL !=
-        (ret = plugin->api->number_to_typename_attest (plugin->api->cls, 
type)))
-      return ret;
-  }
-  return NULL;
-}
-/**
- * Convert human-readable version of a 'claim' of an attestation to the binary
- * representation
- *
- * @param type type of the claim
- * @param s human-readable string
- * @param data set to value in binary encoding (will be allocated)
- * @param data_size set to number of bytes in @a data
- * @return #GNUNET_OK on success
- */
-int
-GNUNET_RECLAIM_ATTESTATION_string_to_value (uint32_t type,
-                                            const char *s,
-                                            void **data,
-                                            size_t *data_size)
-{
-  unsigned int i;
-  struct Plugin *plugin;
-
-  init ();
-  for (i = 0; i < num_plugins; i++)
-  {
-    plugin = attr_plugins[i];
-    if (GNUNET_OK == plugin->api->string_to_value_attest (plugin->api->cls,
-                                                          type,
-                                                          s,
-                                                          data,
-                                                          data_size))
-      return GNUNET_OK;
-  }
-  return GNUNET_SYSERR;
-}
-
-
-/**
- * Convert the 'claim' of an attestation to a string
- *
- * @param type the type of attestation
- * @param data claim in binary encoding
- * @param data_size number of bytes in @a data
- * @return NULL on error, otherwise human-readable representation of the claim
- */
-char *
-GNUNET_RECLAIM_ATTESTATION_value_to_string (uint32_t type,
-                                            const void *data,
-                                            size_t data_size)
-{
-  unsigned int i;
-  struct Plugin *plugin;
-  char *ret;
-
-  init ();
-  for (i = 0; i < num_plugins; i++)
-  {
-    plugin = attr_plugins[i];
-    if (NULL != (ret = plugin->api->value_to_string_attest (plugin->api->cls,
-                                                            type,
-                                                            data,
-                                                            data_size)))
-      return ret;
-  }
-  return NULL;
-}
-
-/**
- * Create a new attribute.
- *
- * @param attr_name the attribute name
- * @param type the attribute type
- * @param data the attribute value
- * @param data_size the attribute value size
- * @return the new attribute
- */
-struct GNUNET_RECLAIM_ATTRIBUTE_Claim *
-GNUNET_RECLAIM_ATTRIBUTE_claim_new (const char *attr_name,
-                                    uint32_t type,
-                                    const void *data,
-                                    size_t data_size)
-{
-  struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr;
-  char *write_ptr;
-  char *attr_name_tmp = GNUNET_strdup (attr_name);
-
-  GNUNET_STRINGS_utf8_tolower (attr_name, attr_name_tmp);
-
-  attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_Claim)
-                        + strlen (attr_name_tmp) + 1 + data_size);
-  attr->type = type;
-  attr->data_size = data_size;
-  attr->flag = 0;
-  write_ptr = (char *) &attr[1];
-  GNUNET_memcpy (write_ptr, attr_name_tmp, strlen (attr_name_tmp) + 1);
-  attr->name = write_ptr;
-  write_ptr += strlen (attr->name) + 1;
-  GNUNET_memcpy (write_ptr, data, data_size);
-  attr->data = write_ptr;
-  GNUNET_free (attr_name_tmp);
-  return attr;
-}
-
-/**
-   * Create a new attestation.
-   *
-   * @param attr_name the attestation name
-   * @param type the attestation type
-   * @param data the attestation value
-   * @param data_size the attestation value size
-   * @return the new attestation
-   */
-struct GNUNET_RECLAIM_ATTESTATION_Claim *
-GNUNET_RECLAIM_ATTESTATION_claim_new (const char *attr_name,
-                                      uint32_t type,
-                                      const void *data,
-                                      size_t data_size)
-{
-  struct GNUNET_RECLAIM_ATTESTATION_Claim *attr;
-  char *write_ptr;
-  char *attr_name_tmp = GNUNET_strdup (attr_name);
-
-  GNUNET_STRINGS_utf8_tolower (attr_name, attr_name_tmp);
-
-  attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_ATTESTATION_Claim)
-                        + strlen (attr_name_tmp) + 1 + data_size);
-  attr->type = type;
-  attr->data_size = data_size;
-  attr->version = 0;
-  write_ptr = (char *) &attr[1];
-  GNUNET_memcpy (write_ptr, attr_name_tmp, strlen (attr_name_tmp) + 1);
-  attr->name = write_ptr;
-  write_ptr += strlen (attr->name) + 1;
-  GNUNET_memcpy (write_ptr, data, data_size);
-  attr->data = write_ptr;
-  GNUNET_free (attr_name_tmp);
-  return attr;
-}
-
-/**
- * Create a new attestation reference.
- *
- * @param attr_name the referenced claim name
- * @param ref_value the claim name in the attestation
- * @return the new reference
- */
-struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *
-GNUNET_RECLAIM_ATTESTATION_reference_new (const char *attr_name,
-                                          const char *ref_value)
-{
-  struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr;
-  char *write_ptr;
-  char *attr_name_tmp = GNUNET_strdup (attr_name);
-  char *ref_value_tmp = GNUNET_strdup (ref_value);
-
-  GNUNET_STRINGS_utf8_tolower (attr_name, attr_name_tmp);
-  GNUNET_STRINGS_utf8_tolower (ref_value, ref_value_tmp);
-
-  attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_ATTESTATION_REFERENCE)
-                        + strlen (attr_name_tmp) + strlen (ref_value_tmp) + 2);
-
-  write_ptr = (char *) &attr[1];
-  GNUNET_memcpy (write_ptr, attr_name_tmp, strlen (attr_name_tmp) + 1);
-  attr->name = write_ptr;
-
-  write_ptr += strlen (attr_name) + 1;
-  GNUNET_memcpy (write_ptr, ref_value_tmp, strlen (ref_value_tmp) + 1);
-  attr->reference_value = write_ptr;
-
-  GNUNET_free (attr_name_tmp);
-  GNUNET_free (ref_value_tmp);
-  return attr;
-}
-
-/**
- * Add a new attribute to a claim list
- *
- * @param attr_name the name of the new attribute claim
- * @param type the type of the claim
- * @param data claim payload
- * @param data_size claim payload size
- */
-void
-GNUNET_RECLAIM_ATTRIBUTE_list_add (
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *claim_list,
-  const char *attr_name,
-  uint32_t type,
-  const void *data,
-  size_t data_size)
-{
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
-
-  le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
-  le->claim =
-    GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr_name, type, data, data_size);
-  GNUNET_CONTAINER_DLL_insert (claim_list->list_head,
-                               claim_list->list_tail,
-                               le);
-}
-
-
-/**
- * Get required size for serialization buffer
- *
- * @param attrs the attribute list to serialize
- * @return the required buffer size
- */
-size_t
-GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (
-  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
-{
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
-  size_t len = 0;
-
-  for (le = attrs->list_head; NULL != le; le = le->next)
-  {
-    if (NULL != le->claim)
-    {
-      len += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
-      len += GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (le->claim);
-    }
-    else if (NULL != le->attest )
-    {
-      len += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
-      len += GNUNET_RECLAIM_ATTESTATION_serialize_get_size (le->attest);
-    }
-    else if (NULL != le->reference)
-    {
-      len += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
-      len += GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size (le->reference);
-    }
-    else
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Unserialized Claim List Entry Type for size not known.\n");
-      break;
-    }
-    len += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
-  }
-  return len;
-}
-
-
-/**
- * Serialize an attribute list
- *
- * @param attrs the attribute list to serialize
- * @param result the serialized attribute
- * @return length of serialized data
- */
-size_t
-GNUNET_RECLAIM_ATTRIBUTE_list_serialize (
-  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
-  char *result)
-{
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
-  size_t len;
-  size_t total_len;
-  char *write_ptr;
-  write_ptr = result;
-  total_len = 0;
-  for (le = attrs->list_head; NULL != le; le = le->next)
-  {
-    struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType *list_type;
-    if (NULL != le->claim)
-    {
-      list_type = (struct
-                   GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType *) write_ptr;
-      list_type->type = htons (1);
-      total_len += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
-      write_ptr += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
-      len = GNUNET_RECLAIM_ATTRIBUTE_serialize (le->claim, write_ptr);
-      total_len += len;
-      write_ptr += len;
-    }
-    else if (NULL != le->attest )
-    {
-      list_type = (struct
-                   GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType *) write_ptr;
-      list_type->type = htons (2);
-      total_len += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
-      write_ptr += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
-      len = GNUNET_RECLAIM_ATTESTATION_serialize (le->attest, write_ptr);
-      total_len += len;
-      write_ptr += len;
-    }
-    else if (NULL != le->reference)
-    {
-      list_type = (struct
-                   GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType *) write_ptr;
-      list_type->type = htons (3);
-      total_len += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
-      write_ptr += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
-      len = GNUNET_RECLAIM_ATTESTATION_REF_serialize (le->reference, 
write_ptr);
-      total_len += len;
-      write_ptr += len;
-    }
-    else
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Unserialized Claim List Entry Type not known.\n");
-      continue;
-    }
-  }
-  return total_len;
-}
-
-
-/**
- * Deserialize an attribute list
- *
- * @param data the serialized attribute list
- * @param data_size the length of the serialized data
- * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller
- */
-struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *
-GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (const char *data, size_t data_size)
-{
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
-  size_t attr_len;
-  const char *read_ptr;
-
-  if ((data_size < sizeof(struct Attribute) + sizeof(struct
-                                                     
GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry))
-      && (data_size < sizeof(struct
-                             Attestation)
-          + sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry)) &&
-      (data_size < sizeof(struct Attestation_Reference) + sizeof(struct
-                                                                 
GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry)) )
-    return NULL;
-
-  attrs = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
-  read_ptr = data;
-  while (((data + data_size) - read_ptr) >= sizeof(struct Attribute))
-  {
-    struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType *list_type;
-    list_type = (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType *) 
read_ptr;
-    if (1 == ntohs (list_type->type))
-    {
-      le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
-      read_ptr += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
-      if (((data + data_size) - read_ptr) < sizeof(struct Attribute))
-        break;
-      le->attest = NULL;
-      le->reference = NULL;
-      le->claim =
-        GNUNET_RECLAIM_ATTRIBUTE_deserialize (read_ptr,
-                                              data_size - (read_ptr - data));
-      GNUNET_CONTAINER_DLL_insert (attrs->list_head, attrs->list_tail, le);
-      attr_len = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (le->claim);
-      read_ptr += attr_len;
-    }
-    else if (2 == ntohs (list_type->type))
-    {
-      le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
-      read_ptr += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
-      if (((data + data_size) - read_ptr) < sizeof(struct Attestation))
-        break;
-      le->claim = NULL;
-      le->reference = NULL;
-      le->attest =
-        GNUNET_RECLAIM_ATTESTATION_deserialize (read_ptr,
-                                                data_size - (read_ptr - data));
-      GNUNET_CONTAINER_DLL_insert (attrs->list_head, attrs->list_tail, le);
-      attr_len = GNUNET_RECLAIM_ATTESTATION_serialize_get_size (le->attest);
-      read_ptr += attr_len;
-    }
-    else if (3 == ntohs (list_type->type))
-    {
-      le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
-      read_ptr += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
-      if (((data + data_size) - read_ptr) < sizeof(struct
-                                                   Attestation_Reference))
-        break;
-      le->claim = NULL;
-      le->attest = NULL;
-      le->reference =
-        GNUNET_RECLAIM_ATTESTATION_REF_deserialize (read_ptr,
-                                                    data_size - (read_ptr
-                                                                 - data));
-      GNUNET_CONTAINER_DLL_insert (attrs->list_head, attrs->list_tail, le);
-      attr_len = GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size (
-        le->reference);
-      read_ptr += attr_len;
-    }
-    else
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Serialized Claim List Entry Type not known.\n");
-      break;
-    }
-  }
-  return attrs;
-}
-
-
-/**
- * Make a (deep) copy of a claim list
- * @param attrs claim list to copy
- * @return copied claim list
- */
-struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *
-GNUNET_RECLAIM_ATTRIBUTE_list_dup (
-  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
-{
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *result_le;
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *result;
-
-  result = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
-  if (NULL == attrs->list_head)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Duplicating empty List\n");
-  }
-  for (le = attrs->list_head; NULL != le; le = le->next)
-  {
-    result_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
-    result_le->claim = NULL;
-    result_le->attest = NULL;
-    result_le->reference = NULL;
-    if (NULL != le->claim)
-    {
-      result_le->claim =
-        GNUNET_RECLAIM_ATTRIBUTE_claim_new (le->claim->name,
-                                            le->claim->type,
-                                            le->claim->data,
-                                            le->claim->data_size);
-
-      result_le->claim->id = le->claim->id;
-      result_le->claim->flag = le->claim->flag;
-    }
-    if ( NULL != le->attest)
-    {
-      result_le->attest = GNUNET_RECLAIM_ATTESTATION_claim_new (
-        le->attest->name,
-        le->attest->type,
-        le->attest->data,
-        le->attest->
-        data_size);
-      result_le->attest->id = le->attest->id;
-    }
-    if (NULL !=le->reference)
-    {
-      result_le->reference = GNUNET_RECLAIM_ATTESTATION_reference_new (
-        le->reference->name,
-        le->reference->reference_value);
-      result_le->reference->id = le->reference->id;
-      result_le->reference->id_attest = le->reference->id_attest;
-    }
-    GNUNET_CONTAINER_DLL_insert (result->list_head,
-                                 result->list_tail,
-                                 result_le);
-  }
-  return result;
-}
-
-
-/**
- * Destroy claim list
- *
- * @param attrs list to destroy
- */
-void
-GNUNET_RECLAIM_ATTRIBUTE_list_destroy (
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
-{
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *tmp_le;
-
-  for (le = attrs->list_head; NULL != le; le = le->next)
-  {
-    if (NULL != le->claim)
-      GNUNET_free (le->claim);
-    if (NULL != le->attest)
-      GNUNET_free (le->attest);
-    if (NULL != le->reference)
-      GNUNET_free (le->reference);
-    tmp_le = le;
-    le = le->next;
-    GNUNET_free (tmp_le);
-  }
-  GNUNET_free (attrs);
-}
-
-/**
- * Count attestations in claim list
- *
- * @param attrs list
- */
-int
-GNUNET_RECLAIM_ATTRIBUTE_list_count_attest (
-  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
-{
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
-  int i = 0;
-  for (le = attrs->list_head; NULL != le; le = le->next)
-  {
-    if (NULL != le->attest)
-      i++;
-  }
-  return i;
-}
-/**
- * Get required size for serialization buffer
- *
- * @param attr the attribute to serialize
- * @return the required buffer size
- */
-size_t
-GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (
-  const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
-{
-  return sizeof(struct Attribute) + strlen (attr->name) + attr->data_size;
-}
-
-
-/**
- * Serialize an attribute
- *
- * @param attr the attribute to serialize
- * @param result the serialized attribute
- * @return length of serialized data
- */
-size_t
-GNUNET_RECLAIM_ATTRIBUTE_serialize (
-  const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-  char *result)
-{
-  size_t data_len_ser;
-  size_t name_len;
-  struct Attribute *attr_ser;
-  char *write_ptr;
-
-  attr_ser = (struct Attribute *) result;
-  attr_ser->attribute_type = htons (attr->type);
-  attr_ser->attribute_version = htonl (attr->flag);
-  attr_ser->attribute_id = GNUNET_htonll (attr->id);
-  name_len = strlen (attr->name);
-  attr_ser->name_len = htons (name_len);
-  write_ptr = (char *) &attr_ser[1];
-  GNUNET_memcpy (write_ptr, attr->name, name_len);
-  write_ptr += name_len;
-  // TODO plugin-ize
-  // data_len_ser = plugin->serialize_attribute_value (attr,
-  //                                                  &attr_ser[1]);
-  data_len_ser = attr->data_size;
-  GNUNET_memcpy (write_ptr, attr->data, attr->data_size);
-  attr_ser->data_size = htons (data_len_ser);
-
-  return sizeof(struct Attribute) + strlen (attr->name) + attr->data_size;
-}
-
-
-/**
- * Deserialize an attribute
- *
- * @param data the serialized attribute
- * @param data_size the length of the serialized data
- *
- * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
- */
-struct GNUNET_RECLAIM_ATTRIBUTE_Claim *
-GNUNET_RECLAIM_ATTRIBUTE_deserialize (const char *data, size_t data_size)
-{
-  struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr;
-  struct Attribute *attr_ser;
-  size_t data_len;
-  size_t name_len;
-  char *write_ptr;
-
-  if (data_size < sizeof(struct Attribute))
-    return NULL;
-
-  attr_ser = (struct Attribute *) data;
-  data_len = ntohs (attr_ser->data_size);
-  name_len = ntohs (attr_ser->name_len);
-  if (data_size < sizeof(struct Attribute) + data_len + name_len)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Buffer too small to deserialize\n");
-    return NULL;
-  }
-  attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_Claim)
-                        + data_len + name_len + 1);
-  attr->type = ntohs (attr_ser->attribute_type);
-  attr->flag = ntohl (attr_ser->attribute_version);
-  attr->id = GNUNET_ntohll (attr_ser->attribute_id);
-  attr->data_size = data_len;
-
-  write_ptr = (char *) &attr[1];
-  GNUNET_memcpy (write_ptr, &attr_ser[1], name_len);
-  write_ptr[name_len] = '\0';
-  attr->name = write_ptr;
-
-  write_ptr += name_len + 1;
-  GNUNET_memcpy (write_ptr, (char *) &attr_ser[1] + name_len, attr->data_size);
-  attr->data = write_ptr;
-  return attr;
-}
-
-
-/**
- * Get required size for serialization buffer
- *
- * @param attr the attestation to serialize
- * @return the required buffer size
- */
-size_t
-GNUNET_RECLAIM_ATTESTATION_serialize_get_size (
-  const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr)
-{
-  return sizeof(struct Attestation) + strlen (attr->name) + attr->data_size;
-}
-
-/**
- * Serialize an attestation
- *
- * @param attr the attestation to serialize
- * @param result the serialized attestation
- * @return length of serialized data
- */
-size_t
-GNUNET_RECLAIM_ATTESTATION_serialize (
-  const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr,
-  char *result)
-{
-  size_t data_len_ser;
-  size_t name_len;
-  struct Attestation *attr_ser;
-  char *write_ptr;
-
-  attr_ser = (struct Attestation *) result;
-  attr_ser->attestation_type = htons (attr->type);
-  attr_ser->attestation_version = htonl (attr->version);
-  attr_ser->attestation_id = GNUNET_htonll (attr->id);
-  name_len = strlen (attr->name);
-  attr_ser->name_len = htons (name_len);
-  write_ptr = (char *) &attr_ser[1];
-  GNUNET_memcpy (write_ptr, attr->name, name_len);
-  write_ptr += name_len;
-  // TODO plugin-ize
-  // data_len_ser = plugin->serialize_attribute_value (attr,
-  //                                                  &attr_ser[1]);
-  data_len_ser = attr->data_size;
-  GNUNET_memcpy (write_ptr, attr->data, attr->data_size);
-  attr_ser->data_size = htons (data_len_ser);
-
-  return sizeof(struct Attestation) + strlen (attr->name) + attr->data_size;
-}
-
-/**
- * Deserialize an attestation
- *
- * @param data the serialized attestation
- * @param data_size the length of the serialized data
- *
- * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
- */
-struct GNUNET_RECLAIM_ATTESTATION_Claim *
-GNUNET_RECLAIM_ATTESTATION_deserialize (const char *data, size_t data_size)
-{
-  struct GNUNET_RECLAIM_ATTESTATION_Claim *attr;
-  struct Attestation *attr_ser;
-  size_t data_len;
-  size_t name_len;
-  char *write_ptr;
-
-  if (data_size < sizeof(struct Attestation))
-    return NULL;
-
-  attr_ser = (struct Attestation *) data;
-  data_len = ntohs (attr_ser->data_size);
-  name_len = ntohs (attr_ser->name_len);
-  if (data_size < sizeof(struct Attestation) + data_len + name_len)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Buffer too small to deserialize\n");
-    return NULL;
-  }
-  attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_ATTESTATION_Claim)
-                        + data_len + name_len + 1);
-  attr->type = ntohs (attr_ser->attestation_type);
-  attr->version = ntohl (attr_ser->attestation_version);
-  attr->id = GNUNET_ntohll (attr_ser->attestation_id);
-  attr->data_size = data_len;
-
-  write_ptr = (char *) &attr[1];
-  GNUNET_memcpy (write_ptr, &attr_ser[1], name_len);
-  write_ptr[name_len] = '\0';
-  attr->name = write_ptr;
-
-  write_ptr += name_len + 1;
-  GNUNET_memcpy (write_ptr, (char *) &attr_ser[1] + name_len, attr->data_size);
-  attr->data = write_ptr;
-  return attr;
-}
-
-/**
- * Get required size for serialization buffer
- *
- * @param attr the reference to serialize
- * @return the required buffer size
- */
-size_t
-GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size (
-  const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr)
-{
-  return sizeof(struct Attestation_Reference) + strlen (attr->name) + strlen (
-    attr->reference_value);
-}
-
-
-/**
- * Serialize a reference
- *
- * @param attr the reference to serialize
- * @param result the serialized reference
- * @return length of serialized data
- */
-size_t
-GNUNET_RECLAIM_ATTESTATION_REF_serialize (
-  const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr,
-  char *result)
-{
-  size_t name_len;
-  size_t refval_len;
-  struct Attestation_Reference *attr_ser;
-  char *write_ptr;
-  attr_ser = (struct Attestation_Reference *) result;
-  attr_ser->reference_id = GNUNET_htonll (attr->id);
-  attr_ser->attestation_id = GNUNET_htonll (attr->id_attest);
-  name_len = strlen (attr->name);
-  refval_len = strlen (attr->reference_value);
-  attr_ser->name_len = htons (name_len);
-  attr_ser->ref_value_len = htons (refval_len);
-  write_ptr = (char *) &attr_ser[1];
-  GNUNET_memcpy (write_ptr, attr->name, name_len);
-  write_ptr += name_len;
-  GNUNET_memcpy (write_ptr, attr->reference_value, refval_len);
-
-  return sizeof(struct Attestation_Reference) + strlen (attr->name) + strlen (
-    attr->reference_value);
-}
-
-
-/**
- * Deserialize a reference
- *
- * @param data the serialized reference
- * @param data_size the length of the serialized data
- *
- * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
- */
-struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *
-GNUNET_RECLAIM_ATTESTATION_REF_deserialize (const char *data, size_t data_size)
-{
-  struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr;
-  struct Attestation_Reference *attr_ser;
-  size_t name_len;
-  size_t refval_len;
-  char *write_ptr;
-
-  if (data_size < sizeof(struct Attestation_Reference))
-    return NULL;
-  attr_ser = (struct Attestation_Reference *) data;
-  name_len = ntohs (attr_ser->name_len);
-  refval_len = ntohs (attr_ser->ref_value_len);
-  if (data_size < sizeof(struct Attestation_Reference) + refval_len + name_len)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Buffer too small to deserialize\n");
-    return NULL;
-  }
-  attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_ATTESTATION_REFERENCE)
-                        + refval_len + name_len + 2);
-
-  attr->id = GNUNET_ntohll (attr_ser->reference_id);
-  attr->id_attest = GNUNET_ntohll (attr_ser->attestation_id);
-
-  write_ptr = (char *) &attr[1];
-  GNUNET_memcpy (write_ptr, &attr_ser[1], name_len);
-  write_ptr[name_len] = '\0';
-  attr->name = write_ptr;
-
-  write_ptr += name_len + 1;
-  GNUNET_memcpy (write_ptr, (char *) &attr_ser[1] + name_len, refval_len);
-  write_ptr[refval_len] = '\0';
-  attr->reference_value = write_ptr;
-  return attr;
-}
-/* end of reclaim_attribute.c */
diff --git a/src/reclaim/Makefile.am b/src/reclaim/Makefile.am
index 51b9b9c5b..9242d6d79 100644
--- a/src/reclaim/Makefile.am
+++ b/src/reclaim/Makefile.am
@@ -34,6 +34,8 @@ lib_LTLIBRARIES = \
   libgnunetreclaim.la
 plugin_LTLIBRARIES = \
   libgnunet_plugin_gnsrecord_reclaim.la \
+  libgnunet_plugin_reclaim_attribute_basic.la \
+  libgnunet_plugin_reclaim_attestation_jwt.la \
   $(REST_PLUGIN)
 
 bin_PROGRAMS = \
@@ -51,7 +53,6 @@ libgnunet_plugin_rest_reclaim_la_LIBADD = \
   libgnunetreclaim.la \
   $(top_builddir)/src/json/libgnunetjson.la \
   $(top_builddir)/src/rest/libgnunetrest.la \
-  $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
   $(top_builddir)/src/namestore/libgnunetnamestore.la \
   $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
   $(LTLIBINTL) -ljansson $(MHD_LIBS)
@@ -68,7 +69,6 @@ libgnunet_plugin_rest_openid_connect_la_LIBADD = \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   libgnunetreclaim.la \
   $(top_builddir)/src/rest/libgnunetrest.la \
-  $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
   $(top_builddir)/src/namestore/libgnunetnamestore.la \
   $(top_builddir)/src/gns/libgnunetgns.la \
   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
@@ -98,22 +98,43 @@ gnunet_service_reclaim_LDADD = \
  $(top_builddir)/src/util/libgnunetutil.la \
  $(top_builddir)/src/namestore/libgnunetnamestore.la \
  $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
  libgnunetreclaim.la \
  $(top_builddir)/src/gns/libgnunetgns.la \
  $(GN_LIBINTL)
 
 libgnunetreclaim_la_SOURCES = \
  reclaim_api.c \
- reclaim.h
+ reclaim.h \
+ reclaim_attribute.c \
+ reclaim_attribute.h \
+ reclaim_attestation.c \
+ reclaim_attestation.h
 libgnunetreclaim_la_LIBADD = \
   $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
   $(GN_LIBINTL) $(XLIB)
 libgnunetreclaim_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)   \
   -version-info 0:0:0
 
+
+libgnunet_plugin_reclaim_attribute_basic_la_SOURCES = \
+  plugin_reclaim_attribute_basic.c
+libgnunet_plugin_reclaim_attribute_basic_la_LIBADD = \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(LTLIBINTL)
+libgnunet_plugin_reclaim_attribute_basic_la_LDFLAGS = \
+ $(GN_PLUGIN_LDFLAGS)
+
+libgnunet_plugin_reclaim_attestation_jwt_la_SOURCES = \
+  plugin_reclaim_attestation_jwt.c
+libgnunet_plugin_reclaim_attestation_jwt_la_LIBADD = \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  libgnunetreclaim.la \
+  -ljansson\
+  $(LTLIBINTL)
+libgnunet_plugin_reclaim_attestation_jwt_la_LDFLAGS = \
+ $(GN_PLUGIN_LDFLAGS)
+
 gnunet_reclaim_SOURCES = \
  gnunet-reclaim.c
 gnunet_reclaim_LDADD = \
@@ -121,7 +142,6 @@ gnunet_reclaim_LDADD = \
   $(top_builddir)/src/namestore/libgnunetnamestore.la \
   libgnunetreclaim.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
   $(GN_LIBINTL)
 
 check_SCRIPTS = \
diff --git a/src/reclaim/gnunet-reclaim.c b/src/reclaim/gnunet-reclaim.c
index 5f9170f05..e7ee814b6 100644
--- a/src/reclaim/gnunet-reclaim.c
+++ b/src/reclaim/gnunet-reclaim.c
@@ -42,6 +42,31 @@ static int ret;
  */
 static int list;
 
+/**
+ * List attestations flag
+ */
+static int list_attestations;
+
+/**
+ * Attestation ID string
+ */
+static char *attestation_id;
+
+/**
+ * Attestation ID
+ */
+static struct GNUNET_RECLAIM_Identifier attestation;
+
+/**
+ * Attestation name
+ */
+static char *attestation_name;
+
+/**
+ * Attestation exists
+ */
+static int attestation_exists;
+
 /**
  * Relying party
  */
@@ -107,6 +132,12 @@ static struct GNUNET_RECLAIM_Operation *reclaim_op;
  */
 static struct GNUNET_RECLAIM_AttributeIterator *attr_iterator;
 
+/**
+ * Attestation iterator
+ */
+static struct GNUNET_RECLAIM_AttestationIterator *attest_iterator;
+
+
 /**
  * Ticket iterator
  */
@@ -135,7 +166,7 @@ static struct GNUNET_RECLAIM_Ticket ticket;
 /**
  * Attribute list
  */
-static struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attr_list;
+static struct GNUNET_RECLAIM_AttributeList *attr_list;
 
 /**
  * Attribute expiration interval
@@ -155,7 +186,7 @@ static struct GNUNET_SCHEDULER_Task *cleanup_task;
 /**
  * Claim to store
  */
-struct GNUNET_RECLAIM_ATTRIBUTE_Claim *claim;
+struct GNUNET_RECLAIM_Attribute *claim;
 
 /**
  * Claim to delete
@@ -165,7 +196,7 @@ static char *attr_delete;
 /**
  * Claim object to delete
  */
-static struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr_to_delete;
+static struct GNUNET_RECLAIM_Attribute *attr_to_delete;
 
 static void
 do_cleanup (void *cls)
@@ -177,6 +208,8 @@ do_cleanup (void *cls)
     GNUNET_RECLAIM_cancel (reclaim_op);
   if (NULL != attr_iterator)
     GNUNET_RECLAIM_get_attributes_stop (attr_iterator);
+  if (NULL != attest_iterator)
+    GNUNET_RECLAIM_get_attestations_stop (attest_iterator);
   if (NULL != ticket_iterator)
     GNUNET_RECLAIM_ticket_iteration_stop (ticket_iterator);
   if (NULL != reclaim_handle)
@@ -212,7 +245,7 @@ ticket_issue_cb (void *cls, const struct 
GNUNET_RECLAIM_Ticket *ticket)
 
 
 static void
-store_attr_cont (void *cls, int32_t success, const char *emsg)
+store_cont (void *cls, int32_t success, const char *emsg)
 {
   reclaim_op = NULL;
   if (GNUNET_SYSERR == success)
@@ -226,9 +259,8 @@ store_attr_cont (void *cls, int32_t success, const char 
*emsg)
 static void
 process_attrs (void *cls,
                const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
-               const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-               const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, 
-               const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
+               const struct GNUNET_RECLAIM_Attribute *attr,
+               const struct GNUNET_RECLAIM_Attestation *attest)
 {
   char *value_str;
   char *id;
@@ -245,18 +277,43 @@ process_attrs (void *cls,
     ret = 1;
     return;
   }
-  value_str = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type,
-                                                        attr->data,
-                                                        attr->data_size);
-  attr_type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type);
-  id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(uint64_t));
+  attr_type = GNUNET_RECLAIM_attribute_number_to_typename (attr->type);
+  id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
+  value_str = NULL;
+  if (NULL == attest)
+  {
+    value_str = GNUNET_RECLAIM_attribute_value_to_string (attr->type,
+                                                          attr->data,
+                                                          attr->data_size);
+  }
+  else
+  {
+    struct GNUNET_RECLAIM_AttributeListEntry *ale;
+    struct GNUNET_RECLAIM_AttributeList *al
+      = GNUNET_RECLAIM_attestation_get_attributes (attest);
+
+    for (ale = al->list_head; NULL != ale; ale = ale->next)
+    {
+      if (0 != strncmp (attr->data, ale->attribute->name, attr->data_size))
+        continue;
+      value_str
+        = GNUNET_RECLAIM_attribute_value_to_string (ale->attribute->type,
+                                                    ale->attribute->
+                                                    data,
+                                                    ale->attribute->
+                                                    data_size);
+      break;
+    }
+  }
   fprintf (stdout,
-           "Name: %s; Value: %s (%s); Version %u; ID: %s\n",
+           "Name: %s; Value: %s (%s); Flag %u; ID: %s %s\n",
            attr->name,
-           value_str,
+           (NULL != value_str) ? value_str : "???",
            attr_type,
            attr->flag,
-           id);
+           id,
+           (NULL == attest) ? "" : "(ATTESTED)");
+  GNUNET_free_non_null (value_str);
   GNUNET_free (id);
 }
 
@@ -289,7 +346,7 @@ ticket_iter (void *cls, const struct GNUNET_RECLAIM_Ticket 
*ticket)
     GNUNET_STRINGS_data_to_string_alloc (&ticket->audience,
                                          sizeof(struct
                                                 GNUNET_CRYPTO_EcdsaPublicKey));
-  ref = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(uint64_t));
+  ref = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, 
sizeof(ticket->rnd));
   tkt =
     GNUNET_STRINGS_data_to_string_alloc (ticket,
                                          sizeof(struct GNUNET_RECLAIM_Ticket));
@@ -305,7 +362,9 @@ static void
 iter_error (void *cls)
 {
   attr_iterator = NULL;
-  fprintf (stderr, "Failed to iterate over attributes\n");
+  attest_iterator = NULL;
+  fprintf (stderr, "Failed\n");
+
   cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
 }
 
@@ -412,10 +471,10 @@ iter_finished (void *cls)
     if (NULL == type_str)
       type = GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING;
     else
-      type = GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (type_str);
+      type = GNUNET_RECLAIM_attribute_typename_to_number (type_str);
 
     GNUNET_assert (GNUNET_SYSERR !=
-                   GNUNET_RECLAIM_ATTRIBUTE_string_to_value (type,
+                   GNUNET_RECLAIM_attribute_string_to_value (type,
                                                              attr_value,
                                                              (void **) &data,
                                                              &data_size));
@@ -428,13 +487,17 @@ iter_finished (void *cls)
     else
     {
       claim =
-        GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr_name, type, data, data_size);
+        GNUNET_RECLAIM_attribute_new (attr_name, NULL, type, data, data_size);
+    }
+    if (NULL != attestation_id)
+    {
+      claim->attestation = attestation;
     }
     reclaim_op = GNUNET_RECLAIM_attribute_store (reclaim_handle,
                                                  pkey,
                                                  claim,
                                                  &exp_interval,
-                                                 &store_attr_cont,
+                                                 &store_cont,
                                                  NULL);
     GNUNET_free (data);
     GNUNET_free (claim);
@@ -447,11 +510,9 @@ iter_finished (void *cls)
 static void
 iter_cb (void *cls,
          const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
-         const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-         const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
-         const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
+         const struct GNUNET_RECLAIM_Attribute *attr)
 {
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
+  struct GNUNET_RECLAIM_AttributeListEntry *le;
   char *attrs_tmp;
   char *attr_str;
   char *label;
@@ -462,10 +523,11 @@ iter_cb (void *cls,
   {
     if (0 == strcasecmp (attr_name, attr->name))
     {
-      claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr->name,
-                                                  attr->type,
-                                                  attr->data,
-                                                  attr->data_size);
+      claim = GNUNET_RECLAIM_attribute_new (attr->name,
+                                            &attr->attestation,
+                                            attr->type,
+                                            attr->data,
+                                            attr->data_size);
     }
   }
   else if (issue_attrs)
@@ -479,13 +541,14 @@ iter_cb (void *cls,
         attr_str = strtok (NULL, ",");
         continue;
       }
-      le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
-      le->claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr->name,
-                                                      attr->type,
-                                                      attr->data,
-                                                      attr->data_size);
-      le->claim->flag = attr->flag;
-      le->claim->id = attr->id;
+      le = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry);
+      le->attribute = GNUNET_RECLAIM_attribute_new (attr->name,
+                                                    &attr->attestation,
+                                                    attr->type,
+                                                    attr->data,
+                                                    attr->data_size);
+      le->attribute->flag = attr->flag;
+      le->attribute->id = attr->id;
       GNUNET_CONTAINER_DLL_insert (attr_list->list_head,
                                    attr_list->list_tail,
                                    le);
@@ -495,34 +558,146 @@ iter_cb (void *cls,
   }
   else if (attr_delete && (NULL == attr_to_delete))
   {
-    label = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(uint64_t));
+    label = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
     if (0 == strcasecmp (attr_delete, label))
     {
-      attr_to_delete = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr->name,
-                                                           attr->type,
-                                                           attr->data,
-                                                           attr->data_size);
+      attr_to_delete = GNUNET_RECLAIM_attribute_new (attr->name,
+                                                     &attr->attestation,
+                                                     attr->type,
+                                                     attr->data,
+                                                     attr->data_size);
       attr_to_delete->id = attr->id;
     }
     GNUNET_free (label);
   }
   else if (list)
   {
-    attr_str = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type,
+    attr_str = GNUNET_RECLAIM_attribute_value_to_string (attr->type,
                                                          attr->data,
                                                          attr->data_size);
-    attr_type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type);
-    id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(uint64_t));
+    attr_type = GNUNET_RECLAIM_attribute_number_to_typename (attr->type);
+    id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
+    if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attr->attestation))
+    {
+      fprintf (stdout,
+               "%s: ``%s'' (%s); ID: %s\n",
+               attr->name,
+               attr_str,
+               attr_type,
+               id);
+    }
+    else
+    {
+      char *attest_id =
+        GNUNET_STRINGS_data_to_string_alloc (&attr->attestation,
+                                             sizeof(attr->attestation));
+      fprintf (stdout,
+               "%s: <``%s'' in attestation %s> (%s); ID: %s\n",
+               attr->name,
+               attr_str,
+               attest_id,
+               attr_type,
+               id);
+      GNUNET_free (attest_id);
+
+    }
+    GNUNET_free (id);
+  }
+  GNUNET_RECLAIM_get_attributes_next (attr_iterator);
+}
+
+
+static void
+attest_iter_finished (void *cls)
+{
+  attest_iterator = NULL;
+
+  // Add new attestation
+  if ((NULL != attestation_name) &&
+      (NULL != attr_value))
+  {
+    struct GNUNET_RECLAIM_Attestation *attestation =
+      GNUNET_RECLAIM_attestation_new (attestation_name,
+                                      GNUNET_RECLAIM_ATTESTATION_TYPE_JWT, // 
FIXME hardcoded
+                                      attr_value,
+                                      strlen (attr_value));
+    reclaim_op = GNUNET_RECLAIM_attestation_store (reclaim_handle,
+                                                   pkey,
+                                                   attestation,
+                                                   &exp_interval,
+                                                   store_cont,
+                                                   NULL);
+    return;
+
+  }
+  if (list_attestations)
+  {
+    cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
+    return;
+  }
+  attr_iterator = GNUNET_RECLAIM_get_attributes_start (reclaim_handle,
+                                                       pkey,
+                                                       &iter_error,
+                                                       NULL,
+                                                       &iter_cb,
+                                                       NULL,
+                                                       &iter_finished,
+                                                       NULL);
+
+}
+
+
+static void
+attest_iter_cb (void *cls,
+                const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
+                const struct GNUNET_RECLAIM_Attestation *attest)
+{
+  char *attest_str;
+  char *attr_str;
+  char *id;
+  const char *attest_type;
+  struct GNUNET_RECLAIM_AttributeListEntry *ale;
+
+  if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (&attestation,
+                                                &attest->id))
+    attestation_exists = GNUNET_YES;
+  if (list_attestations)
+  {
+    attest_str = GNUNET_RECLAIM_attestation_value_to_string (attest->type,
+                                                             attest->data,
+                                                             
attest->data_size);
+    attest_type = GNUNET_RECLAIM_attestation_number_to_typename (attest->type);
+    id = GNUNET_STRINGS_data_to_string_alloc (&attest->id, sizeof(attest->id));
     fprintf (stdout,
-             "Name: %s; Value: %s (%s); Version %u; ID: %s\n",
-             attr->name,
-             attr_str,
-             attr_type,
-             attr->flag,
+             "%s: ``%s'' (%s); ID: %s\n",
+             attest->name,
+             attest_str,
+             attest_type,
              id);
+    struct GNUNET_RECLAIM_AttributeList *attrs =
+      GNUNET_RECLAIM_attestation_get_attributes (attest);
+    if (NULL != attrs)
+    {
+      fprintf (stdout,
+               "\t Attributes:\n");
+      for (ale = attrs->list_head; NULL != ale; ale = ale->next)
+      {
+        attr_str = GNUNET_RECLAIM_attribute_value_to_string (
+          ale->attribute->type,
+          ale->attribute->
+          data,
+          ale->attribute->
+          data_size);
+
+        fprintf (stdout,
+                 "\t %s: %s\n", ale->attribute->name, attr_str);
+        GNUNET_free (attr_str);
+      }
+      GNUNET_RECLAIM_attribute_list_destroy (attrs);
+    }
     GNUNET_free (id);
   }
-  GNUNET_RECLAIM_get_attributes_next (attr_iterator);
+  GNUNET_RECLAIM_get_attestations_next (attest_iterator);
 }
 
 
@@ -535,7 +710,12 @@ start_process ()
     cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
     return;
   }
-
+  attestation = GNUNET_RECLAIM_ID_ZERO;
+  if (NULL != attestation_id)
+    GNUNET_STRINGS_string_to_data (attestation_id,
+                                   strlen (attestation_id),
+                                   &attestation, sizeof(attestation));
+  attestation_exists = GNUNET_NO;
   if (list_tickets)
   {
     ticket_iterator = GNUNET_RECLAIM_ticket_iteration_start (reclaim_handle,
@@ -568,16 +748,18 @@ start_process ()
                                    &ticket,
                                    sizeof(struct GNUNET_RECLAIM_Ticket));
 
-  attr_list = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
+  attr_list = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
   claim = NULL;
-  attr_iterator = GNUNET_RECLAIM_get_attributes_start (reclaim_handle,
-                                                       pkey,
-                                                       &iter_error,
-                                                       NULL,
-                                                       &iter_cb,
-                                                       NULL,
-                                                       &iter_finished,
-                                                       NULL);
+  attest_iterator = GNUNET_RECLAIM_get_attestations_start (reclaim_handle,
+                                                           pkey,
+                                                           &iter_error,
+                                                           NULL,
+                                                           &attest_iter_cb,
+                                                           NULL,
+                                                           &
+                                                           
attest_iter_finished,
+                                                           NULL);
+
 }
 
 
@@ -673,13 +855,27 @@ main (int argc, char *const argv[])
                                "dump",
                                gettext_noop ("List attributes for EGO"),
                                &list),
-    GNUNET_GETOPT_option_string (
-      'i',
-      "issue",
-      "A1,A2,...",
-      gettext_noop (
-        "Issue a ticket for a set of attributes separated by comma"),
-      &issue_attrs),
+    GNUNET_GETOPT_option_flag ('A',
+                               "attestations",
+                               gettext_noop ("List attestations for EGO"),
+                               &list_attestations),
+    GNUNET_GETOPT_option_string ('I',
+                                 "Attestation ID",
+                                 "ATTESTATION_ID",
+                                 gettext_noop (
+                                   "Attestation to use for attribute"),
+                                 &attestation_id),
+    GNUNET_GETOPT_option_string ('N',
+                                 "attestation-name",
+                                 "NAME",
+                                 gettext_noop ("Attestation name"),
+                                 &attestation_name),
+    GNUNET_GETOPT_option_string ('i',
+                                 "issue",
+                                 "A1,A2,...",
+                                 gettext_noop (
+                                   "Issue a ticket for a set of attributes 
separated by comma"),
+                                 &issue_attrs),
     GNUNET_GETOPT_option_string ('C',
                                  "consume",
                                  "TICKET",
diff --git a/src/reclaim/gnunet-service-reclaim.c 
b/src/reclaim/gnunet-service-reclaim.c
index 556006af0..b617d0ec3 100644
--- a/src/reclaim/gnunet-service-reclaim.c
+++ b/src/reclaim/gnunet-service-reclaim.c
@@ -29,7 +29,7 @@
 #include "gnunet_constants.h"
 #include "gnunet_gnsrecord_lib.h"
 #include "gnunet_protocols.h"
-#include "gnunet_reclaim_attribute_lib.h"
+#include "gnunet_reclaim_lib.h"
 #include "gnunet_reclaim_service.h"
 #include "gnunet_signatures.h"
 #include "reclaim.h"
@@ -90,17 +90,17 @@ struct TicketIteration
 /**
  * An attribute iteration operation.
  */
-struct AttributeIterator
+struct Iterator
 {
   /**
    * Next element in the DLL
    */
-  struct AttributeIterator *next;
+  struct Iterator *next;
 
   /**
    * Previous element in the DLL
    */
-  struct AttributeIterator *prev;
+  struct Iterator *prev;
 
   /**
    * IDP client which intiated this zone iteration
@@ -121,6 +121,11 @@ struct AttributeIterator
    * The operation id fot the zone iteration in the response for the client
    */
   uint32_t request_id;
+
+  /**
+   * Context
+   */
+  void *ctx;
 };
 
 
@@ -154,14 +159,28 @@ struct IdpClient
    * Attribute iteration operations in
    * progress initiated by this client
    */
-  struct AttributeIterator *attr_iter_head;
+  struct Iterator *attr_iter_head;
+
+  /**
+   * Tail of the DLL of
+   * Attribute iteration operations
+   * in progress initiated by this client
+   */
+  struct Iterator *attr_iter_tail;
+
+  /**
+   * Head of the DLL of
+   * Attribute iteration operations in
+   * progress initiated by this client
+   */
+  struct Iterator *attest_iter_head;
 
   /**
    * Tail of the DLL of
    * Attribute iteration operations
    * in progress initiated by this client
    */
-  struct AttributeIterator *attr_iter_tail;
+  struct Iterator *attest_iter_tail;
 
   /**
    * Head of DLL of ticket iteration ops
@@ -263,17 +282,13 @@ struct AttributeDeleteHandle
   /**
    * The attribute to delete
    */
-  struct GNUNET_RECLAIM_ATTRIBUTE_Claim *claim;
+  struct GNUNET_RECLAIM_Attribute *claim;
 
   /**
    * The attestation to delete
    */
-  struct GNUNET_RECLAIM_ATTESTATION_Claim *attest;
+  struct GNUNET_RECLAIM_Attestation *attest;
 
-  /**
-  * The reference to delete
-  */
-  struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference;
   /**
    * Tickets to update
    */
@@ -334,17 +349,12 @@ struct AttributeStoreHandle
   /**
    * The attribute to store
    */
-  struct GNUNET_RECLAIM_ATTRIBUTE_Claim *claim;
+  struct GNUNET_RECLAIM_Attribute *claim;
 
   /**
   * The attestation to store
   */
-  struct GNUNET_RECLAIM_ATTESTATION_Claim *attest;
-
-  /**
-  * The reference to store
-  */
-  struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference;
+  struct GNUNET_RECLAIM_Attestation *attest;
 
   /**
    * The attribute expiration interval
@@ -480,8 +490,6 @@ cleanup_adh (struct AttributeDeleteHandle *adh)
     GNUNET_free (adh->claim);
   if (NULL != adh->attest)
     GNUNET_free (adh->attest);
-  if (NULL != adh->reference)
-    GNUNET_free (adh->reference);
   while (NULL != (le = adh->tickets_to_update_head))
   {
     GNUNET_CONTAINER_DLL_remove (adh->tickets_to_update_head,
@@ -511,8 +519,6 @@ cleanup_as_handle (struct AttributeStoreHandle *ash)
     GNUNET_free (ash->claim);
   if (NULL != ash->attest)
     GNUNET_free (ash->attest);
-  if (NULL != ash->reference)
-    GNUNET_free (ash->reference);
   GNUNET_free (ash);
 }
 
@@ -525,7 +531,7 @@ cleanup_as_handle (struct AttributeStoreHandle *ash)
 static void
 cleanup_client (struct IdpClient *idp)
 {
-  struct AttributeIterator *ai;
+  struct Iterator *ai;
   struct TicketIteration *ti;
   struct TicketRevocationOperation *rop;
   struct TicketIssueOperation *iss;
@@ -563,6 +569,13 @@ cleanup_client (struct IdpClient *idp)
     GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, idp->attr_iter_tail, ai);
     GNUNET_free (ai);
   }
+  while (NULL != (ai = idp->attest_iter_head))
+  {
+    GNUNET_CONTAINER_DLL_remove (idp->attest_iter_head, idp->attest_iter_tail,
+                                 ai);
+    GNUNET_free (ai);
+  }
+
   while (NULL != (rop = idp->revoke_op_head))
   {
     GNUNET_CONTAINER_DLL_remove (idp->revoke_op_head, idp->revoke_op_tail, 
rop);
@@ -718,13 +731,13 @@ handle_issue_ticket_message (void *cls, const struct 
IssueTicketMessage *im)
 {
   struct TicketIssueOperation *tio;
   struct IdpClient *idp = cls;
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
+  struct GNUNET_RECLAIM_AttributeList *attrs;
   size_t attrs_len;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ISSUE_TICKET message\n");
   tio = GNUNET_new (struct TicketIssueOperation);
   attrs_len = ntohs (im->attr_len);
-  attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char *) &im[1],
+  attrs = GNUNET_RECLAIM_attribute_list_deserialize ((char *) &im[1],
                                                      attrs_len);
   tio->r_id = ntohl (im->id);
   tio->client = idp;
@@ -735,7 +748,7 @@ handle_issue_ticket_message (void *cls, const struct 
IssueTicketMessage *im)
                          &issue_ticket_result_cb,
                          tio);
   GNUNET_SERVICE_client_continue (idp->client);
-  GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs);
+  GNUNET_RECLAIM_attribute_list_destroy (attrs);
 }
 
 
@@ -828,7 +841,8 @@ handle_revoke_ticket_message (void *cls, const struct 
RevokeTicketMessage *rm)
 static void
 consume_result_cb (void *cls,
                    const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
-                   const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
+                   const struct GNUNET_RECLAIM_AttributeList *attrs,
+                   const struct GNUNET_RECLAIM_AttestationList *attests,
                    int32_t success,
                    const char *emsg)
 {
@@ -837,23 +851,28 @@ consume_result_cb (void *cls,
   struct GNUNET_MQ_Envelope *env;
   char *data_tmp;
   size_t attrs_len;
+  size_t attests_len;
 
   if (GNUNET_OK != success)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg);
   }
-  attrs_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (attrs);
+  attrs_len = GNUNET_RECLAIM_attribute_list_serialize_get_size (attrs);
+  attests_len = GNUNET_RECLAIM_attestation_list_serialize_get_size (attests);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Sending CONSUME_TICKET_RESULT message\n");
   env = GNUNET_MQ_msg_extra (crm,
-                             attrs_len,
+                             attrs_len + attests_len,
                              
GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT);
   crm->id = htonl (cop->r_id);
   crm->attrs_len = htons (attrs_len);
+  crm->attestations_len = htons (attests_len);
   crm->identity = *identity;
   crm->result = htonl (success);
   data_tmp = (char *) &crm[1];
-  GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs, data_tmp);
+  GNUNET_RECLAIM_attribute_list_serialize (attrs, data_tmp);
+  data_tmp += attrs_len;
+  GNUNET_RECLAIM_attestation_list_serialize (attests, data_tmp);
   GNUNET_MQ_send (cop->client->mq, env);
   GNUNET_CONTAINER_DLL_remove (cop->client->consume_op_head,
                                cop->client->consume_op_tail,
@@ -965,20 +984,20 @@ attr_store_task (void *cls)
   size_t buf_size;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Storing attribute\n");
-  buf_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (ash->claim);
+  buf_size = GNUNET_RECLAIM_attribute_serialize_get_size (ash->claim);
   buf = GNUNET_malloc (buf_size);
   // Give the ash a new id if unset
-  if (0 == ash->claim->id)
-    ash->claim->id
-      = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
-  GNUNET_RECLAIM_ATTRIBUTE_serialize (ash->claim, buf);
+  if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&ash->claim->id))
+    GNUNET_RECLAIM_id_generate (&ash->claim->id);
+  GNUNET_RECLAIM_attribute_serialize (ash->claim, buf);
   label
-    = GNUNET_STRINGS_data_to_string_alloc (&ash->claim->id, sizeof(uint64_t));
+    = GNUNET_STRINGS_data_to_string_alloc (&ash->claim->id,
+                                           sizeof (ash->claim->id));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label);
 
   rd[0].data_size = buf_size;
   rd[0].data = buf;
-  rd[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR;
+  rd[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE;
   rd[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
   rd[0].expiration_time = ash->exp.rel_value_us;
   ash->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
@@ -1034,7 +1053,7 @@ handle_attribute_store_message (void *cls,
   data_len = ntohs (sam->attr_len);
 
   ash = GNUNET_new (struct AttributeStoreHandle);
-  ash->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize ((char *) &sam[1],
+  ash->claim = GNUNET_RECLAIM_attribute_deserialize ((char *) &sam[1],
                                                      data_len);
 
   ash->r_id = ntohl (sam->id);
@@ -1086,30 +1105,6 @@ attest_store_cont (void *cls, int32_t success, const 
char *emsg)
   cleanup_as_handle (ash);
 }
 
-/**
-     * Send a reference error response
-     *
-     * @param ash our attribute store handle
-     * @param success the success status
-     */
-static void
-send_ref_error (struct AttributeStoreHandle  *ash)
-{
-  struct GNUNET_MQ_Envelope *env;
-  struct SuccessResultMessage *acr_msg;
-
-  ash->ns_qe = NULL;
-  GNUNET_CONTAINER_DLL_remove (ash->client->store_op_head,
-                               ash->client->store_op_tail,
-                               ash);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
-  env = GNUNET_MQ_msg (acr_msg, GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE);
-  acr_msg->id = htonl (ash->r_id);
-  acr_msg->op_result = htonl (GNUNET_SYSERR);
-  GNUNET_MQ_send (ash->client->mq, env);
-  cleanup_as_handle (ash);
-}
 
 /**
  * Error looking up potential attestation. Abort.
@@ -1127,8 +1122,9 @@ attest_error (void *cls)
   return;
 }
 
+
 /**
-* Check for existing record before storing reference
+* Check for existing record before storing attestation
 *
 * @param cls our attribute store handle
 * @param zone zone we are iterating
@@ -1146,58 +1142,30 @@ attest_add_cb (void *cls,
   struct AttributeStoreHandle *ash = cls;
   char *buf;
   size_t buf_size;
-  buf_size = GNUNET_RECLAIM_ATTESTATION_serialize_get_size (ash->attest);
+  buf_size = GNUNET_RECLAIM_attestation_serialize_get_size (ash->attest);
   buf = GNUNET_malloc (buf_size);
-  GNUNET_RECLAIM_ATTESTATION_serialize (ash->attest, buf);
-  if (0 == rd_count )
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Storing new Attestation\n");
-    struct GNUNET_GNSRECORD_Data rd_new[1];
-    rd_new[0].data_size = buf_size;
-    rd_new[0].data = buf;
-    rd_new[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR;
-    rd_new[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
-    rd_new[0].expiration_time = ash->exp.rel_value_us;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label);
-    ash->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
-                                                 &ash->identity,
-                                                 label,
-                                                 1,
-                                                 rd_new,
-                                                 &attest_store_cont,
-                                                 ash);
-    GNUNET_free (buf);
-    return;
-  }
-  if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR != rd[0].record_type)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Existing Attestation location is not an Attestation\n");
-    send_ref_error (ash);
-    return;
-  }
-  struct GNUNET_GNSRECORD_Data rd_new[rd_count];
-  for (int i = 0; i<rd_count; i++)
-  {
-    rd_new[i] = rd[i];
-  }
+  GNUNET_RECLAIM_attestation_serialize (ash->attest, buf);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Storing new Attestation\n");
+  struct GNUNET_GNSRECORD_Data rd_new[1];
   rd_new[0].data_size = buf_size;
   rd_new[0].data = buf;
-  rd_new[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR;
+  rd_new[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION;
   rd_new[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
   rd_new[0].expiration_time = ash->exp.rel_value_us;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label);
   ash->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
                                                &ash->identity,
                                                label,
-                                               rd_count,
+                                               1,
                                                rd_new,
                                                &attest_store_cont,
                                                ash);
   GNUNET_free (buf);
+  return;
 }
 
+
 /**
  * Add a new attestation
  *
@@ -1210,11 +1178,10 @@ attest_store_task (void *cls)
   char *label;
 
   // Give the ash a new id if unset
-  if (0 == ash->attest->id)
-    ash->attest->id
-      = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
+  if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&ash->attest->id))
+    GNUNET_RECLAIM_id_generate (&ash->attest->id);
   label = GNUNET_STRINGS_data_to_string_alloc (&ash->attest->id,
-                                               sizeof(uint64_t));
+                                               sizeof (ash->attest->id));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Looking up existing data under label %s\n", label);
 // Test for the content of the existing ID
@@ -1228,6 +1195,7 @@ attest_store_task (void *cls)
   GNUNET_free (label);
 }
 
+
 /**
  * Check an attestation store message
  *
@@ -1249,6 +1217,7 @@ check_attestation_store_message (void *cls,
   return GNUNET_OK;
 }
 
+
 /**
 * Handle an attestation store message
 *
@@ -1268,7 +1237,7 @@ handle_attestation_store_message (void *cls,
   data_len = ntohs (sam->attr_len);
 
   ash = GNUNET_new (struct AttributeStoreHandle);
-  ash->attest = GNUNET_RECLAIM_ATTESTATION_deserialize ((char *) &sam[1],
+  ash->attest = GNUNET_RECLAIM_attestation_deserialize ((char *) &sam[1],
                                                         data_len);
 
   ash->r_id = ntohl (sam->id);
@@ -1282,245 +1251,7 @@ handle_attestation_store_message (void *cls,
   GNUNET_SCHEDULER_add_now (&attest_store_task, ash);
 }
 
-/**
- * Error looking up potential reference value. Abort.
- *
- * @param cls our attribute store handle
- */
-static void
-ref_error (void *cls)
-{
-  struct AttributeStoreHandle *ash = cls;
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-              "Failed to find Attestation entry for Attestation reference\n");
-  cleanup_as_handle (ash);
-  GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
-  return;
-}
-
-/**
- * Error looking up potential reference value. Abort.
- *
- * @param cls our attribute delete handle
- */
-static void
-ref_del_error (void *cls)
-{
-  struct AttributeDeleteHandle *adh = cls;
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-              "Failed to find Attestation entry for Attestation reference\n");
-  cleanup_adh (adh);
-  GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
-  return;
-}
-/**
-* Reference store result handler
-*
-* @param cls our attribute store handle
-* @param success GNUNET_OK if successful
-* @param emsg error message (NULL if success=GNUNET_OK)
-*/
-static void
-reference_store_cont (void *cls, int32_t success, const char *emsg)
-{
-  struct AttributeStoreHandle *ash = cls;
-  struct GNUNET_MQ_Envelope *env;
-  struct SuccessResultMessage *acr_msg;
-
-  ash->ns_qe = NULL;
-  GNUNET_CONTAINER_DLL_remove (ash->client->store_op_head,
-                               ash->client->store_op_tail,
-                               ash);
-
-  if (GNUNET_SYSERR == success)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Failed to store reference %s\n",
-                emsg);
-    cleanup_as_handle (ash);
-    GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
-    return;
-  }
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
-  env = GNUNET_MQ_msg (acr_msg, GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE);
-  acr_msg->id = htonl (ash->r_id);
-  acr_msg->op_result = htonl (GNUNET_OK);
-  GNUNET_MQ_send (ash->client->mq, env);
-  cleanup_as_handle (ash);
-}
-
 
-/**
-* Check for existing record before storing reference
-*
-* @param cls our attribute store handle
-* @param zone zone we are iterating
-* @param label label of the records
-* @param rd_count record count
-* @param rd records
-*/
-static void
-ref_add_cb (void *cls,
-            const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
-            const char *label,
-            unsigned int rd_count,
-            const struct GNUNET_GNSRECORD_Data *rd)
-{
-  struct AttributeStoreHandle *ash = cls;
-  char *buf;
-  size_t buf_size;
-  buf_size = GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size 
(ash->reference);
-  buf = GNUNET_malloc (buf_size);
-  GNUNET_RECLAIM_ATTESTATION_REF_serialize (ash->reference, buf);
-  struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *ref;
-  char *data_tmp;
-  if (0 == rd_count )
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Failed to find Attestation entry for Attestation 
reference\n");
-    send_ref_error (ash);
-    return;
-  }
-  if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR != rd[0].record_type)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Intended Reference storage location is not an attestation\n");
-    send_ref_error (ash);
-    return;
-  }
-  struct GNUNET_GNSRECORD_Data rd_new[rd_count + 1];
-  int i;
-  for (i = 0; i<rd_count; i++)
-  {
-    data_tmp = GNUNET_malloc (rd[i].data_size);
-    GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size);
-    ref = GNUNET_RECLAIM_ATTESTATION_REF_deserialize (data_tmp, htons (
-                                                        rd[i].data_size));
-    rd_new[i] = rd[i];
-    if ((strcmp (ash->reference->name,ref->name) == 0)&&
-        (strcmp (ash->reference->reference_value,ref->reference_value)==0) )
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Reference already stored\n");
-      reference_store_cont (ash,GNUNET_OK, NULL);
-      return;
-    }
-  }
-  rd_new[rd_count].data_size = buf_size;
-  rd_new[rd_count].data = buf;
-  rd_new[rd_count].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE;
-  rd_new[rd_count].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
-  rd_new[rd_count].expiration_time = ash->exp.rel_value_us;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label);
-  ash->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
-                                               &ash->identity,
-                                               label,
-                                               rd_count + 1,
-                                               rd_new,
-                                               &reference_store_cont,
-                                               ash);
-  GNUNET_free (buf);
-}
-
-/**
- * Add a new reference
- *
- * @param cls the AttributeStoreHandle
- */
-static void
-reference_store_task (void *cls)
-{
-  struct AttributeStoreHandle *ash = cls;
-  char *label;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Storing reference\n");
-
-  // Give the ash a new id if unset
-  if (0 == ash->reference->id)
-  {
-    if (0 == ash->reference->id_attest)
-    {
-      ash->reference->id = GNUNET_CRYPTO_random_u64 (
-        GNUNET_CRYPTO_QUALITY_STRONG,
-        UINT64_MAX);
-    }
-    else
-    {
-      ash->reference->id = ash->reference->id_attest;
-    }
-  }
-
-  label = GNUNET_STRINGS_data_to_string_alloc (&ash->reference->id,
-                                               sizeof(uint64_t));
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Looking up existing data under label %s\n", label);
-// Test for the content of the existing ID
-
-  ash->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh,
-                                                &ash->identity,
-                                                label,
-                                                &ref_error,
-                                                ash,
-                                                &ref_add_cb,
-                                                ash);
-  GNUNET_free (label);
-}
-
-/**
-     * Check an attestation reference store message
-     *
-     * @param cls unused
-     * @param sam the message to check
-     */
-static int
-check_reference_store_message (void *cls,
-                               const struct
-                               AttributeStoreMessage *sam)
-{
-  uint16_t size;
-
-  size = ntohs (sam->header.size);
-  if (size <= sizeof(struct AttributeStoreMessage))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
-    * Handle an attestation reference store message
-    *
-    * @param cls our client
-    * @param sam the message to handle
-    */
-static void
-handle_reference_store_message (void *cls,
-                                const struct AttributeStoreMessage *sam)
-{
-  struct AttributeStoreHandle *ash;
-  struct IdpClient *idp = cls;
-  size_t data_len;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REFERENCE_STORE message\n");
-
-  data_len = ntohs (sam->attr_len);
-  ash = GNUNET_new (struct AttributeStoreHandle);
-  ash->reference = GNUNET_RECLAIM_ATTESTATION_REF_deserialize ((char *) 
&sam[1],
-                                                               data_len);
-  ash->r_id = ntohl (sam->id);
-  ash->identity = sam->identity;
-  ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
-  GNUNET_CRYPTO_ecdsa_key_get_public (&sam->identity, &ash->identity_pkey);
-
-
-  GNUNET_SERVICE_client_continue (idp->client);
-  ash->client = idp;
-  GNUNET_CONTAINER_DLL_insert (idp->store_op_head, idp->store_op_tail, ash);
-  GNUNET_SCHEDULER_add_now (&reference_store_task, ash);
-}
 /**
  * Send a deletion success response
  *
@@ -1567,19 +1298,18 @@ ticket_iter (void *cls,
   int has_changed = GNUNET_NO;
   for (int i = 0; i < rd_count; i++)
   {
-    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type)
+    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type)
       continue;
     if (adh->claim != NULL)
-      if (0 != memcmp (rd[i].data, &adh->claim->id, sizeof(uint64_t)))
+      if (GNUNET_YES != GNUNET_RECLAIM_id_is_equal (rd[i].data,
+                                                    &adh->claim->id))
         continue;
     if (adh->attest != NULL)
-      if (0 != memcmp (rd[i].data, &adh->attest->id, sizeof(uint64_t)))
-        continue;
-    if (adh->reference != NULL)
-      if (0 != memcmp (rd[i].data, &adh->reference->id, sizeof(uint64_t)))
+      if (GNUNET_YES != GNUNET_RECLAIM_id_is_equal (rd[i].data,
+                                                    &adh->attest->id))
         continue;
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Attribute or Attestation/Reference to delete found (%s)\n",
+                "Attribute or Attestation to delete found (%s)\n",
                 adh->label);
     has_changed = GNUNET_YES;
     break;
@@ -1670,16 +1400,14 @@ update_tickets (void *cls)
   for (int i = 0; i < le->rd_count; i++)
   {
     if (adh->claim != NULL)
-      if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF == rd[i].record_type)
-          && (0 == memcmp (rd[i].data, &adh->claim->id, sizeof(uint64_t))))
+      if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF == rd[i].record_type)
+          && (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data,
+                                                        &adh->claim->id)))
         continue;
     if (adh->attest != NULL)
-      if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF == rd[i].record_type)
-          && (0 == memcmp (rd[i].data, &adh->attest->id, sizeof(uint64_t))))
-        continue;
-    if (adh->reference != NULL)
-      if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF == rd[i].record_type)
-          && (0 == memcmp (rd[i].data, &adh->reference->id, sizeof(uint64_t))))
+      if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF == rd[i].record_type)
+          && (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data,
+                                                        &adh->attest->id)))
         continue;
     rd_new[j] = rd[i];
     j++;
@@ -1820,15 +1548,15 @@ handle_attribute_delete_message (void *cls,
   data_len = ntohs (dam->attr_len);
 
   adh = GNUNET_new (struct AttributeDeleteHandle);
-  adh->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize ((char *) &dam[1],
+  adh->claim = GNUNET_RECLAIM_attribute_deserialize ((char *) &dam[1],
                                                      data_len);
-  adh->reference = NULL;
   adh->attest = NULL;
 
   adh->r_id = ntohl (dam->id);
   adh->identity = dam->identity;
   adh->label
-    = GNUNET_STRINGS_data_to_string_alloc (&adh->claim->id, sizeof(uint64_t));
+    = GNUNET_STRINGS_data_to_string_alloc (&adh->claim->id,
+                                           sizeof(adh->claim->id));
   GNUNET_SERVICE_client_continue (idp->client);
   adh->client = idp;
   GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh);
@@ -1841,6 +1569,7 @@ handle_attribute_delete_message (void *cls,
                                                adh);
 }
 
+
 /**
    * Attestation deleted callback
    *
@@ -1867,6 +1596,7 @@ attest_delete_cont (void *cls, int32_t success, const 
char *emsg)
   GNUNET_SCHEDULER_add_now (&start_ticket_update, adh);
 }
 
+
 /**
  * Check attestation delete message format
  *
@@ -1908,15 +1638,15 @@ handle_attestation_delete_message (void *cls,
   data_len = ntohs (dam->attr_len);
 
   adh = GNUNET_new (struct AttributeDeleteHandle);
-  adh->attest = GNUNET_RECLAIM_ATTESTATION_deserialize ((char *) &dam[1],
+  adh->attest = GNUNET_RECLAIM_attestation_deserialize ((char *) &dam[1],
                                                         data_len);
-  adh->reference = NULL;
   adh->claim = NULL;
 
   adh->r_id = ntohl (dam->id);
   adh->identity = dam->identity;
   adh->label
-    = GNUNET_STRINGS_data_to_string_alloc (&adh->attest->id, sizeof(uint64_t));
+    = GNUNET_STRINGS_data_to_string_alloc (&adh->attest->id,
+                                           sizeof(adh->attest->id));
   GNUNET_SERVICE_client_continue (idp->client);
   adh->client = idp;
   GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh);
@@ -1930,214 +1660,236 @@ handle_attestation_delete_message (void *cls,
 }
 
 
+/*************************************************
+* Attrubute iteration
+*************************************************/
+
 
 /**
-* Reference deleted callback
-*
-* @param cls our handle
-* @param success success status
-* @param emsg error message (NULL if success=GNUNET_OK)
-*/
+ * Done iterating over attributes
+ *
+ * @param cls our iterator handle
+ */
 static void
-reference_delete_cont (void *cls, int32_t success, const char *emsg)
+attr_iter_finished (void *cls)
 {
-  struct AttributeDeleteHandle *adh = cls;
+  struct Iterator *ai = cls;
+  struct GNUNET_MQ_Envelope *env;
+  struct AttributeResultMessage *arm;
 
-  adh->ns_qe = NULL;
-  if (GNUNET_SYSERR == success)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Error deleting reference %s\n",
-                adh->label);
-    send_delete_response (adh, GNUNET_SYSERR);
-    cleanup_adh (adh);
-    return;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating tickets...\n");
-  //GNUNET_SCHEDULER_add_now (&start_ticket_update, adh);
-  send_delete_response (adh, GNUNET_OK);
-  cleanup_adh (adh);
-  return;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTRIBUTE_RESULT message\n");
+  env = GNUNET_MQ_msg (arm, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
+  arm->id = htonl (ai->request_id);
+  arm->attr_len = htons (0);
+  GNUNET_MQ_send (ai->client->mq, env);
+  GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head,
+                               ai->client->attr_iter_tail,
+                               ai);
+  GNUNET_free (ai);
 }
 
+
+/**
+ * Error iterating over attributes. Abort.
+ *
+ * @param cls our attribute iteration handle
+ */
 static void
-ref_del_cb (void *cls,
-            const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
-            const char *label,
-            unsigned int rd_count,
-            const struct GNUNET_GNSRECORD_Data *rd)
+attr_iter_error (void *cls)
 {
+  struct Iterator *ai = cls;
 
-  struct AttributeDeleteHandle *adh = cls;
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attributes\n");
+  attr_iter_finished (ai);
+}
+
+
+/**
+ * Got record. Return if it is an attribute or attestation.
+ *
+ * @param cls our attribute iterator
+ * @param zone zone we are iterating
+ * @param label label of the records
+ * @param rd_count record count
+ * @param rd records
+ */
+static void
+attr_iter_cb (void *cls,
+              const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
+              const char *label,
+              unsigned int rd_count,
+              const struct GNUNET_GNSRECORD_Data *rd)
+{
+  struct Iterator *ai = cls;
+  struct GNUNET_MQ_Envelope *env;
   char *data_tmp;
-  struct GNUNET_GNSRECORD_Data rd_new[rd_count - 1];
-  struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *ref;
-  size_t attr_len;
 
-  if (0 == rd_count )
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Failed to find Attestation entry for Attestation 
reference\n");
-    cleanup_adh (adh);
-    GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
-    return;
-  }
-  if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR != rd[0].record_type)
+  if ((rd_count != 1) ||
+      (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE != rd->record_type))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Intended Reference location is not an attestation\n");
-    cleanup_adh (adh);
-    GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
+    GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
     return;
   }
-  rd_new[0] = rd[0];
-  int i;
-  int j = 1;
-  for (i = 1; i<rd_count; i++)
-  {
-    data_tmp = GNUNET_malloc (rd[i].data_size);
-    GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size);
-    attr_len = htons (rd[i].data_size);
-    ref = GNUNET_RECLAIM_ATTESTATION_REF_deserialize (data_tmp, attr_len);
-    if (NULL == ref )
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Unable to parse attestation reference from %s\n",
-                  data_tmp);
-      rd_new[j] = rd[i];
-      j += 1;
-      continue;
-    }
-    if ((strcmp (adh->reference->name,ref->name) == 0)&&
-        (strcmp (adh->reference->reference_value,ref->reference_value)==0) )
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Found reference to delete.\n");
-    }
-    else
-    {
-      rd_new[j] = rd[i];
-      j += 1;
-    }
-    GNUNET_free (data_tmp);
-  }
-  adh->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
-                                               &adh->identity,
-                                               label,
-                                               j,
-                                               rd_new,
-                                               &reference_delete_cont,
-                                               adh);
+  struct AttributeResultMessage *arm;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n",
+              label);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Sending ATTRIBUTE_RESULT message\n");
+  env = GNUNET_MQ_msg_extra (arm,
+                             rd->data_size,
+                             GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
+  arm->id = htonl (ai->request_id);
+  arm->attr_len = htons (rd->data_size);
+  GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
+  data_tmp = (char *) &arm[1];
+  GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
+  GNUNET_MQ_send (ai->client->mq, env);
 }
 
+
 /**
- * Check an attestation reference delete message
+ * Iterate over zone to get attributes
  *
- * @param cls unused
- * @param sam the message to check
+ * @param cls our client
+ * @param ais_msg the iteration message to start
  */
-static int
-check_reference_delete_message (void *cls,
-                                const struct AttributeDeleteMessage *dam)
+static void
+handle_iteration_start (void *cls,
+                        const struct AttributeIterationStartMessage *ais_msg)
 {
-  uint16_t size;
+  struct IdpClient *idp = cls;
+  struct Iterator *ai;
 
-  size = ntohs (dam->header.size);
-  if (size <= sizeof(struct AttributeDeleteMessage))
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Received ATTRIBUTE_ITERATION_START message\n");
+  ai = GNUNET_new (struct Iterator);
+  ai->request_id = ntohl (ais_msg->id);
+  ai->client = idp;
+  ai->identity = ais_msg->identity;
+
+  GNUNET_CONTAINER_DLL_insert (idp->attr_iter_head, idp->attr_iter_tail, ai);
+  ai->ns_it = GNUNET_NAMESTORE_zone_iteration_start (nsh,
+                                                     &ai->identity,
+                                                     &attr_iter_error,
+                                                     ai,
+                                                     &attr_iter_cb,
+                                                     ai,
+                                                     &attr_iter_finished,
+                                                     ai);
+  GNUNET_SERVICE_client_continue (idp->client);
+}
+
+
+/**
+ * Handle iteration stop message from client
+ *
+ * @param cls the client
+ * @param ais_msg the stop message
+ */
+static void
+handle_iteration_stop (void *cls,
+                       const struct AttributeIterationStopMessage *ais_msg)
+{
+  struct IdpClient *idp = cls;
+  struct Iterator *ai;
+  uint32_t rid;
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Received `%s' message\n",
+              "ATTRIBUTE_ITERATION_STOP");
+  rid = ntohl (ais_msg->id);
+  for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
+    if (ai->request_id == rid)
+      break;
+  if (NULL == ai)
   {
     GNUNET_break (0);
-    return GNUNET_SYSERR;
+    GNUNET_SERVICE_client_drop (idp->client);
+    return;
   }
-  return GNUNET_OK;
+  GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, idp->attr_iter_tail, ai);
+  GNUNET_free (ai);
+  GNUNET_SERVICE_client_continue (idp->client);
 }
 
+
 /**
- * Handle reference deletion
+ * Client requests next attribute from iterator
  *
- * @param cls our client
- * @param dam deletion message
+ * @param cls the client
+ * @param ais_msg the message
  */
 static void
-handle_reference_delete_message (void *cls,
-                                 const struct AttributeDeleteMessage *dam)
+handle_iteration_next (void *cls,
+                       const struct AttributeIterationNextMessage *ais_msg)
 {
-  struct AttributeDeleteHandle *adh;
   struct IdpClient *idp = cls;
-  size_t data_len;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REFERENCE_DELETE message\n");
-  data_len = ntohs (dam->attr_len);
-  adh = GNUNET_new (struct AttributeDeleteHandle);
-  adh->reference = GNUNET_RECLAIM_ATTESTATION_REF_deserialize ((char *) 
&dam[1],
-                                                               data_len);
-  adh->attest = NULL;
-  adh->claim = NULL;
+  struct Iterator *ai;
+  uint32_t rid;
 
-  adh->r_id = ntohl (dam->id);
-  adh->identity = dam->identity;
-  adh->label
-    = GNUNET_STRINGS_data_to_string_alloc (&adh->reference->id,
-                                           sizeof(uint64_t));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Received ATTRIBUTE_ITERATION_NEXT message\n");
+  rid = ntohl (ais_msg->id);
+  for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
+    if (ai->request_id == rid)
+      break;
+  if (NULL == ai)
+  {
+    GNUNET_break (0);
+    GNUNET_SERVICE_client_drop (idp->client);
+    return;
+  }
+  GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
   GNUNET_SERVICE_client_continue (idp->client);
-  adh->client = idp;
-  GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh);
-  adh->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh,
-                                                &adh->identity,
-                                                adh->label,
-                                                &ref_del_error,
-                                                adh,
-                                                &ref_del_cb,
-                                                adh);
 }
 
 
-
 /*************************************************
-* Attrubute iteration
+* Attestation iteration
 *************************************************/
 
 
 /**
- * Done iterating over attributes
+ * Done iterating over attestations
  *
  * @param cls our iterator handle
  */
 static void
-attr_iter_finished (void *cls)
+attest_iter_finished (void *cls)
 {
-  struct AttributeIterator *ai = cls;
+  struct Iterator *ai = cls;
   struct GNUNET_MQ_Envelope *env;
-  struct AttributeResultMessage *arm;
+  struct AttestationResultMessage *arm;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTRIBUTE_RESULT message\n");
-  env = GNUNET_MQ_msg (arm, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTESTATION_RESULT message\n");
+  env = GNUNET_MQ_msg (arm, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT);
   arm->id = htonl (ai->request_id);
-  arm->attr_len = htons (0);
+  arm->attestation_len = htons (0);
   GNUNET_MQ_send (ai->client->mq, env);
-  GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head,
-                               ai->client->attr_iter_tail,
+  GNUNET_CONTAINER_DLL_remove (ai->client->attest_iter_head,
+                               ai->client->attest_iter_tail,
                                ai);
   GNUNET_free (ai);
 }
 
 
 /**
- * Error iterating over attributes. Abort.
+ * Error iterating over attestations. Abort.
  *
  * @param cls our attribute iteration handle
  */
 static void
-attr_iter_error (void *cls)
+attest_iter_error (void *cls)
 {
-  struct AttributeIterator *ai = cls;
+  struct Iterator *ai = cls;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attributes\n");
-  attr_iter_finished (ai);
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over 
attestations\n");
+  attest_iter_finished (ai);
 }
 
 
 /**
- * Got record. Return if it is an attribute or attestation/reference.
+ * Got record. Return attestation.
  *
  * @param cls our attribute iterator
  * @param zone zone we are iterating
@@ -2146,110 +1898,43 @@ attr_iter_error (void *cls)
  * @param rd records
  */
 static void
-attr_iter_cb (void *cls,
-              const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
-              const char *label,
-              unsigned int rd_count,
-              const struct GNUNET_GNSRECORD_Data *rd)
+attest_iter_cb (void *cls,
+                const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
+                const char *label,
+                unsigned int rd_count,
+                const struct GNUNET_GNSRECORD_Data *rd)
 {
-  struct AttributeIterator *ai = cls;
+  struct Iterator *ai = cls;
   struct GNUNET_MQ_Envelope *env;
+  struct AttestationResultMessage *arm;
+  struct GNUNET_RECLAIM_Attestation *att;
   char *data_tmp;
 
-  if (rd_count == 0)
+  if ((rd_count != 1) ||
+      (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION != rd->record_type))
   {
     GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
     return;
   }
-  if (rd_count > 1)
-  {
-    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF == rd[0].record_type)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Found Ticket. Ignoring.\n");
-      GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
-      return;
-    }
-    else if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR != rd[0].record_type)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Non-Attestation record with multiple entries found: %u\n",
-                  rd[0].record_type);
-      GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
-      return;
-    }
-  }
+  att = GNUNET_RECLAIM_attestation_deserialize (rd->data,
+                                                rd->data_size);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attestation under: %s\n",
+              label);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Sending ATTESTATION_RESULT message\n");
+  env = GNUNET_MQ_msg_extra (arm,
+                             rd->data_size,
+                             GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT);
+  arm->id = htonl (ai->request_id);
+  arm->attestation_len = htons (rd->data_size);
+  GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
+  data_tmp = (char *) &arm[1];
+  GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
 
-  for (int i = 0; i<rd_count; i++)
-  {
-    if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR != rd[i].record_type) &&
-        (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR != rd[i].record_type) &&
-        (GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE != rd[i].record_type))
-    {
-      GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
-      return;
-    }
-
-    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR == rd[i].record_type )
-    {
-      struct AttributeResultMessage *arm;
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n",
-                  label);
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Sending ATTRIBUTE_RESULT message\n");
-      env = GNUNET_MQ_msg_extra (arm,
-                                 rd[i].data_size,
-                                 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
-      arm->id = htonl (ai->request_id);
-      arm->attr_len = htons (rd[i].data_size);
-      GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
-      data_tmp = (char *) &arm[1];
-      GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size);
-      GNUNET_MQ_send (ai->client->mq, env);
-    }
-    else
-    {
-      if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR == rd[i].record_type )
-      {
-        struct AttributeResultMessage *arm;
-        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attestation under: %s\n",
-                    label);
-        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                    "Sending ATTESTATION_RESULT message\n");
-        env = GNUNET_MQ_msg_extra (arm,
-                                   rd[i].data_size,
-                                   
GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT);
-        arm->id = htonl (ai->request_id);
-        arm->attr_len = htons (rd[i].data_size);
-        GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
-        data_tmp = (char *) &arm[1];
-        GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size);
-        GNUNET_MQ_send (ai->client->mq, env);
-      }
-      else
-      {
-        struct ReferenceResultMessage *rrm;
-        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found reference under: %s\n",
-                    label);
-        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                    "Sending REFERENCE_RESULT message\n");
-        env = GNUNET_MQ_msg_extra (rrm,
-                                   rd[i].data_size + rd[0].data_size,
-                                   
GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT);
-        rrm->id = htonl (ai->request_id);
-        rrm->attest_len = htons (rd[0].data_size);
-        rrm->ref_len = htons (rd[i].data_size);
-        GNUNET_CRYPTO_ecdsa_key_get_public (zone, &rrm->identity);
-        data_tmp = (char *) &rrm[1];
-        GNUNET_memcpy (data_tmp, rd[0].data, rd[0].data_size);
-        data_tmp += rd[0].data_size;
-        GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size);
-        GNUNET_MQ_send (ai->client->mq, env);
-      }
-    }
-  }
+  GNUNET_MQ_send (ai->client->mq, env);
 }
 
+
 /**
  * Iterate over zone to get attributes
  *
@@ -2257,27 +1942,29 @@ attr_iter_cb (void *cls,
  * @param ais_msg the iteration message to start
  */
 static void
-handle_iteration_start (void *cls,
-                        const struct AttributeIterationStartMessage *ais_msg)
+handle_attestation_iteration_start (void *cls,
+                                    const struct
+                                    AttestationIterationStartMessage *ais_msg)
 {
   struct IdpClient *idp = cls;
-  struct AttributeIterator *ai;
+  struct Iterator *ai;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received ATTRIBUTE_ITERATION_START message\n");
-  ai = GNUNET_new (struct AttributeIterator);
+              "Received ATTESTATION_ITERATION_START message\n");
+  ai = GNUNET_new (struct Iterator);
   ai->request_id = ntohl (ais_msg->id);
   ai->client = idp;
   ai->identity = ais_msg->identity;
 
-  GNUNET_CONTAINER_DLL_insert (idp->attr_iter_head, idp->attr_iter_tail, ai);
+  GNUNET_CONTAINER_DLL_insert (idp->attest_iter_head, idp->attest_iter_tail,
+                               ai);
   ai->ns_it = GNUNET_NAMESTORE_zone_iteration_start (nsh,
                                                      &ai->identity,
-                                                     &attr_iter_error,
+                                                     &attest_iter_error,
                                                      ai,
-                                                     &attr_iter_cb,
+                                                     &attest_iter_cb,
                                                      ai,
-                                                     &attr_iter_finished,
+                                                     &attest_iter_finished,
                                                      ai);
   GNUNET_SERVICE_client_continue (idp->client);
 }
@@ -2290,18 +1977,19 @@ handle_iteration_start (void *cls,
  * @param ais_msg the stop message
  */
 static void
-handle_iteration_stop (void *cls,
-                       const struct AttributeIterationStopMessage *ais_msg)
+handle_attestation_iteration_stop (void *cls,
+                                   const struct
+                                   AttestationIterationStopMessage *ais_msg)
 {
   struct IdpClient *idp = cls;
-  struct AttributeIterator *ai;
+  struct Iterator *ai;
   uint32_t rid;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Received `%s' message\n",
-              "ATTRIBUTE_ITERATION_STOP");
+              "ATTESTATION_ITERATION_STOP");
   rid = ntohl (ais_msg->id);
-  for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
+  for (ai = idp->attest_iter_head; NULL != ai; ai = ai->next)
     if (ai->request_id == rid)
       break;
   if (NULL == ai)
@@ -2310,30 +1998,32 @@ handle_iteration_stop (void *cls,
     GNUNET_SERVICE_client_drop (idp->client);
     return;
   }
-  GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, idp->attr_iter_tail, ai);
+  GNUNET_CONTAINER_DLL_remove (idp->attest_iter_head, idp->attest_iter_tail,
+                               ai);
   GNUNET_free (ai);
   GNUNET_SERVICE_client_continue (idp->client);
 }
 
 
 /**
- * Client requests next attribute from iterator
+ * Client requests next attestation from iterator
  *
  * @param cls the client
  * @param ais_msg the message
  */
 static void
-handle_iteration_next (void *cls,
-                       const struct AttributeIterationNextMessage *ais_msg)
+handle_attestation_iteration_next (void *cls,
+                                   const struct
+                                   AttestationIterationNextMessage *ais_msg)
 {
   struct IdpClient *idp = cls;
-  struct AttributeIterator *ai;
+  struct Iterator *ai;
   uint32_t rid;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received ATTRIBUTE_ITERATION_NEXT message\n");
+              "Received ATTESTATION_ITERATION_NEXT message\n");
   rid = ntohl (ais_msg->id);
-  for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
+  for (ai = idp->attest_iter_head; NULL != ai; ai = ai->next)
     if (ai->request_id == rid)
       break;
   if (NULL == ai)
@@ -2587,19 +2277,10 @@ GNUNET_SERVICE_MAIN (
                          GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_DELETE,
                          struct AttributeDeleteMessage,
                          NULL),
-  GNUNET_MQ_hd_var_size (reference_store_message,
-                         GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_STORE,
-                         struct AttributeStoreMessage,
-                         NULL),
-  GNUNET_MQ_hd_var_size (reference_delete_message,
-                         GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_DELETE,
-                         struct AttributeDeleteMessage,
-                         NULL),
-  GNUNET_MQ_hd_fixed_size (
-    iteration_start,
-    GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START,
-    struct AttributeIterationStartMessage,
-    NULL),
+  GNUNET_MQ_hd_fixed_size (iteration_start,
+                           
GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START,
+                           struct AttributeIterationStartMessage,
+                           NULL),
   GNUNET_MQ_hd_fixed_size (iteration_next,
                            
GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT,
                            struct AttributeIterationNextMessage,
@@ -2608,6 +2289,19 @@ GNUNET_SERVICE_MAIN (
                            
GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP,
                            struct AttributeIterationStopMessage,
                            NULL),
+  GNUNET_MQ_hd_fixed_size (attestation_iteration_start,
+                           
GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START,
+                           struct AttestationIterationStartMessage,
+                           NULL),
+  GNUNET_MQ_hd_fixed_size (attestation_iteration_next,
+                           
GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT,
+                           struct AttestationIterationNextMessage,
+                           NULL),
+  GNUNET_MQ_hd_fixed_size (attestation_iteration_stop,
+                           
GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP,
+                           struct AttestationIterationStopMessage,
+                           NULL),
+
   GNUNET_MQ_hd_var_size (issue_ticket_message,
                          GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET,
                          struct IssueTicketMessage,
diff --git a/src/reclaim/gnunet-service-reclaim_tickets.c 
b/src/reclaim/gnunet-service-reclaim_tickets.c
index b022225b8..205886c78 100644
--- a/src/reclaim/gnunet-service-reclaim_tickets.c
+++ b/src/reclaim/gnunet-service-reclaim_tickets.c
@@ -59,7 +59,7 @@ struct TicketReference
   /**
    * Attributes
    */
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
+  struct GNUNET_RECLAIM_AttributeList *attrs;
 
   /**
    * Tickets
@@ -111,7 +111,12 @@ struct RECLAIM_TICKETS_ConsumeHandle
   /**
    * Attributes
    */
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
+  struct GNUNET_RECLAIM_AttributeList *attrs;
+
+  /**
+   * Attestations
+   */
+  struct GNUNET_RECLAIM_AttestationList *attests;
 
   /**
    * Lookup time
@@ -165,7 +170,7 @@ struct TicketIssueHandle
   /**
    * Attributes to issue
    */
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
+  struct GNUNET_RECLAIM_AttributeList *attrs;
 
   /**
    * Issuer Key
@@ -236,12 +241,12 @@ struct RevokedAttributeEntry
   /**
    * Old ID of the attribute
    */
-  uint64_t old_id;
+  struct GNUNET_RECLAIM_Identifier old_id;
 
   /**
    * New ID of the attribute
    */
-  uint64_t new_id;
+  struct GNUNET_RECLAIM_Identifier new_id;
 };
 
 
@@ -431,11 +436,11 @@ process_tickets (void *cls)
   }
   for (int i = 0; i < le->rd_count; i++)
   {
-    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type)
+    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type)
       continue;
     for (ae = rvk->attrs_head; NULL != ae; ae = ae->next)
     {
-      if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(uint64_t)))
+      if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(ae->old_id)))
         continue;
       rd[i].data = &ae->new_id;
     }
@@ -493,11 +498,11 @@ rvk_ticket_update (void *cls,
   /** Let everything point to the old record **/
   for (int i = 0; i < rd_count; i++)
   {
-    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type)
+    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type)
       continue;
     for (ae = rvk->attrs_head; NULL != ae; ae = ae->next)
     {
-      if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(uint64_t)))
+      if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(ae->old_id)))
         continue;
       has_changed = GNUNET_YES;
       break;
@@ -532,9 +537,6 @@ rvk_ns_iter_err (void *cls)
   struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
 
   rvk->ns_it = NULL;
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-              "Namestore error on revocation (id=%" PRIu64 "\n",
-              rvk->move_attr->old_id);
   rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
   cleanup_rvk (rvk);
 }
@@ -551,9 +553,6 @@ rvk_ns_err (void *cls)
   struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
 
   rvk->ns_qe = NULL;
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-              "Namestore error on revocation (id=%" PRIu64 "\n",
-              rvk->move_attr->old_id);
   rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
   cleanup_rvk (rvk);
 }
@@ -636,7 +635,7 @@ move_attr_finished (void *cls, int32_t success, const char 
*emsg)
     return;
   }
   label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->old_id,
-                                               sizeof(uint64_t));
+                                               sizeof(rvk->move_attr->old_id));
   GNUNET_assert (NULL != label);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing attribute %s\n", label);
   rvk->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
@@ -685,81 +684,69 @@ rvk_move_attr_cb (void *cls,
     GNUNET_SCHEDULER_add_now (&move_attrs_cont, rvk);
     return;
   }
-  rvk->move_attr->new_id =GNUNET_CRYPTO_random_u64 
(GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
-  new_label=NULL;
-  attr_data=NULL;
-  //new_rd = *rd;
+  GNUNET_RECLAIM_id_generate (&rvk->move_attr->new_id);
+  new_label = NULL;
+  attr_data = NULL;
+  // new_rd = *rd;
   for (int i = 0; i < rd_count; i++)
   {
-    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR == rd[i].record_type)
+    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE == rd[i].record_type)
     {
       /** find a new place for this attribute **/
-      struct GNUNET_RECLAIM_ATTRIBUTE_Claim *claim;
-      claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize (rd[i].data, 
rd[i].data_size);
+      struct GNUNET_RECLAIM_Attribute *claim;
+      claim = GNUNET_RECLAIM_attribute_deserialize (rd[i].data,
+                                                    rd[i].data_size);
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Attribute to update: Name=%s, ID=%" PRIu64 "\n",
-                  claim->name,
-                  claim->id);
+                  "Attribute to update: Name=%s\n",
+                  claim->name);
       claim->id = rvk->move_attr->new_id;
-      new_rd[i].data_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size 
(claim);
+      new_rd[i].data_size = GNUNET_RECLAIM_attribute_serialize_get_size 
(claim);
       attr_data = GNUNET_malloc (rd[i].data_size);
-      new_rd[i].data_size = GNUNET_RECLAIM_ATTRIBUTE_serialize (claim, 
attr_data);
+      new_rd[i].data_size = GNUNET_RECLAIM_attribute_serialize (claim,
+                                                                attr_data);
       new_rd[i].data = attr_data;
       new_rd[i].record_type = rd[i].record_type;
       new_rd[i].flags = rd[i].flags;
       new_rd[i].expiration_time = rd[i].expiration_time;
-      new_label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id,
-                                                       sizeof(uint64_t));
+      new_label =
+        GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id,
+                                             sizeof (rvk->move_attr->new_id));
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label);
       GNUNET_free (claim);
-    } else if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR == rd[i].record_type) 
+    }
+    else if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION == rd[i].record_type)
     {
-      struct GNUNET_RECLAIM_ATTESTATION_Claim *attest;
-      attest=GNUNET_RECLAIM_ATTESTATION_deserialize(rd[i].data, 
rd[i].data_size);
+      struct GNUNET_RECLAIM_Attestation *attest;
+      attest = GNUNET_RECLAIM_attestation_deserialize (rd[i].data,
+                                                       rd[i].data_size);
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Attestation to update: Name=%s, ID=%" PRIu64 "\n",
-                  attest->name,
-                  attest->id);
+                  "Attestation to update: Name=%s\n",
+                  attest->name);
       attest->id = rvk->move_attr->new_id;
-      new_rd[i].data_size = GNUNET_RECLAIM_ATTESTATION_serialize_get_size 
(attest);
+      new_rd[i].data_size =
+        GNUNET_RECLAIM_attestation_serialize_get_size (attest);
       attr_data = GNUNET_malloc (rd[i].data_size);
-      new_rd[i].data_size = GNUNET_RECLAIM_ATTESTATION_serialize (attest, 
attr_data);
+      new_rd[i].data_size = GNUNET_RECLAIM_attestation_serialize (attest,
+                                                                  attr_data);
       new_rd[i].data = attr_data;
       new_rd[i].record_type = rd[i].record_type;
       new_rd[i].flags = rd[i].flags;
       new_rd[i].expiration_time = rd[i].expiration_time;
-      new_label = GNUNET_STRINGS_data_to_string_alloc 
(&rvk->move_attr->new_id, sizeof(uint64_t));
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attestation %s\n", 
new_label);
+      new_label =
+        GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id,
+                                             sizeof (rvk->move_attr->new_id));
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attestation %s\n",
+                  new_label);
       GNUNET_free (attest);
-    } else if (GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE == rd[i].record_type)
-    {
-      struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference;
-      reference=GNUNET_RECLAIM_ATTESTATION_REF_deserialize(rd[i].data, 
rd[i].data_size);
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Reference to update: Name=%s, ID=%" PRIu64 "\n",
-                  reference->name,
-                  reference->id);
-      reference->id = rvk->move_attr->new_id;
-      reference->id_attest = rvk->move_attr->new_id;
-      new_rd[i].data_size = GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size 
(reference);
-      attr_data = GNUNET_malloc (rd[i].data_size);
-      new_rd[i].data_size = GNUNET_RECLAIM_ATTESTATION_REF_serialize 
(reference, attr_data);
-      new_rd[i].data = attr_data;
-      new_label = GNUNET_STRINGS_data_to_string_alloc 
(&rvk->move_attr->new_id, sizeof(uint64_t));
-      new_rd[i].record_type = rd[i].record_type;
-      new_rd[i].flags = rd[i].flags;
-      new_rd[i].expiration_time = rd[i].expiration_time;
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding reference %s\n", new_label);
-      GNUNET_free (reference);
     }
   }
   rvk->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
-                                           &rvk->identity,
-                                           new_label,
-                                           rd_count,
-                                           new_rd,
-                                           &move_attr_finished,
-                                           rvk);
+                                               &rvk->identity,
+                                               new_label,
+                                               rd_count,
+                                               new_rd,
+                                               &move_attr_finished,
+                                               rvk);
   GNUNET_free (new_label);
   GNUNET_free (attr_data);
 }
@@ -793,7 +780,7 @@ move_attrs (struct RECLAIM_TICKETS_RevokeHandle *rvk)
     return;
   }
   label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->old_id,
-                                               sizeof(uint64_t));
+                                               sizeof 
(rvk->move_attr->old_id));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Moving claim %s\n", label);
 
   rvk->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh,
@@ -873,10 +860,10 @@ revoke_attrs_cb (void *cls,
    */
   for (int i = 0; i < rd_count; i++)
   {
-    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type)
+    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type)
       continue;
     le = GNUNET_new (struct RevokedAttributeEntry);
-    le->old_id = *((uint64_t *) rd[i].data);
+    le->old_id = *((struct GNUNET_RECLAIM_Identifier *) rd[i].data);
     GNUNET_CONTAINER_DLL_insert (rvk->attrs_head, rvk->attrs_tail, le);
     rvk->ticket_attrs++;
   }
@@ -934,7 +921,8 @@ RECLAIM_TICKETS_revoke (const struct GNUNET_RECLAIM_Ticket 
*ticket,
   rvk->ticket = *ticket;
   GNUNET_CRYPTO_ecdsa_key_get_public (&rvk->identity, &rvk->ticket.identity);
   /** Get shared attributes **/
-  label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(uint64_t));
+  label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd,
+                                               sizeof(ticket->rnd));
   GNUNET_assert (NULL != label);
   rvk->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh,
                                                 identity,
@@ -991,7 +979,9 @@ cleanup_cth (struct RECLAIM_TICKETS_ConsumeHandle *cth)
   }
 
   if (NULL != cth->attrs)
-    GNUNET_RECLAIM_ATTRIBUTE_list_destroy (cth->attrs);
+    GNUNET_RECLAIM_attribute_list_destroy (cth->attrs);
+  if (NULL != cth->attests)
+    GNUNET_RECLAIM_attestation_list_destroy (cth->attests);
   GNUNET_free (cth);
 }
 
@@ -1010,7 +1000,7 @@ process_parallel_lookup_result (void *cls,
 {
   struct ParallelLookup *parallel_lookup = cls;
   struct RECLAIM_TICKETS_ConsumeHandle *cth = parallel_lookup->handle;
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *attr_le;
+  struct GNUNET_RECLAIM_AttributeListEntry *attr_le;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Parallel lookup finished (count=%u)\n",
@@ -1036,67 +1026,40 @@ process_parallel_lookup_result (void *cls,
   // REMARK: It is possible now to find rd_count > 1
   for (int i = 0; i < rd_count; i++)
   {
-    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR == rd[i].record_type)
+    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE == rd[i].record_type)
     {
-      attr_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
-      attr_le->claim =
-        GNUNET_RECLAIM_ATTRIBUTE_deserialize (rd[i].data, rd[i].data_size);
+      attr_le = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry);
+      attr_le->attribute =
+        GNUNET_RECLAIM_attribute_deserialize (rd[i].data, rd[i].data_size);
       GNUNET_CONTAINER_DLL_insert (cth->attrs->list_head,
                                    cth->attrs->list_tail,
                                    attr_le);
-      attr_le->reference = NULL;
-      attr_le->attest = NULL;
     }
-    else if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR == rd[i].record_type)
+    else if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION == rd[i].record_type)
     {
-      /**Ignore all plain attestations
-      *attr_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
-      *attr_le->attest =
-      *  GNUNET_RECLAIM_ATTESTATION_deserialize (rd[i].data, rd[i].data_size);
-      *GNUNET_CONTAINER_DLL_insert (cth->attrs->list_head,
-      *                             cth->attrs->list_tail,
-      *                             attr_le);
-      */
-      continue;
+      struct GNUNET_RECLAIM_AttestationListEntry *ale;
+      ale = GNUNET_new (struct GNUNET_RECLAIM_AttestationListEntry);
+      ale->attestation =
+        GNUNET_RECLAIM_attestation_deserialize (rd[i].data,
+                                                rd[i].data_size);
+      GNUNET_CONTAINER_DLL_insert (cth->attests->list_head,
+                                   cth->attests->list_tail,
+                                   ale);
     }
-    else if (GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE == rd[i].record_type)
+    else
     {
-      struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *attr_le2;
-      attr_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
-      attr_le2 = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
-      if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR == rd[0].record_type)
-      {
-        attr_le->attest = GNUNET_RECLAIM_ATTESTATION_deserialize (rd[0].data,
-                                                                  rd[0].
-                                                                  data_size);
-        attr_le2->reference =
-          GNUNET_RECLAIM_ATTESTATION_REF_deserialize (rd[i].data,
-                                                      rd[i].data_size);
-        attr_le->claim = NULL;
-        attr_le->reference = NULL;
-        attr_le2->claim = NULL;
-        attr_le2->attest = NULL;
-        GNUNET_CONTAINER_DLL_insert (cth->attrs->list_head,
-                                     cth->attrs->list_tail,
-                                     attr_le);
-        GNUNET_CONTAINER_DLL_insert (cth->attrs->list_head,
-                                     cth->attrs->list_tail,
-                                     attr_le2);
-      }
-      else
-      {
-        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                    "Parallel Lookup of Reference without Attestation");
-        continue;
-      }
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Parallel Lookup of Reference without Attestation");
+      continue;
+    }
 
 
-    }
   }
   if (NULL != cth->parallel_lookups_head)
     return; // Wait for more
   /* Else we are done */
-  cth->cb (cth->cb_cls, &cth->ticket.identity, cth->attrs, GNUNET_OK, NULL);
+  cth->cb (cth->cb_cls, &cth->ticket.identity,
+           cth->attrs, cth->attests, GNUNET_OK, NULL);
   cleanup_cth (cth);
 }
 
@@ -1125,7 +1088,7 @@ abort_parallel_lookups (void *cls)
     GNUNET_free (lu);
     lu = tmp;
   }
-  cth->cb (cth->cb_cls, NULL, NULL, GNUNET_SYSERR, "Aborted");
+  cth->cb (cth->cb_cls, NULL, NULL, NULL, GNUNET_SYSERR, "Aborted");
 }
 
 
@@ -1162,10 +1125,11 @@ lookup_authz_cb (void *cls,
 
   for (int i = 0; i < rd_count; i++)
   {
-    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type)
+    if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type) &&
+        (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF != rd[i].record_type))
       continue;
     lbl = GNUNET_STRINGS_data_to_string_alloc (rd[i].data, rd[i].data_size);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Attribute ref found %s\n", lbl);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ticket reference found %s\n", lbl);
     parallel_lookup = GNUNET_new (struct ParallelLookup);
     parallel_lookup->handle = cth;
     parallel_lookup->label = lbl;
@@ -1197,7 +1161,8 @@ lookup_authz_cb (void *cls,
   /**
    * No references found, return empty attribute list
    */
-  cth->cb (cth->cb_cls, &cth->ticket.identity, cth->attrs, GNUNET_OK, NULL);
+  cth->cb (cth->cb_cls, &cth->ticket.identity,
+           cth->attrs, cth->attests, GNUNET_OK, NULL);
   cleanup_cth (cth);
 }
 
@@ -1226,12 +1191,14 @@ RECLAIM_TICKETS_consume (const struct 
GNUNET_CRYPTO_EcdsaPrivateKey *id,
 
   cth->identity = *id;
   GNUNET_CRYPTO_ecdsa_key_get_public (&cth->identity, &cth->identity_pub);
-  cth->attrs = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
+  cth->attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
+  cth->attests = GNUNET_new (struct GNUNET_RECLAIM_AttestationList);
   cth->ticket = *ticket;
   cth->cb = cb;
   cth->cb_cls = cb_cls;
   label =
-    GNUNET_STRINGS_data_to_string_alloc (&cth->ticket.rnd, sizeof(uint64_t));
+    GNUNET_STRINGS_data_to_string_alloc (&cth->ticket.rnd,
+                                         sizeof(cth->ticket.rnd));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Looking for AuthZ info under %s\n",
               label);
@@ -1240,7 +1207,7 @@ RECLAIM_TICKETS_consume (const struct 
GNUNET_CRYPTO_EcdsaPrivateKey *id,
     GNUNET_GNS_lookup (gns,
                        label,
                        &cth->ticket.identity,
-                       GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF,
+                       GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF,
                        GNUNET_GNS_LO_DEFAULT,
                        &lookup_authz_cb,
                        cth);
@@ -1316,74 +1283,50 @@ store_ticket_issue_cont (void *cls, int32_t success, 
const char *emsg)
 static void
 issue_ticket (struct TicketIssueHandle *ih)
 {
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
+  struct GNUNET_RECLAIM_AttributeListEntry *le;
   struct GNUNET_GNSRECORD_Data *attrs_record;
   char *label;
-  size_t list_len = 1;
   int i;
-  char *attest_string;
+  int attrs_count = 0;
 
   for (le = ih->attrs->list_head; NULL != le; le = le->next)
-    list_len++;
+    attrs_count++;
 
+  //Worst case we have one attestation per attribute
   attrs_record =
-    GNUNET_malloc (list_len * sizeof(struct GNUNET_GNSRECORD_Data));
+    GNUNET_malloc (2 * attrs_count * sizeof(struct GNUNET_GNSRECORD_Data));
   i = 0;
   for (le = ih->attrs->list_head; NULL != le; le = le->next)
   {
-    if (NULL != le->claim)
-    {
-      attrs_record[i].data = &le->claim->id;
-      attrs_record[i].data_size = sizeof(le->claim->id);
-    }
-    else if (NULL != le->attest)
-    {
-      // REMARK: Since we only store IDs, the references are irrelevant
-      int j = 0;
-      GNUNET_asprintf (&attest_string,"%d",le->attest->id);
-      while (j<i)
-      {
-        if (0 == strcmp (attest_string,GNUNET_STRINGS_data_to_string_alloc (
-                           attrs_record[j].data, attrs_record[j].data_size)))
-          break;
-        j++;
-      }
-      if (j < i)
-      {
-        list_len--;
-        continue;
-      }
-      attrs_record[i].data = &le->attest->id;
-      attrs_record[i].data_size = sizeof(le->attest->id);
-    }
-    else if (NULL != le->reference)
+    attrs_record[i].data = &le->attribute->id;
+    attrs_record[i].data_size = sizeof(le->attribute->id);
+    attrs_record[i].expiration_time = ticket_refresh_interval.rel_value_us;
+    attrs_record[i].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF;
+    attrs_record[i].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
+    i++;
+    if (GNUNET_NO == GNUNET_RECLAIM_id_is_zero (&le->attribute->attestation))
     {
-      list_len--;
-      continue;
-      /*
-      int j = 0;
-      GNUNET_asprintf (&attest_string,"%d",le->attest->id);
-      while (j<i)
+      int j;
+      for (j = 0; j < i; j++)
       {
-        if (strcmp(attest_string, GNUNET_STRINGS_data_to_string_alloc (
-              attrs_record[j].data, attrs_record[j].data_size)))
+        if (attrs_record[j].record_type
+            != GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF)
+          continue;
+        if (0 == memcmp (attrs_record[j].data,
+                         &le->attribute->attestation,
+                         sizeof (le->attribute->attestation)))
           break;
-        j++;
       }
       if (j < i)
-        continue;
-      attrs_record[i].data = &le->reference->id;
-      attrs_record[i].data_size = sizeof(le->reference->id);
-      */
+        continue; // Skip as we have already added this attestation.
+      attrs_record[i].data = &le->attribute->attestation;
+      attrs_record[i].data_size = sizeof(le->attribute->attestation);
+      attrs_record[i].expiration_time = ticket_refresh_interval.rel_value_us;
+      attrs_record[i].record_type =
+        GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF;
+      attrs_record[i].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
+      i++;
     }
-    /**
-     * FIXME: Should this be the attribute expiration time or ticket
-     * refresh interval? Probably min(attrs.expiration)
-     */
-    attrs_record[i].expiration_time = ticket_refresh_interval.rel_value_us;
-    attrs_record[i].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF;
-    attrs_record[i].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
-    i++;
   }
   attrs_record[i].data = &ih->ticket;
   attrs_record[i].data_size = sizeof(struct GNUNET_RECLAIM_Ticket);
@@ -1391,14 +1334,16 @@ issue_ticket (struct TicketIssueHandle *ih)
   attrs_record[i].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET;
   attrs_record[i].flags =
     GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION | GNUNET_GNSRECORD_RF_PRIVATE;
+  i++;
 
   label =
-    GNUNET_STRINGS_data_to_string_alloc (&ih->ticket.rnd, sizeof(uint64_t));
+    GNUNET_STRINGS_data_to_string_alloc (&ih->ticket.rnd,
+                                         sizeof(ih->ticket.rnd));
   // Publish record
   ih->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
                                               &ih->identity,
                                               label,
-                                              list_len,
+                                              i,
                                               attrs_record,
                                               &store_ticket_issue_cont,
                                               ih);
@@ -1454,14 +1399,20 @@ filter_tickets_cb (void *cls,
   struct GNUNET_RECLAIM_Ticket *ticket = NULL;
 
   // figure out the number of requested attributes
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
+  struct GNUNET_RECLAIM_AttributeListEntry *le;
   unsigned int attr_cnt = 0;
+  unsigned int attest_cnt = 0;
 
   for (le = tih->attrs->list_head; NULL != le; le = le->next)
+  {
     attr_cnt++;
+    if (GNUNET_NO == GNUNET_RECLAIM_id_is_zero (&le->attribute->attestation))
+      attest_cnt++;
+  }
 
   // ticket search
   unsigned int found_attrs_cnt = 0;
+  unsigned int found_attests_cnt = 0;
 
   for (int i = 0; i < rd_count; i++)
   {
@@ -1481,39 +1432,20 @@ filter_tickets_cb (void *cls,
     }
 
     // cmp requested attributes with ticket attributes
-    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type)
+    if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type) &&
+        (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF != rd[i].record_type))
       continue;
     for (le = tih->attrs->list_head; NULL != le; le = le->next)
     {
-      // cmp attr_ref id with requested attr id
-      if (NULL !=le->claim)
-      {
-        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                    " %" PRIu64 "\n  %" PRIu64 "\n",
-                    *((uint64_t *) rd[i].data),
-                    le->claim->id);
-        if (0 == memcmp (rd[i].data, &le->claim->id, sizeof(uint64_t)))
-          found_attrs_cnt++;
-      }
-      else if (NULL !=le->attest)
-      {
-        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                    " %" PRIu64 "\n  %" PRIu64 "\n",
-                    *((uint64_t *) rd[i].data),
-                    le->attest->id);
-        if (0 == memcmp (rd[i].data, &le->attest->id, sizeof(uint64_t)))
-          found_attrs_cnt++;
-      }
-      else if (NULL != le->reference)
-      {
-        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                    " %" PRIu64 "\n  %" PRIu64 "\n",
-                    *((uint64_t *) rd[i].data),
-                    le->reference->id);
-        if (0 == memcmp (rd[i].data, &le->reference->id, sizeof(uint64_t)))
-          found_attrs_cnt++;
-      }
-
+      if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data,
+                                                    &le->attribute->id))
+        found_attrs_cnt++;
+    }
+    for (le = tih->attrs->list_head; NULL != le; le = le->next)
+    {
+      if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data,
+                                                    
&le->attribute->attestation))
+        found_attests_cnt++;
     }
   }
 
@@ -1521,7 +1453,9 @@ filter_tickets_cb (void *cls,
    * If we found a matching ticket, return that to the caller and
    * we are done.
    */
-  if ((attr_cnt == found_attrs_cnt) && (NULL != ticket))
+  if ((attr_cnt == found_attrs_cnt) &&
+      (attest_cnt == found_attests_cnt) &&
+      (NULL != ticket))
   {
     GNUNET_NAMESTORE_zone_iteration_stop (tih->ns_it);
     tih->cb (tih->cb_cls, &tih->ticket, GNUNET_OK, NULL);
@@ -1547,8 +1481,7 @@ filter_tickets_finished_cb (void *cls)
   struct TicketIssueHandle *tih = cls;
 
   GNUNET_CRYPTO_ecdsa_key_get_public (&tih->identity, &tih->ticket.identity);
-  tih->ticket.rnd =
-    GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
+  GNUNET_RECLAIM_id_generate (&tih->ticket.rnd);
   issue_ticket (tih);
 }
 
@@ -1566,7 +1499,7 @@ filter_tickets_finished_cb (void *cls)
  */
 void
 RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
-                       const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
+                       const struct GNUNET_RECLAIM_AttributeList *attrs,
                        const struct GNUNET_CRYPTO_EcdsaPublicKey *audience,
                        RECLAIM_TICKETS_TicketResult cb,
                        void *cb_cls)
@@ -1576,7 +1509,7 @@ RECLAIM_TICKETS_issue (const struct 
GNUNET_CRYPTO_EcdsaPrivateKey *identity,
   tih = GNUNET_new (struct TicketIssueHandle);
   tih->cb = cb;
   tih->cb_cls = cb_cls;
-  tih->attrs = GNUNET_RECLAIM_ATTRIBUTE_list_dup (attrs);
+  tih->attrs = GNUNET_RECLAIM_attribute_list_dup (attrs);
   tih->identity = *identity;
   tih->ticket.audience = *audience;
 
diff --git a/src/reclaim/gnunet-service-reclaim_tickets.h 
b/src/reclaim/gnunet-service-reclaim_tickets.h
index c75cefc03..1c7214d42 100644
--- a/src/reclaim/gnunet-service-reclaim_tickets.h
+++ b/src/reclaim/gnunet-service-reclaim_tickets.h
@@ -36,7 +36,7 @@
 #include "gnunet_gns_service.h"
 #include "gnunet_gnsrecord_lib.h"
 #include "gnunet_protocols.h"
-#include "gnunet_reclaim_attribute_lib.h"
+#include "gnunet_reclaim_lib.h"
 #include "gnunet_reclaim_service.h"
 #include "gnunet_signatures.h"
 #include "gnunet_statistics_service.h"
@@ -136,7 +136,8 @@ typedef void (*RECLAIM_TICKETS_TicketResult) (
 typedef void (*RECLAIM_TICKETS_ConsumeCallback) (
   void *cls,
   const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
-  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *l,
+  const struct GNUNET_RECLAIM_AttributeList *attributes,
+  const struct GNUNET_RECLAIM_AttestationList *attestations,
   int32_t success,
   const char *emsg);
 
@@ -217,7 +218,7 @@ RECLAIM_TICKETS_consume_cancel (struct 
RECLAIM_TICKETS_ConsumeHandle *cth);
  */
 void
 RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
-                       const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
+                       const struct GNUNET_RECLAIM_AttributeList *attrs,
                        const struct GNUNET_CRYPTO_EcdsaPublicKey *audience,
                        RECLAIM_TICKETS_TicketResult cb,
                        void *cb_cls);
diff --git a/src/reclaim/json_reclaim.c b/src/reclaim/json_reclaim.c
index a464a9088..353303187 100644
--- a/src/reclaim/json_reclaim.c
+++ b/src/reclaim/json_reclaim.c
@@ -28,7 +28,7 @@
 #include "gnunet_util_lib.h"
 
 #include "gnunet_json_lib.h"
-#include "gnunet_reclaim_attribute_lib.h"
+#include "gnunet_reclaim_lib.h"
 #include "gnunet_reclaim_service.h"
 
 
@@ -43,11 +43,12 @@
 static int
 parse_attr (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 {
-  struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr;
+  struct GNUNET_RECLAIM_Attribute *attr;
   const char *name_str = NULL;
   const char *val_str = NULL;
   const char *type_str = NULL;
   const char *id_str = NULL;
+  const char *attest_str = NULL;
   const char *flag_str = NULL;
   char *data;
   int unpack_state;
@@ -64,11 +65,13 @@ parse_attr (void *cls, json_t *root, struct 
GNUNET_JSON_Specification *spec)
   }
   // interpret single attribute
   unpack_state = json_unpack (root,
-                              "{s:s, s?s, s:s, s:s, s?s!}",
+                              "{s:s, s?s, s?s, s:s, s:s, s?s!}",
                               "name",
                               &name_str,
                               "id",
                               &id_str,
+                              "attestation",
+                              &attest_str,
                               "type",
                               &type_str,
                               "value",
@@ -82,9 +85,9 @@ parse_attr (void *cls, json_t *root, struct 
GNUNET_JSON_Specification *spec)
                 "Error json object has a wrong format!\n");
     return GNUNET_SYSERR;
   }
-  type = GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (type_str);
+  type = GNUNET_RECLAIM_attribute_typename_to_number (type_str);
   if (GNUNET_SYSERR ==
-      (GNUNET_RECLAIM_ATTRIBUTE_string_to_value (type,
+      (GNUNET_RECLAIM_attribute_string_to_value (type,
                                                  val_str,
                                                  (void **) &data,
                                                  &data_size)))
@@ -92,16 +95,24 @@ parse_attr (void *cls, json_t *root, struct 
GNUNET_JSON_Specification *spec)
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Attribute value invalid!\n");
     return GNUNET_SYSERR;
   }
-  attr = GNUNET_RECLAIM_ATTRIBUTE_claim_new (name_str, type, data, data_size);
+  attr = GNUNET_RECLAIM_attribute_new (name_str, NULL,
+                                       type, data, data_size);
+  if ((NULL != attest_str) && (0 != strlen (attest_str)))
+  {
+     GNUNET_STRINGS_string_to_data (attest_str,
+                                   strlen (attest_str),
+                                   &attr->attestation,
+                                   sizeof(attr->attestation));
+  }
   if ((NULL == id_str) || (0 == strlen (id_str)))
-    attr->id = 0;
+    memset (&attr->id, 0, sizeof (attr->id));
   else
     GNUNET_STRINGS_string_to_data (id_str,
                                    strlen (id_str),
                                    &attr->id,
-                                   sizeof(uint64_t));
+                                   sizeof(attr->id));
 
-  *(struct GNUNET_RECLAIM_ATTRIBUTE_Claim **) spec->ptr = attr;
+  *(struct GNUNET_RECLAIM_Attribute **) spec->ptr = attr;
   return GNUNET_OK;
 }
 
@@ -115,9 +126,9 @@ parse_attr (void *cls, json_t *root, struct 
GNUNET_JSON_Specification *spec)
 static void
 clean_attr (void *cls, struct GNUNET_JSON_Specification *spec)
 {
-  struct GNUNET_RECLAIM_ATTRIBUTE_Claim **attr;
+  struct GNUNET_RECLAIM_Attribute **attr;
 
-  attr = (struct GNUNET_RECLAIM_ATTRIBUTE_Claim **) spec->ptr;
+  attr = (struct GNUNET_RECLAIM_Attribute **) spec->ptr;
   if (NULL != *attr)
   {
     GNUNET_free (*attr);
@@ -129,11 +140,11 @@ clean_attr (void *cls, struct GNUNET_JSON_Specification 
*spec)
 /**
  * JSON Specification for Reclaim claims.
  *
- * @param ticket struct of GNUNET_RECLAIM_ATTRIBUTE_Claim to fill
+ * @param ticket struct of GNUNET_RECLAIM_Attribute to fill
  * @return JSON Specification
  */
 struct GNUNET_JSON_Specification
-GNUNET_RECLAIM_JSON_spec_claim (struct GNUNET_RECLAIM_ATTRIBUTE_Claim **attr)
+GNUNET_RECLAIM_JSON_spec_claim (struct GNUNET_RECLAIM_Attribute **attr)
 {
   struct GNUNET_JSON_Specification ret = { .parser = &parse_attr,
                                            .cleaner = &clean_attr,
@@ -192,7 +203,7 @@ parse_ticket (void *cls, json_t *root, struct 
GNUNET_JSON_Specification *spec)
   if (GNUNET_OK != GNUNET_STRINGS_string_to_data (rnd_str,
                                                   strlen (rnd_str),
                                                   &ticket->rnd,
-                                                  sizeof(uint64_t)))
+                                                  sizeof(ticket->rnd)))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Rnd invalid\n");
     GNUNET_free (ticket);
@@ -279,7 +290,7 @@ GNUNET_RECLAIM_JSON_spec_ticket (struct 
GNUNET_RECLAIM_Ticket **ticket)
 static int
 parse_attest (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 {
-  struct GNUNET_RECLAIM_ATTESTATION_Claim *attr;
+  struct GNUNET_RECLAIM_Attestation *attr;
   const char *name_str = NULL;
   const char *val_str = NULL;
   const char *type_str = NULL;
@@ -315,9 +326,9 @@ parse_attest (void *cls, json_t *root, struct 
GNUNET_JSON_Specification *spec)
                 "Error json object has a wrong format!\n");
     return GNUNET_SYSERR;
   }
-  type = GNUNET_RECLAIM_ATTESTATION_typename_to_number (type_str);
+  type = GNUNET_RECLAIM_attestation_typename_to_number (type_str);
   if (GNUNET_SYSERR ==
-      (GNUNET_RECLAIM_ATTESTATION_string_to_value (type,
+      (GNUNET_RECLAIM_attestation_string_to_value (type,
                                                    val_str,
                                                    (void **) &data,
                                                    &data_size)))
@@ -325,16 +336,16 @@ parse_attest (void *cls, json_t *root, struct 
GNUNET_JSON_Specification *spec)
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Attestation value invalid!\n");
     return GNUNET_SYSERR;
   }
-  attr = GNUNET_RECLAIM_ATTESTATION_claim_new (name_str, type, data, 
data_size);
+  attr = GNUNET_RECLAIM_attestation_new (name_str, type, data, data_size);
   if ((NULL == id_str) || (0 == strlen (id_str)))
-    attr->id = 0;
+    memset (&attr->id, 0, sizeof (attr->id));
   else
     GNUNET_STRINGS_string_to_data (id_str,
                                    strlen (id_str),
                                    &attr->id,
-                                   sizeof(uint64_t));
+                                   sizeof(attr->id));
 
-  *(struct GNUNET_RECLAIM_ATTESTATION_Claim **) spec->ptr = attr;
+  *(struct GNUNET_RECLAIM_Attestation **) spec->ptr = attr;
   return GNUNET_OK;
 }
 
@@ -347,9 +358,9 @@ parse_attest (void *cls, json_t *root, struct 
GNUNET_JSON_Specification *spec)
 static void
 clean_attest (void *cls, struct GNUNET_JSON_Specification *spec)
 {
-  struct GNUNET_RECLAIM_ATTESTATION_Claim **attr;
+  struct GNUNET_RECLAIM_Attestation **attr;
 
-  attr = (struct GNUNET_RECLAIM_ATTESTATION_Claim **) spec->ptr;
+  attr = (struct GNUNET_RECLAIM_Attestation **) spec->ptr;
   if (NULL != *attr)
   {
     GNUNET_free (*attr);
@@ -364,7 +375,7 @@ clean_attest (void *cls, struct GNUNET_JSON_Specification 
*spec)
  */
 struct GNUNET_JSON_Specification
 GNUNET_RECLAIM_JSON_spec_claim_attest (struct
-                                       GNUNET_RECLAIM_ATTESTATION_Claim **attr)
+                                       GNUNET_RECLAIM_Attestation **attr)
 {
   struct GNUNET_JSON_Specification ret = { .parser = &parse_attest,
                                            .cleaner = &clean_attest,
@@ -378,106 +389,3 @@ GNUNET_RECLAIM_JSON_spec_claim_attest (struct
   return ret;
 }
 
-/**
-   * Parse given JSON object to an attestation claim
-   *
-   * @param cls closure, NULL
-   * @param root the json object representing data
-   * @param spec where to write the data
-   * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
-   */
-static int
-parse_attest_ref (void *cls, json_t *root, struct
-                  GNUNET_JSON_Specification *spec)
-{
-  struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr;
-  const char *name_str = NULL;
-  const char *ref_val_str = NULL;
-  const char *ref_id_str = NULL;
-  const char *id_str = NULL;
-  int unpack_state;
-
-  GNUNET_assert (NULL != root);
-
-  if (! json_is_object (root))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Error json is not array nor object!\n");
-    return GNUNET_SYSERR;
-  }
-  // interpret single reference
-  unpack_state = json_unpack (root,
-                              "{s:s, s?s, s:s, s:s!}",
-                              "name",
-                              &name_str,
-                              "id",
-                              &id_str,
-                              "ref_id",
-                              &ref_id_str,
-                              "ref_value",
-                              &ref_val_str);
-  if ((0 != unpack_state) || (NULL == name_str) || (NULL == ref_val_str) ||
-      (NULL == ref_id_str))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Error json object has a wrong format!\n");
-    return GNUNET_SYSERR;
-  }
-
-  attr = GNUNET_RECLAIM_ATTESTATION_reference_new (name_str, ref_val_str);
-
-  attr->id = 0;
-
-  if ((NULL == ref_id_str) || (0 == strlen (ref_id_str)))
-    attr->id_attest = 0;
-  else
-    GNUNET_STRINGS_string_to_data (ref_id_str,
-                                   strlen (ref_id_str),
-                                   &attr->id_attest,
-                                   sizeof(uint64_t));
-
-  *(struct GNUNET_RECLAIM_ATTESTATION_REFERENCE **) spec->ptr = attr;
-  return GNUNET_OK;
-}
-
-/**
- * Cleanup data left from parsing RSA public key.
- *
- * @param cls closure, NULL
- * @param[out] spec where to free the data
- */
-static void
-clean_attest_ref (void *cls, struct GNUNET_JSON_Specification *spec)
-{
-  struct GNUNET_RECLAIM_ATTESTATION_REFERENCE **attr;
-
-  attr = (struct GNUNET_RECLAIM_ATTESTATION_REFERENCE **) spec->ptr;
-  if (NULL != *attr)
-  {
-    GNUNET_free (*attr);
-    *attr = NULL;
-  }
-}
-
-/**
- * JSON Specification for Reclaim attestation references.
- *
- * @param ticket struct of GNUNET_RECLAIM_ATTESTATION_REFERENCE to fill
- * @return JSON Specification
- */
-struct GNUNET_JSON_Specification
-GNUNET_RECLAIM_JSON_spec_claim_attest_ref (struct
-                                           GNUNET_RECLAIM_ATTESTATION_REFERENCE
-                                           **attr)
-{
-  struct GNUNET_JSON_Specification ret = { .parser = &parse_attest_ref,
-                                           .cleaner = &clean_attest_ref,
-                                           .cls = NULL,
-                                           .field = NULL,
-                                           .ptr = attr,
-                                           .ptr_size = 0,
-                                           .size_ptr = NULL };
-
-  *attr = NULL;
-  return ret;
-}
\ No newline at end of file
diff --git a/src/reclaim/json_reclaim.h b/src/reclaim/json_reclaim.h
index 9e6479e5e..61ddb4378 100644
--- a/src/reclaim/json_reclaim.h
+++ b/src/reclaim/json_reclaim.h
@@ -27,7 +27,7 @@
 #include "gnunet_util_lib.h"
 #include "gnunet_json_lib.h"
 #include "gnunet_reclaim_service.h"
-#include "gnunet_reclaim_attribute_lib.h"
+#include "gnunet_reclaim_lib.h"
 
 /**
  * JSON Specification for Reclaim claims.
@@ -36,7 +36,7 @@
  * @return JSON Specification
  */
 struct GNUNET_JSON_Specification
-GNUNET_RECLAIM_JSON_spec_claim (struct GNUNET_RECLAIM_ATTRIBUTE_Claim **attr);
+GNUNET_RECLAIM_JSON_spec_claim (struct GNUNET_RECLAIM_Attribute **attr);
 
 /**
  * JSON Specification for Reclaim tickets.
@@ -50,18 +50,10 @@ GNUNET_RECLAIM_JSON_spec_ticket (struct 
GNUNET_RECLAIM_Ticket **ticket);
 /**
     * JSON Specification for Reclaim attestation claims.
     *
-    * @param ticket struct of GNUNET_RECLAIM_ATTESTATION_Claim to fill
+    * @param ticket struct of GNUNET_RECLAIM_Attestation to fill
     * @return JSON Specification
     */
 struct GNUNET_JSON_Specification
 GNUNET_RECLAIM_JSON_spec_claim_attest (struct
-                                       GNUNET_RECLAIM_ATTESTATION_Claim 
**attr);
+                                       GNUNET_RECLAIM_Attestation **attr);
 
-  /**
-   * JSON Specification for Reclaim attestation references.
-   *
-   * @param ticket struct of GNUNET_RECLAIM_ATTESTATION_REFERENCE to fill
-   * @return JSON Specification
-   */
-  struct GNUNET_JSON_Specification
-  GNUNET_RECLAIM_JSON_spec_claim_attest_ref(struct 
GNUNET_RECLAIM_ATTESTATION_REFERENCE **attr);
diff --git a/src/reclaim/oidc_helper.c b/src/reclaim/oidc_helper.c
index 2ce462854..469b8a796 100644
--- a/src/reclaim/oidc_helper.c
+++ b/src/reclaim/oidc_helper.c
@@ -27,7 +27,7 @@
 #include <inttypes.h>
 #include <jansson.h>
 #include "gnunet_util_lib.h"
-#include "gnunet_reclaim_attribute_lib.h"
+#include "gnunet_reclaim_lib.h"
 #include "gnunet_reclaim_service.h"
 #include "gnunet_signatures.h"
 #include "oidc_helper.h"
@@ -60,6 +60,11 @@ struct OIDC_Parameters
    * The length of the attributes list
    */
   uint32_t attr_list_len GNUNET_PACKED;
+
+  /**
+   * The length of the attestation list
+   */
+  uint32_t attest_list_len GNUNET_PACKED;
 };
 
 GNUNET_NETWORK_STRUCT_END
@@ -118,12 +123,14 @@ fix_base64 (char *str)
 char *
 OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
                    const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key,
-                   struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
+                   struct GNUNET_RECLAIM_AttributeList *attrs,
+                   struct GNUNET_RECLAIM_AttestationList *attests,
                    const struct GNUNET_TIME_Relative *expiration_time,
                    const char *nonce,
                    const char *secret_key)
 {
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
+  struct GNUNET_RECLAIM_AttributeListEntry *le;
+  struct GNUNET_RECLAIM_AttestationListEntry *ale;
   struct GNUNET_HashCode signature;
   struct GNUNET_TIME_Absolute exp_time;
   struct GNUNET_TIME_Absolute time_now;
@@ -146,7 +153,12 @@ OIDC_id_token_new (const struct 
GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
   json_t *aggr_names;
   json_t *aggr_sources;
   json_t *aggr_sources_jwt;
-  uint64_t attest_arr[GNUNET_RECLAIM_ATTRIBUTE_list_count_attest (attrs)];
+  int num_attestations = 0;
+  for (le = attrs->list_head; NULL != le; le = le->next)
+  {
+    if (GNUNET_NO == GNUNET_RECLAIM_id_is_zero (&le->attribute->attestation))
+      num_attestations++;
+  }
 
   // iat REQUIRED time now
   time_now = GNUNET_TIME_absolute_get ();
@@ -191,95 +203,73 @@ OIDC_id_token_new (const struct 
GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
   // nonce
   if (NULL != nonce)
     json_object_set_new (body, "nonce", json_string (nonce));
-  int i = 0;
   attest_val_str = NULL;
   aggr_names_str = NULL;
   aggr_sources_str = NULL;
   aggr_sources_jwt_str = NULL;
   source_name = NULL;
+  int i = 0;
+  for (ale = attests->list_head; NULL != ale; ale = ale->next)
+  {
+    // New Attestation
+    GNUNET_asprintf (&source_name,
+                     "src%d",
+                     i);
+    aggr_sources_jwt = json_object ();
+    attest_val_str =
+      GNUNET_RECLAIM_attestation_value_to_string (ale->attestation->type,
+                                                  ale->attestation->data,
+                                                  ale->attestation->data_size);
+    json_object_set_new (aggr_sources_jwt, "JWT",
+                         json_string (attest_val_str) );
+    aggr_sources_jwt_str = json_dumps (aggr_sources_jwt, JSON_INDENT (0)
+                                       | JSON_COMPACT);
+    json_object_set_new (aggr_sources, source_name,json_string (
+                           aggr_sources_jwt_str));
+    i++;
+  }
+
   for (le = attrs->list_head; NULL != le; le = le->next)
   {
 
-    if (le->claim != NULL)
+    if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&le->attribute->attestation))
     {
 
       attr_val_str =
-        GNUNET_RECLAIM_ATTRIBUTE_value_to_string (le->claim->type,
-                                                  le->claim->data,
-                                                  le->claim->data_size);
-      json_object_set_new (body, le->claim->name, json_string (attr_val_str));
+        GNUNET_RECLAIM_attribute_value_to_string (le->attribute->type,
+                                                  le->attribute->data,
+                                                  le->attribute->data_size);
+      json_object_set_new (body, le->attribute->name,
+                           json_string (attr_val_str));
       GNUNET_free (attr_val_str);
     }
-    else if (NULL != le->reference)
+    else
     {
       // Check if attest is there
       int j = 0;
-      while (j<i)
-      {
-        if (attest_arr[j] == le->reference->id_attest)
-          break;
-        j++;
-      }
-      if (j==i)
-      {
-        // Attest not yet existent. Append to the end of the list
-        GNUNET_CONTAINER_DLL_remove (attrs->list_head, attrs->list_tail, le);
-        GNUNET_CONTAINER_DLL_insert_tail (attrs->list_head, attrs->list_tail,
-                                          le);
-        continue;
-      }
-      else
-      {
-        // Attestation is existing, hence take the respective source str
-        GNUNET_asprintf (&source_name,
-                         "src%d",
-                         j);
-        json_object_set_new (aggr_names, le->reference->name, json_string (
-                               source_name));
-      }
-
-    }
-    else if (NULL != le->attest)
-    {
-      // We assume that at max 99 different attestations
-      int j = 0;
-      while (j<i)
+      for (ale = attests->list_head; NULL != ale; ale = ale->next)
       {
-        if (attest_arr[j] == le->attest->id)
+        if (GNUNET_YES ==
+            GNUNET_RECLAIM_id_is_equal (&ale->attestation->id,
+                                        &le->attribute->attestation))
           break;
         j++;
       }
-      if (j==i)
-      {
-        // New Attestation
-        attest_arr[i] = le->attest->id;
-        GNUNET_asprintf (&source_name,
-                         "src%d",
-                         i);
-        aggr_sources_jwt = json_object ();
-        attest_val_str = GNUNET_RECLAIM_ATTESTATION_value_to_string (
-          le->attest->type, le->attest->data, le->attest->data_size);
-        json_object_set_new (aggr_sources_jwt, "JWT",json_string (
-                               attest_val_str) );
-        aggr_sources_jwt_str = json_dumps (aggr_sources_jwt, JSON_INDENT (0)
-                                           | JSON_COMPACT);
-        json_object_set_new (aggr_sources, source_name,json_string (
-                               aggr_sources_jwt_str));
-        i++;
-      }
-      else
-      {
-        // Attestation already existent. Ignore
-        continue;
-      }
-
+      GNUNET_assert (NULL != ale);
+      // Attestation is existing, hence take the respective source str
+      GNUNET_asprintf (&source_name,
+                       "src%d",
+                       j);
+      json_object_set_new (aggr_names, le->attribute->data,
+                           json_string (source_name));
     }
   }
+
   if (NULL != attest_val_str)
     GNUNET_free (attest_val_str);
   if (NULL != source_name)
     GNUNET_free (source_name);
-  if (0!=i)
+  if (0 != i)
   {
     aggr_names_str = json_dumps (aggr_names, JSON_INDENT (0) | JSON_COMPACT);
     aggr_sources_str = json_dumps (aggr_sources, JSON_INDENT (0)
@@ -297,10 +287,10 @@ OIDC_id_token_new (const struct 
GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
   json_decref (body);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"ID-Token: %s\n", body_str);
 
-  GNUNET_STRINGS_base64_encode (header, strlen (header), &header_base64);
+  GNUNET_STRINGS_base64url_encode (header, strlen (header), &header_base64);
   fix_base64 (header_base64);
 
-  GNUNET_STRINGS_base64_encode (body_str, strlen (body_str), &body_base64);
+  GNUNET_STRINGS_base64url_encode (body_str, strlen (body_str), &body_base64);
   fix_base64 (body_base64);
 
   GNUNET_free (subject);
@@ -316,9 +306,9 @@ OIDC_id_token_new (const struct 
GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
                           signature_target,
                           strlen (signature_target),
                           &signature);
-  GNUNET_STRINGS_base64_encode ((const char *) &signature,
-                                sizeof(struct GNUNET_HashCode),
-                                &signature_base64);
+  GNUNET_STRINGS_base64url_encode ((const char *) &signature,
+                                   sizeof(struct GNUNET_HashCode),
+                                   &signature_base64);
   fix_base64 (signature_base64);
 
   GNUNET_asprintf (&result,
@@ -343,138 +333,6 @@ OIDC_id_token_new (const struct 
GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
 }
 
 
-/* Converts a hex character to its integer value */
-static char
-from_hex (char ch)
-{
-  return isdigit (ch) ? ch - '0' : tolower (ch) - 'a' + 10;
-}
-
-
-/* Converts an integer value to its hex character*/
-static char
-to_hex (char code)
-{
-  static char hex[] = "0123456789abcdef";
-
-  return hex[code & 15];
-}
-
-
-/* Returns a url-encoded version of str */
-/* IMPORTANT: be sure to free() the returned string after use */
-static char *
-url_encode (const char *str)
-{
-  char *pstr = (char *) str;
-  char *buf = GNUNET_malloc (strlen (str) * 3 + 1);
-  char *pbuf = buf;
-
-  while (*pstr)
-  {
-    if (isalnum (*pstr) || (*pstr == '-') || (*pstr == '_') || (*pstr == '.') 
||
-        (*pstr == '~') )
-      *pbuf++ = *pstr;
-    else if (*pstr == ' ')
-      *pbuf++ = '+';
-    else
-    {
-      *pbuf++ = '%';
-      *pbuf++ = to_hex (*pstr >> 4);
-      *pbuf++ = to_hex (*pstr & 15);
-    }
-    pstr++;
-  }
-  *pbuf = '\0';
-  return buf;
-}
-
-
-/* Returns a url-decoded version of str */
-/* IMPORTANT: be sure to free() the returned string after use */
-static char *
-url_decode (const char *str)
-{
-  char *pstr = (char *) str;
-  char *buf = GNUNET_malloc (strlen (str) + 1);
-  char *pbuf = buf;
-
-  while (*pstr)
-  {
-    if (*pstr == '%')
-    {
-      if (pstr[1] && pstr[2])
-      {
-        *pbuf++ = from_hex (pstr[1]) << 4 | from_hex (pstr[2]);
-        pstr += 2;
-      }
-    }
-    else if (*pstr == '+')
-    {
-      *pbuf++ = ' ';
-    }
-    else
-    {
-      *pbuf++ = *pstr;
-    }
-    pstr++;
-  }
-  *pbuf = '\0';
-  return buf;
-}
-
-
-/**
- * Returns base64 encoded string urlencoded
- *
- * @param string the string to encode
- * @return base64 encoded string
- */
-static char *
-base64_and_urlencode (const char *data, size_t data_size)
-{
-  char *enc;
-  char *urlenc;
-
-  GNUNET_STRINGS_base64_encode (data, data_size, &enc);
-  urlenc = url_encode (enc);
-  GNUNET_free (enc);
-  return urlenc;
-}
-
-
-/**
- * Returns base64 encoded string urlencoded
- *
- * @param string the string to encode
- * @return base64 encoded string
- */
-static char *
-base64url_encode (const char *data, size_t data_size)
-{
-  char *enc;
-  size_t pos;
-
-  GNUNET_STRINGS_base64_encode (data, data_size, &enc);
-  // Replace with correct characters for base64url
-  pos = 0;
-  while ('\0' != enc[pos])
-  {
-    if ('+' == enc[pos])
-      enc[pos] = '-';
-    if ('/' == enc[pos])
-      enc[pos] = '_';
-    if ('=' == enc[pos])
-    {
-      enc[pos] = '\0';
-      break;
-    }
-    pos++;
-  }
-  return enc;
-}
-
-
 static void
 derive_aes_key (struct GNUNET_CRYPTO_SymmetricSessionKey *key,
                 struct GNUNET_CRYPTO_SymmetricInitializationVector *iv,
@@ -572,7 +430,8 @@ encrypt_payload (const struct GNUNET_CRYPTO_EcdsaPublicKey 
*ecdsa_pub,
 char *
 OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
                        const struct GNUNET_RECLAIM_Ticket *ticket,
-                       struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
+                       struct GNUNET_RECLAIM_AttributeList *attrs,
+                       struct GNUNET_RECLAIM_AttestationList *attests,
                        const char *nonce_str,
                        const char *code_challenge)
 {
@@ -585,6 +444,7 @@ OIDC_build_authz_code (const struct 
GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
   size_t payload_len;
   size_t code_payload_len;
   size_t attr_list_len = 0;
+  size_t attests_list_len = 0;
   size_t code_challenge_len = 0;
   uint32_t nonce;
   uint32_t nonce_tmp;
@@ -623,7 +483,7 @@ OIDC_build_authz_code (const struct 
GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
   if (NULL != attrs)
   {
     // Get length
-    attr_list_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (attrs);
+    attr_list_len = GNUNET_RECLAIM_attribute_list_serialize_get_size (attrs);
     params.attr_list_len = htonl (attr_list_len);
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Length of serialized attributes: %lu\n",
@@ -631,6 +491,19 @@ OIDC_build_authz_code (const struct 
GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
     // Get serialized attributes
     payload_len += attr_list_len;
   }
+  if (NULL != attests)
+  {
+    // Get length
+    attests_list_len =
+      GNUNET_RECLAIM_attestation_list_serialize_get_size (attests);
+    params.attest_list_len = htonl (attests_list_len);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Length of serialized attestations: %lu\n",
+                attests_list_len);
+    // Get serialized attributes
+    payload_len += attests_list_len;
+  }
+
   // Get plaintext length
   payload = GNUNET_malloc (payload_len);
   memcpy (payload, &params, sizeof(params));
@@ -641,7 +514,10 @@ OIDC_build_authz_code (const struct 
GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
     tmp += code_challenge_len;
   }
   if (0 < attr_list_len)
-    GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs, tmp);
+    GNUNET_RECLAIM_attribute_list_serialize (attrs, tmp);
+  if (0 < attests_list_len)
+    GNUNET_RECLAIM_attestation_list_serialize (attests, tmp);
+
   /** END **/
 
   /** ENCRYPT **/
@@ -685,7 +561,7 @@ OIDC_build_authz_code (const struct 
GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
     GNUNET_free (code_payload);
     return NULL;
   }
-  code_str = base64_and_urlencode (code_payload, code_payload_len);
+  GNUNET_STRINGS_base64url_encode (code_payload, code_payload_len, &code_str);
   GNUNET_free (code_payload);
   return code_str;
 }
@@ -709,7 +585,8 @@ OIDC_parse_authz_code (const struct 
GNUNET_CRYPTO_EcdsaPrivateKey *ecdsa_priv,
                        const char *code,
                        const char *code_verifier,
                        struct GNUNET_RECLAIM_Ticket *ticket,
-                       struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList **attrs,
+                       struct GNUNET_RECLAIM_AttributeList **attrs,
+                       struct GNUNET_RECLAIM_AttestationList **attests,
                        char **nonce_str)
 {
   char *code_payload;
@@ -733,7 +610,8 @@ OIDC_parse_authz_code (const struct 
GNUNET_CRYPTO_EcdsaPrivateKey *ecdsa_priv,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying to decode `%s'\n", code);
   code_payload = NULL;
   code_payload_len =
-    GNUNET_STRINGS_base64_decode (code, strlen (code), (void **) 
&code_payload);
+    GNUNET_STRINGS_base64url_decode (code, strlen (code),
+                                     (void **) &code_payload);
   if (code_payload_len < sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
       + sizeof(struct GNUNET_CRYPTO_EcdhePublicKey)
       + sizeof(struct OIDC_Parameters)
@@ -780,7 +658,7 @@ OIDC_parse_authz_code (const struct 
GNUNET_CRYPTO_EcdsaPrivateKey *ecdsa_priv,
                          code_verifier,
                          strlen (code_verifier));
     // encode code verifier
-    expected_code_challenge = base64url_encode (code_verifier_hash, 256 / 8);
+    GNUNET_STRINGS_base64url_encode (code_verifier_hash, 256 / 8, 
&expected_code_challenge);
     code_challenge = (char *) &params[1];
     GNUNET_free (code_verifier_hash);
     if ((strlen (expected_code_challenge) != code_challenge_len) ||
@@ -827,7 +705,7 @@ OIDC_parse_authz_code (const struct 
GNUNET_CRYPTO_EcdsaPrivateKey *ecdsa_priv,
   // Attributes
   attrs_ser = ((char *) &params[1]) + code_challenge_len;
   attrs_ser_len = ntohl (params->attr_list_len);
-  *attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (attrs_ser, 
attrs_ser_len);
+  *attrs = GNUNET_RECLAIM_attribute_list_deserialize (attrs_ser, 
attrs_ser_len);
 
   *nonce_str = NULL;
   if (nonce != 0)
diff --git a/src/reclaim/oidc_helper.h b/src/reclaim/oidc_helper.h
index a7072755b..2c533357e 100644
--- a/src/reclaim/oidc_helper.h
+++ b/src/reclaim/oidc_helper.h
@@ -51,7 +51,8 @@
 char*
 OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
                    const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key,
-                   struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
+                   struct GNUNET_RECLAIM_AttributeList *attrs,
+                   struct GNUNET_RECLAIM_AttestationList *attests,
                    const struct GNUNET_TIME_Relative *expiration_time,
                    const char *nonce,
                    const char *secret_key);
@@ -70,7 +71,8 @@ OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey 
*aud_key,
 char*
 OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
                        const struct GNUNET_RECLAIM_Ticket *ticket,
-                       struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
+                       struct GNUNET_RECLAIM_AttributeList *attrs,
+                       struct GNUNET_RECLAIM_AttestationList *attests,
                        const char *nonce,
                        const char *code_challenge);
 
@@ -92,7 +94,8 @@ OIDC_parse_authz_code (const struct 
GNUNET_CRYPTO_EcdsaPrivateKey *ecdsa_priv,
                        const char *code,
                        const char *code_verifier,
                        struct GNUNET_RECLAIM_Ticket *ticket,
-                       struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList **attrs,
+                       struct GNUNET_RECLAIM_AttributeList **attrs,
+                       struct GNUNET_RECLAIM_AttestationList **attests,
                        char **nonce);
 
 /**
diff --git a/src/reclaim/plugin_gnsrecord_reclaim.c 
b/src/reclaim/plugin_gnsrecord_reclaim.c
index f7145a272..b91e123a3 100644
--- a/src/reclaim/plugin_gnsrecord_reclaim.c
+++ b/src/reclaim/plugin_gnsrecord_reclaim.c
@@ -44,18 +44,15 @@ value_to_string (void *cls, uint32_t type, const void 
*data, size_t data_size)
 {
   switch (type)
   {
-  case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR:
-    return GNUNET_STRINGS_data_to_string_alloc (data, data_size);
-
   case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT:
   case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT:
     return GNUNET_strndup (data, data_size);
-
-  case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF:
+  case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE:
+  case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF:
   case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET:
   case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER:
-  case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR:
-  case GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE:
+  case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION:
+  case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF:
     return GNUNET_STRINGS_data_to_string_alloc (data, data_size);
 
   default:
@@ -83,20 +80,17 @@ string_to_value (void *cls, uint32_t type, const char *s, 
void **data,
     return GNUNET_SYSERR;
   switch (type)
   {
-  case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR:
-    return GNUNET_STRINGS_string_to_data (s, strlen (s), *data, *data_size);
-
   case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT:
   case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT:
     *data = GNUNET_strdup (s);
     *data_size = strlen (s);
     return GNUNET_OK;
-
-  case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF:
+  case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE:
+  case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF:
   case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER:
   case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET:
-  case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR:
-  case GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE:
+  case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION:
+  case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF:
     return GNUNET_STRINGS_string_to_data (s, strlen (s), *data, *data_size);
 
   default:
@@ -114,14 +108,14 @@ static struct
   const char *name;
   uint32_t number;
 } name_map[] = {
-  { "RECLAIM_ATTR", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR },
-  { "RECLAIM_ATTR_REF", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF },
-  { "RECLAIM_ATTEST", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR },
+  { "RECLAIM_ATTRIBUTE", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE },
+  { "RECLAIM_ATTRIBUTE_REF", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF },
+  { "RECLAIM_ATTESTATION", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION },
+  { "RECLAIM_ATTESTATION_REF", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF },
   { "RECLAIM_MASTER", GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER },
   { "RECLAIM_OIDC_CLIENT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT },
   { "RECLAIM_OIDC_REDIRECT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT },
   { "RECLAIM_TICKET", GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET },
-  { "RECLAIM_REFERENCE", GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE },
   { NULL, UINT32_MAX }
 };
 
diff --git a/src/reclaim/plugin_reclaim_attestation_jwt.c 
b/src/reclaim/plugin_reclaim_attestation_jwt.c
new file mode 100644
index 000000000..ec31584d5
--- /dev/null
+++ b/src/reclaim/plugin_reclaim_attestation_jwt.c
@@ -0,0 +1,321 @@
+/*
+     This file is part of GNUnet
+     Copyright (C) 2013, 2014, 2016 GNUnet e.V.
+
+     GNUnet is free software: you can redistribute it and/or modify it
+     under the terms of the GNU Affero General Public License as published
+     by the Free Software Foundation, either version 3 of the License,
+     or (at your option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     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 reclaim-attribute/plugin_reclaim_attestation_gnuid.c
+ * @brief reclaim-attribute-plugin-gnuid attribute plugin to provide the API 
for
+ *                                       fundamental
+ *                                       attribute types.
+ *
+ * @author Martin Schanzenbach
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_reclaim_plugin.h"
+#include <inttypes.h>
+#include <jansson.h>
+
+/**
+   * Convert the 'value' of an attestation to a string.
+   *
+   * @param cls closure, unused
+   * @param type type of the attestation
+   * @param data value in binary encoding
+   * @param data_size number of bytes in @a data
+   * @return NULL on error, otherwise human-readable representation of the 
value
+   */
+static char *
+jwt_value_to_string (void *cls,
+                     uint32_t type,
+                     const void *data,
+                     size_t data_size)
+{
+  switch (type)
+  {
+  case GNUNET_RECLAIM_ATTESTATION_TYPE_JWT:
+    return GNUNET_strndup (data, data_size);
+
+  default:
+    return NULL;
+  }
+}
+
+
+/**
+ * Convert human-readable version of a 'value' of an attestation to the binary
+ * representation.
+ *
+ * @param cls closure, unused
+ * @param type type of the attestation
+ * @param s human-readable string
+ * @param data set to value in binary encoding (will be allocated)
+ * @param data_size set to number of bytes in @a data
+ * @return #GNUNET_OK on success
+ */
+static int
+jwt_string_to_value (void *cls,
+                     uint32_t type,
+                     const char *s,
+                     void **data,
+                     size_t *data_size)
+{
+  if (NULL == s)
+    return GNUNET_SYSERR;
+  switch (type)
+  {
+  case GNUNET_RECLAIM_ATTESTATION_TYPE_JWT:
+    *data = GNUNET_strdup (s);
+    *data_size = strlen (s);
+    return GNUNET_OK;
+
+  default:
+    return GNUNET_SYSERR;
+  }
+}
+
+
+/**
+ * Mapping of attestation type numbers to human-readable
+ * attestation type names.
+ */
+static struct
+{
+  const char *name;
+  uint32_t number;
+} jwt_attest_name_map[] = { { "JWT", GNUNET_RECLAIM_ATTESTATION_TYPE_JWT },
+                            { NULL, UINT32_MAX } };
+
+/**
+   * Convert a type name to the corresponding number.
+   *
+   * @param cls closure, unused
+   * @param jwt_typename name to convert
+   * @return corresponding number, UINT32_MAX on error
+   */
+static uint32_t
+jwt_typename_to_number (void *cls, const char *jwt_typename)
+{
+  unsigned int i;
+
+  i = 0;
+  while ((NULL != jwt_attest_name_map[i].name) &&
+         (0 != strcasecmp (jwt_typename, jwt_attest_name_map[i].name)))
+    i++;
+  return jwt_attest_name_map[i].number;
+}
+
+
+/**
+ * Convert a type number (i.e. 1) to the corresponding type string
+ *
+ * @param cls closure, unused
+ * @param type number of a type to convert
+ * @return corresponding typestring, NULL on error
+ */
+static const char *
+jwt_number_to_typename (void *cls, uint32_t type)
+{
+  unsigned int i;
+
+  i = 0;
+  while ((NULL != jwt_attest_name_map[i].name) && (type !=
+                                                   jwt_attest_name_map[i].
+                                                   number))
+    i++;
+  return jwt_attest_name_map[i].name;
+}
+
+
+/**
+ * Parse a JWT and return the respective claim value as Attribute
+ *
+ * @param cls the plugin
+ * @param attest the jwt attestation
+ * @return a GNUNET_RECLAIM_Attribute, containing the new value
+ */
+struct GNUNET_RECLAIM_AttributeList *
+jwt_parse_attributes (void *cls,
+                      const struct GNUNET_RECLAIM_Attestation *attest)
+{
+  char *jwt_string;
+  struct GNUNET_RECLAIM_AttributeList *attrs;
+  char delim[] = ".";
+  char *val_str = NULL;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Parsing JWT attributes.\n");
+  char *decoded_jwt;
+  json_t *json_val;
+  json_error_t *json_err = NULL;
+
+  GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "%s\n", attest->data);
+  if (GNUNET_RECLAIM_ATTESTATION_TYPE_JWT != attest->type)
+    return NULL;
+  attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
+
+  jwt_string = GNUNET_strdup (attest->data);
+  const char *jwt_body = strtok (jwt_string, delim);
+  jwt_body = strtok (NULL, delim);
+  GNUNET_STRINGS_base64url_decode (jwt_body, strlen (jwt_body),
+                                   (void **) &decoded_jwt);
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", decoded_jwt);
+  GNUNET_assert (NULL != decoded_jwt);
+  json_val = json_loads (decoded_jwt, JSON_DECODE_ANY, json_err);
+  const char *key;
+  json_t *value;
+  json_object_foreach (json_val, key, value) {
+    if (0 == strcmp ("iss", key))
+      continue;
+    if (0 == strcmp ("exp", key))
+      continue;
+    if (0 == strcmp ("iat", key))
+      continue;
+    if (0 == strcmp ("nbf", key))
+      continue;
+    if (0 == strcmp ("aud", key))
+      continue;
+    val_str = json_dumps (value, JSON_ENCODE_ANY);
+    GNUNET_RECLAIM_attribute_list_add (attrs,
+                                       key,
+                                       NULL,
+                                       GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING,// 
FIXME
+                                       val_str,
+                                       strlen (val_str));
+    GNUNET_free (val_str);
+  }
+  GNUNET_free (jwt_string);
+  return attrs;
+}
+
+
+/**
+ * Parse a JWT and return the issuer
+ *
+ * @param cls the plugin
+ * @param attest the jwt attestation
+ * @return a string, containing the isser
+ */
+char *
+jwt_get_issuer (void *cls,
+                const struct GNUNET_RECLAIM_Attestation *attest)
+{
+  const char *jwt_body;
+  char *jwt_string;
+  char delim[] = ".";
+  char *issuer = NULL;
+  char *decoded_jwt;
+  json_t *issuer_json;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Parsing JWT attributes.\n");
+  json_t *json_val;
+  json_error_t *json_err = NULL;
+
+  if (GNUNET_RECLAIM_ATTESTATION_TYPE_JWT != attest->type)
+    return NULL;
+  jwt_string = GNUNET_strdup (attest->data);
+  jwt_body = strtok (jwt_string, delim);
+  jwt_body = strtok (NULL, delim);
+  GNUNET_STRINGS_base64url_decode (jwt_body, strlen (jwt_body),
+                                   (void **) &decoded_jwt);
+  json_val = json_loads (decoded_jwt, JSON_DECODE_ANY, json_err);
+  issuer_json = json_object_get (json_val, "iss");
+  if ((NULL == issuer_json) || (! json_is_string (issuer_json)))
+    return NULL;
+  issuer = GNUNET_strdup (json_string_value (issuer_json));
+  GNUNET_free (jwt_string);
+  return issuer;
+}
+
+
+/**
+ * Parse a JWT and return the expiration
+ *
+ * @param cls the plugin
+ * @param attest the jwt attestation
+ * @return a string, containing the isser
+ */
+int
+jwt_get_expiration (void *cls,
+                    const struct GNUNET_RECLAIM_Attestation *attest,
+                    struct GNUNET_TIME_Absolute *exp)
+{
+  const char *jwt_body;
+  char *jwt_string;
+  char delim[] = ".";
+  char *decoded_jwt;
+  json_t *exp_json;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Parsing JWT attributes.\n");
+  json_t *json_val;
+  json_error_t *json_err = NULL;
+
+  if (GNUNET_RECLAIM_ATTESTATION_TYPE_JWT != attest->type)
+    return GNUNET_NO;
+  jwt_string = GNUNET_strdup (attest->data);
+  jwt_body = strtok (jwt_string, delim);
+  jwt_body = strtok (NULL, delim);
+  GNUNET_STRINGS_base64url_decode (jwt_body, strlen (jwt_body),
+                                   (void **) &decoded_jwt);
+  json_val = json_loads (decoded_jwt, JSON_DECODE_ANY, json_err);
+  exp_json = json_object_get (json_val, "exp");
+  if ((NULL == exp_json) || (! json_is_integer (exp_json)))
+    return GNUNET_SYSERR;
+  exp->abs_value_us = json_integer_value (exp_json) * 1000 * 1000;
+  GNUNET_free (jwt_string);
+  return GNUNET_OK;
+}
+
+
+/**
+ * Entry point for the plugin.
+ *
+ * @param cls NULL
+ * @return the exported block API
+ */
+void *
+libgnunet_plugin_reclaim_attestation_jwt_init (void *cls)
+{
+  struct GNUNET_RECLAIM_AttestationPluginFunctions *api;
+
+  api = GNUNET_new (struct GNUNET_RECLAIM_AttestationPluginFunctions);
+  api->value_to_string = &jwt_value_to_string;
+  api->string_to_value = &jwt_string_to_value;
+  api->typename_to_number = &jwt_typename_to_number;
+  api->number_to_typename = &jwt_number_to_typename;
+  api->get_attributes = &jwt_parse_attributes;
+  api->get_issuer = &jwt_get_issuer;
+  api->get_expiration = &jwt_get_expiration;
+  return api;
+}
+
+
+/**
+ * Exit point from the plugin.
+ *
+ * @param cls the return value from #libgnunet_plugin_block_test_init()
+ * @return NULL
+ */
+void *
+libgnunet_plugin_reclaim_attestation_jwt_done (void *cls)
+{
+  struct GNUNET_RECLAIM_AttestationPluginFunctions *api = cls;
+
+  GNUNET_free (api);
+  return NULL;
+}
+
+
+/* end of plugin_reclaim_attestation_type_gnuid.c */
diff --git a/src/reclaim/plugin_reclaim_attribute_basic.c 
b/src/reclaim/plugin_reclaim_attribute_basic.c
new file mode 100644
index 000000000..47fdd5f11
--- /dev/null
+++ b/src/reclaim/plugin_reclaim_attribute_basic.c
@@ -0,0 +1,180 @@
+/*
+     This file is part of GNUnet
+     Copyright (C) 2013, 2014, 2016 GNUnet e.V.
+
+     GNUnet is free software: you can redistribute it and/or modify it
+     under the terms of the GNU Affero General Public License as published
+     by the Free Software Foundation, either version 3 of the License,
+     or (at your option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     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 reclaim-attribute/plugin_reclaim_attribute_gnuid.c
+ * @brief reclaim-attribute-plugin-gnuid attribute plugin to provide the API 
for
+ *                                       fundamental
+ *                                       attribute types.
+ *
+ * @author Martin Schanzenbach
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_reclaim_plugin.h"
+#include <inttypes.h>
+
+
+/**
+ * Convert the 'value' of an attribute to a string.
+ *
+ * @param cls closure, unused
+ * @param type type of the attribute
+ * @param data value in binary encoding
+ * @param data_size number of bytes in @a data
+ * @return NULL on error, otherwise human-readable representation of the value
+ */
+static char *
+basic_value_to_string (void *cls,
+                       uint32_t type,
+                       const void *data,
+                       size_t data_size)
+{
+  switch (type)
+  {
+  case GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING:
+    return GNUNET_strndup (data, data_size);
+
+  default:
+    return NULL;
+  }
+}
+
+
+/**
+ * Convert human-readable version of a 'value' of an attribute to the binary
+ * representation.
+ *
+ * @param cls closure, unused
+ * @param type type of the attribute
+ * @param s human-readable string
+ * @param data set to value in binary encoding (will be allocated)
+ * @param data_size set to number of bytes in @a data
+ * @return #GNUNET_OK on success
+ */
+static int
+basic_string_to_value (void *cls,
+                       uint32_t type,
+                       const char *s,
+                       void **data,
+                       size_t *data_size)
+{
+  if (NULL == s)
+    return GNUNET_SYSERR;
+  switch (type)
+  {
+  case GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING:
+    *data = GNUNET_strdup (s);
+    *data_size = strlen (s);
+    return GNUNET_OK;
+
+  default:
+    return GNUNET_SYSERR;
+  }
+}
+
+/**
+ * Mapping of attribute type numbers to human-readable
+ * attribute type names.
+ */
+static struct
+{
+  const char *name;
+  uint32_t number;
+} basic_name_map[] = { { "STRING", GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING },
+                       { NULL, UINT32_MAX } };
+
+
+/**
+ * Convert a type name to the corresponding number.
+ *
+ * @param cls closure, unused
+ * @param basic_typename name to convert
+ * @return corresponding number, UINT32_MAX on error
+ */
+static uint32_t
+basic_typename_to_number (void *cls, const char *basic_typename)
+{
+  unsigned int i;
+
+  i = 0;
+  while ((NULL != basic_name_map[i].name) &&
+         (0 != strcasecmp (basic_typename, basic_name_map[i].name)))
+    i++;
+  return basic_name_map[i].number;
+}
+
+
+/**
+ * Convert a type number (i.e. 1) to the corresponding type string
+ *
+ * @param cls closure, unused
+ * @param type number of a type to convert
+ * @return corresponding typestring, NULL on error
+ */
+static const char *
+basic_number_to_typename (void *cls, uint32_t type)
+{
+  unsigned int i;
+
+  i = 0;
+  while ((NULL != basic_name_map[i].name) && (type != 
basic_name_map[i].number))
+    i++;
+  return basic_name_map[i].name;
+}
+
+
+/**
+ * Entry point for the plugin.
+ *
+ * @param cls NULL
+ * @return the exported block API
+ */
+void *
+libgnunet_plugin_reclaim_attribute_basic_init (void *cls)
+{
+  struct GNUNET_RECLAIM_AttributePluginFunctions *api;
+
+  api = GNUNET_new (struct GNUNET_RECLAIM_AttributePluginFunctions);
+  api->value_to_string = &basic_value_to_string;
+  api->string_to_value = &basic_string_to_value;
+  api->typename_to_number = &basic_typename_to_number;
+  api->number_to_typename = &basic_number_to_typename;
+  return api;
+}
+
+
+/**
+ * Exit point from the plugin.
+ *
+ * @param cls the return value from #libgnunet_plugin_block_test_init()
+ * @return NULL
+ */
+void *
+libgnunet_plugin_reclaim_attribute_basic_done (void *cls)
+{
+  struct GNUNET_RECLAIM_AttributePluginFunctions *api = cls;
+
+  GNUNET_free (api);
+  return NULL;
+}
+
+
+/* end of plugin_reclaim_attribute_type_gnuid.c */
diff --git a/src/reclaim/plugin_rest_openid_connect.c 
b/src/reclaim/plugin_rest_openid_connect.c
index 741094f21..14a96ed19 100644
--- a/src/reclaim/plugin_rest_openid_connect.c
+++ b/src/reclaim/plugin_rest_openid_connect.c
@@ -32,7 +32,7 @@
 #include "gnunet_gnsrecord_lib.h"
 #include "gnunet_identity_service.h"
 #include "gnunet_namestore_service.h"
-#include "gnunet_reclaim_attribute_lib.h"
+#include "gnunet_reclaim_lib.h"
 #include "gnunet_reclaim_service.h"
 #include "gnunet_rest_lib.h"
 #include "gnunet_rest_plugin.h"
@@ -428,7 +428,13 @@ struct RequestHandle
   /**
    * Attribute claim list
    */
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attr_list;
+  struct GNUNET_RECLAIM_AttributeList *attr_list;
+
+  /**
+   * Attestation list
+   */
+  struct GNUNET_RECLAIM_AttestationList *attests_list;
+
 
   /**
    * IDENTITY Operation
@@ -450,6 +456,12 @@ struct RequestHandle
    */
   struct GNUNET_RECLAIM_AttributeIterator *attr_it;
 
+  /**
+   * Attestation iterator
+   */
+  struct GNUNET_RECLAIM_AttestationIterator *attest_it;
+
+
   /**
    * Ticket iterator
    */
@@ -523,8 +535,6 @@ struct RequestHandle
 static void
 cleanup_handle (struct RequestHandle *handle)
 {
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *claim_entry;
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *claim_tmp;
   struct EgoEntry *ego_entry;
   struct EgoEntry *ego_tmp;
 
@@ -535,6 +545,8 @@ cleanup_handle (struct RequestHandle *handle)
     GNUNET_IDENTITY_disconnect (handle->identity_handle);
   if (NULL != handle->attr_it)
     GNUNET_RECLAIM_get_attributes_stop (handle->attr_it);
+  if (NULL != handle->attest_it)
+    GNUNET_RECLAIM_get_attestations_stop (handle->attest_it);
   if (NULL != handle->ticket_it)
     GNUNET_RECLAIM_ticket_iteration_stop (handle->ticket_it);
   if (NULL != handle->idp)
@@ -564,22 +576,9 @@ cleanup_handle (struct RequestHandle *handle)
     json_decref (handle->oidc->response);
     GNUNET_free (handle->oidc);
   }
-  if (NULL != handle->attr_list)
-  {
-    for (claim_entry = handle->attr_list->list_head; NULL != claim_entry;)
-    {
-      claim_tmp = claim_entry;
-      claim_entry = claim_entry->next;
-      if (NULL != claim_tmp->claim)
-        GNUNET_free (claim_tmp->claim);
-      if (NULL != claim_tmp->attest)
-        GNUNET_free (claim_tmp->attest);
-      if (NULL != claim_tmp->reference)
-        GNUNET_free (claim_tmp->reference);
-      GNUNET_free (claim_tmp);
-    }
-    GNUNET_free (handle->attr_list);
-  }
+  GNUNET_RECLAIM_attribute_list_destroy (handle->attr_list);
+  GNUNET_RECLAIM_attestation_list_destroy (handle->attests_list);
+
   for (ego_entry = handle->ego_head; NULL != ego_entry;)
   {
     ego_tmp = ego_entry;
@@ -934,6 +933,7 @@ oidc_ticket_issue_cb (void *cls, const struct 
GNUNET_RECLAIM_Ticket *ticket)
   code_string = OIDC_build_authz_code (&handle->priv_key,
                                        &handle->ticket,
                                        handle->attr_list,
+                                       handle->attests_list,
                                        handle->oidc->nonce,
                                        handle->oidc->code_challenge);
   if ((NULL != handle->redirect_prefix) && (NULL != handle->redirect_suffix) &&
@@ -968,7 +968,53 @@ oidc_ticket_issue_cb (void *cls, const struct 
GNUNET_RECLAIM_Ticket *ticket)
 
 
 static void
-oidc_collect_finished_cb (void *cls)
+oidc_attest_collect_finished_cb (void *cls)
+{
+  struct RequestHandle *handle = cls;
+
+  handle->attest_it = NULL;
+  handle->idp_op = GNUNET_RECLAIM_ticket_issue (handle->idp,
+                                                &handle->priv_key,
+                                                &handle->oidc->client_pkey,
+                                                handle->attr_list,
+                                                &oidc_ticket_issue_cb,
+                                                handle);
+}
+
+
+/**
+ * Collects all attributes for an ego if in scope parameter
+ */
+static void
+oidc_attest_collect (void *cls,
+                     const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
+                     const struct GNUNET_RECLAIM_Attestation *attest)
+{
+  struct RequestHandle *handle = cls;
+  struct GNUNET_RECLAIM_AttributeListEntry *le;
+
+  for (le = handle->attr_list->list_head; NULL != le; le = le->next)
+  {
+    if (GNUNET_NO == GNUNET_RECLAIM_id_is_equal (&le->attribute->attestation,
+                                                 &attest->id))
+    {
+      struct GNUNET_RECLAIM_AttestationListEntry *ale;
+      ale = GNUNET_new (struct GNUNET_RECLAIM_AttestationListEntry);
+      ale->attestation = GNUNET_RECLAIM_attestation_new (attest->name,
+                                                         attest->type,
+                                                         attest->data,
+                                                         attest->data_size);
+      GNUNET_CONTAINER_DLL_insert (handle->attests_list->list_head,
+                                   handle->attests_list->list_tail,
+                                   ale);
+    }
+  }
+  GNUNET_RECLAIM_get_attestations_next (handle->attest_it);
+}
+
+
+static void
+oidc_attr_collect_finished_cb (void *cls)
 {
   struct RequestHandle *handle = cls;
 
@@ -981,6 +1027,17 @@ oidc_collect_finished_cb (void *cls)
     GNUNET_SCHEDULER_add_now (&do_redirect_error, handle);
     return;
   }
+  handle->attests_list = GNUNET_new (struct GNUNET_RECLAIM_AttestationList);
+  handle->attest_it =
+    GNUNET_RECLAIM_get_attestations_start (handle->idp,
+                                           &handle->priv_key,
+                                           &oidc_iteration_error,
+                                           handle,
+                                           &oidc_attest_collect,
+                                           handle,
+                                           &oidc_attest_collect_finished_cb,
+                                           handle);
+
   handle->idp_op = GNUNET_RECLAIM_ticket_issue (handle->idp,
                                                 &handle->priv_key,
                                                 &handle->oidc->client_pkey,
@@ -991,107 +1048,48 @@ oidc_collect_finished_cb (void *cls)
 
 
 /**
- * Collects all attributes/references for an ego if in scope parameter
+ * Collects all attributes for an ego if in scope parameter
  */
 static void
 oidc_attr_collect (void *cls,
                    const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
-                   const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-                   const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
-                   const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE 
*reference)
+                   const struct GNUNET_RECLAIM_Attribute *attr)
 {
   struct RequestHandle *handle = cls;
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
+  struct GNUNET_RECLAIM_AttributeListEntry *le;
   char *scope_variables;
   char *scope_variable;
   char delimiter[] = " ";
 
-  if ((NULL == attr) && (NULL == reference))
+  scope_variables = GNUNET_strdup (handle->oidc->scope);
+  scope_variable = strtok (scope_variables, delimiter);
+  while (NULL != scope_variable)
   {
-    GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
-    return;
+    if (0 == strcmp (attr->name, scope_variable))
+      break;
+    scope_variable = strtok (NULL, delimiter);
   }
-  if (NULL != reference)
+  if (NULL == scope_variable)
   {
-    if ((NULL == reference->name) || (NULL == reference->reference_value))
-    {
-      return;
-    }
-    scope_variables = GNUNET_strdup (handle->oidc->scope);
-    scope_variable = strtok (scope_variables, delimiter);
-    while (NULL != scope_variable)
-    {
-      if (0 == strcmp (reference->name, scope_variable))
-        break;
-      scope_variable = strtok (NULL, delimiter);
-    }
-    if (NULL == scope_variable)
-    {
-      GNUNET_free (scope_variables);
-      return;
-    }
-    GNUNET_free (scope_variables);
-    struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le2;
-    le2 = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
-    le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
-    le->claim = NULL;
-    le->reference = NULL;
-    le->attest = GNUNET_RECLAIM_ATTESTATION_claim_new (attest->name,
-                                                       attest->type,
-                                                       attest->data,
-                                                       attest->data_size);
-    le->attest->id = attest->id;
-    le2->attest = NULL;
-    le2->claim = NULL;
-    le2->reference = GNUNET_RECLAIM_ATTESTATION_reference_new (reference->name,
-                                                               reference->
-                                                               
reference_value);
-    le2->reference->id = reference->id;
-    le2->reference->id_attest = reference->id_attest;
-    GNUNET_CONTAINER_DLL_insert (handle->attr_list->list_head,
-                                 handle->attr_list->list_tail,
-                                 le);
-    GNUNET_CONTAINER_DLL_insert (handle->attr_list->list_head,
-                                 handle->attr_list->list_tail,
-                                 le2);
-  }
-  else if (NULL != attr)
-  {
-    if ((NULL == attr->name) || (NULL == attr->data))
-    {
-      GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
-      return;
-    }
-    scope_variables = GNUNET_strdup (handle->oidc->scope);
-    scope_variable = strtok (scope_variables, delimiter);
-    while (NULL != scope_variable)
-    {
-      if (0 == strcmp (attr->name, scope_variable))
-        break;
-      scope_variable = strtok (NULL, delimiter);
-    }
-    if (NULL == scope_variable)
-    {
-      GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
-      GNUNET_free (scope_variables);
-      return;
-    }
-    GNUNET_free (scope_variables);
-    le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
-    le->reference = NULL;
-    le->attest = NULL;
-    le->claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr->name,
-                                                    attr->type,
-                                                    attr->data,
-                                                    attr->data_size);
-    le->claim->id = attr->id;
-    le->claim->flag = attr->flag;
-
-    GNUNET_CONTAINER_DLL_insert (handle->attr_list->list_head,
-                                 handle->attr_list->list_tail,
-                                 le);
     GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
+    GNUNET_free (scope_variables);
+    // We can ignore this
+    return;
   }
+  GNUNET_free (scope_variables);
+  le = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry);
+  le->attribute = GNUNET_RECLAIM_attribute_new (attr->name,
+                                                &attr->attestation,
+                                                attr->type,
+                                                attr->data,
+                                                attr->data_size);
+  le->attribute->id = attr->id;
+  le->attribute->flag = attr->flag;
+  le->attribute->attestation = attr->attestation;
+  GNUNET_CONTAINER_DLL_insert (handle->attr_list->list_head,
+                               handle->attr_list->list_tail,
+                               le);
+  GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
 }
 
 
@@ -1149,7 +1147,7 @@ code_redirect (void *cls)
             *GNUNET_IDENTITY_ego_get_private_key (handle->ego_entry->ego);
           handle->idp = GNUNET_RECLAIM_connect (cfg);
           handle->attr_list =
-            GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
+            GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
           handle->attr_it =
             GNUNET_RECLAIM_get_attributes_start (handle->idp,
                                                  &handle->priv_key,
@@ -1157,7 +1155,7 @@ code_redirect (void *cls)
                                                  handle,
                                                  &oidc_attr_collect,
                                                  handle,
-                                                 &oidc_collect_finished_cb,
+                                                 
&oidc_attr_collect_finished_cb,
                                                  handle);
           return;
         }
@@ -1784,7 +1782,8 @@ token_endpoint (struct GNUNET_REST_RequestHandle 
*con_handle,
   struct RequestHandle *handle = cls;
   const struct EgoEntry *ego_entry;
   struct GNUNET_TIME_Relative expiration_time;
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *cl;
+  struct GNUNET_RECLAIM_AttributeList *cl;
+  struct GNUNET_RECLAIM_AttestationList *al;
   struct GNUNET_RECLAIM_Ticket ticket;
   struct GNUNET_CRYPTO_EcdsaPublicKey cid;
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey;
@@ -1872,7 +1871,7 @@ token_endpoint (struct GNUNET_REST_RequestHandle 
*con_handle,
 
   // decode code
   if (GNUNET_OK != OIDC_parse_authz_code (privkey, code, code_verifier, 
&ticket,
-                                          &cl, &nonce))
+                                          &cl, &al, &nonce))
   {
     handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_REQUEST);
     handle->edesc = GNUNET_strdup ("invalid code");
@@ -1912,6 +1911,7 @@ token_endpoint (struct GNUNET_REST_RequestHandle 
*con_handle,
   id_token = OIDC_id_token_new (&ticket.audience,
                                 &ticket.identity,
                                 cl,
+                                al,
                                 &expiration_time,
                                 (NULL != nonce) ? nonce : NULL,
                                 jwt_secret);
@@ -1927,7 +1927,8 @@ token_endpoint (struct GNUNET_REST_RequestHandle 
*con_handle,
   MHD_add_response_header (resp, "Pragma", "no-cache");
   MHD_add_response_header (resp, "Content-Type", "application/json");
   handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
-  GNUNET_RECLAIM_ATTRIBUTE_list_destroy (cl);
+  GNUNET_RECLAIM_attribute_list_destroy (cl);
+  GNUNET_RECLAIM_attestation_list_destroy (al);
   GNUNET_free (access_token);
   GNUNET_free (json_response);
   GNUNET_free (id_token);
@@ -1936,14 +1937,13 @@ token_endpoint (struct GNUNET_REST_RequestHandle 
*con_handle,
 
 
 /**
-     * Collects claims and stores them in handle
-     */
+ * Collects claims and stores them in handle
+ */
 static void
 consume_ticket (void *cls,
                 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
-                const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-                const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
-                const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
+                const struct GNUNET_RECLAIM_Attribute *attr,
+                const struct GNUNET_RECLAIM_Attestation *attest)
 {
   struct RequestHandle *handle = cls;
   if (NULL == identity)
@@ -1951,82 +1951,76 @@ consume_ticket (void *cls,
     GNUNET_SCHEDULER_add_now (&return_userinfo_response, handle);
     return;
   }
-  if (NULL != attr)
+  if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attr->attestation))
   {
     char *tmp_value;
     json_t *value;
-    tmp_value = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type,
+    tmp_value = GNUNET_RECLAIM_attribute_value_to_string (attr->type,
                                                           attr->data,
                                                           attr->data_size);
     value = json_string (tmp_value);
     json_object_set_new (handle->oidc->response, attr->name, value);
     GNUNET_free (tmp_value);
+    return;
   }
-  else if ((NULL != attest) && (NULL != reference))
-  {
-    json_t *claim_sources;
-    json_t *claim_sources_jwt;
-    json_t *claim_names;
-    char *attest_val_str;
-    claim_sources=json_object_get(handle->oidc->response,"_claim_sources");
-    claim_names=json_object_get(handle->oidc->response,"_claim_names");
-    attest_val_str = GNUNET_RECLAIM_ATTESTATION_value_to_string (attest->type,
-                                                                 attest->data,
-                                                                 attest->
-                                                                 data_size);
-    if ((NULL == claim_sources) && (NULL == claim_names) )
-    {
-      claim_sources = json_object ();
-      claim_names = json_object ();
-    }
-    char *source_name;
-    int i = 0;
-    GNUNET_asprintf (&source_name,"src%d",i);
-    while (NULL != (claim_sources_jwt = json_object_get (claim_sources,
-                                                         source_name)))
-    {
-      if (0 == strcmp (json_string_value (json_object_get (claim_sources_jwt,
-                                                           "JWT")),
-                       attest_val_str))
-      {
-        // Adapt only the claim names
-        json_object_set_new (claim_names, reference->name, json_string (
-                               source_name));
-        json_object_set (handle->oidc->response, "_claim_names",claim_names);
-        handle->oidc->response = json_deep_copy(handle->oidc->response);
-        break;
-      }
-      i++;
-      GNUNET_asprintf (&source_name,"src%d",i);
-    }
-
-    // Create new one
-    if (NULL == claim_sources_jwt)
+  json_t *claim_sources;
+  json_t *claim_sources_jwt;
+  json_t *claim_names;
+  char *attest_val_str;
+  claim_sources = json_object_get (handle->oidc->response,"_claim_sources");
+  claim_names = json_object_get (handle->oidc->response,"_claim_names");
+  attest_val_str =
+    GNUNET_RECLAIM_attestation_value_to_string (attest->type,
+                                                attest->data,
+                                                attest->data_size);
+  if ((NULL == claim_sources) && (NULL == claim_names) )
+  {
+    claim_sources = json_object ();
+    claim_names = json_object ();
+  }
+  char *source_name;
+  int i = 0;
+  GNUNET_asprintf (&source_name, "src%d", i);
+  while (NULL != (claim_sources_jwt = json_object_get (claim_sources,
+                                                       source_name)))
+  {
+    if (0 == strcmp (json_string_value (json_object_get (claim_sources_jwt,
+                                                         "JWT")),
+                     attest_val_str))
     {
-      claim_sources_jwt = json_object ();
-      // Set the JWT for names
-      json_object_set_new (claim_names, reference->name, json_string (
-                             source_name));
-      // Set the JWT for the inner source
-      json_object_set_new (claim_sources_jwt, "JWT", json_string (
-                             attest_val_str));
-      // Set the JWT for the source
-      json_object_set_new (claim_sources, source_name,claim_sources_jwt);
-      // Set as claims
-      json_object_set (handle->oidc->response, "_claim_names", claim_names);
-      json_object_set (handle->oidc->response, "_claim_sources",claim_sources);
-      handle->oidc->response = json_deep_copy(handle->oidc->response);
+      // Adapt only the claim names
+      json_object_set_new (claim_names, attr->data,
+                           json_string (source_name));
+      json_object_set (handle->oidc->response,
+                       "_claim_names", claim_names);
+      break;
     }
-
-    json_decref (claim_sources);
-    json_decref (claim_names);
-    json_decref (claim_sources_jwt);
-    GNUNET_free (attest_val_str);
-  }
-  else
-  {
-    // REMARK: We should not find any claim, one of attest/ref is NULL
-  }
+    i++;
+    GNUNET_free (source_name);
+    GNUNET_asprintf (&source_name, "src%d", i);
+  }
+
+  // Create new one
+  if (NULL == claim_sources_jwt)
+  {
+    claim_sources_jwt = json_object ();
+    // Set the JWT for names
+    json_object_set_new (claim_names, attr->data,
+                         json_string (source_name));
+    // Set the JWT for the inner source
+    json_object_set_new (claim_sources_jwt, "JWT",
+                         json_string (attest_val_str));
+    // Set the JWT for the source
+    json_object_set_new (claim_sources, source_name, claim_sources_jwt);
+    // Set as claims
+    json_object_set (handle->oidc->response, "_claim_names", claim_names);
+    json_object_set (handle->oidc->response, "_claim_sources",claim_sources);
+  }
+
+  json_decref (claim_sources);
+  json_decref (claim_names);
+  json_decref (claim_sources_jwt);
+  GNUNET_free (attest_val_str);
 }
 
 
diff --git a/src/reclaim/plugin_rest_reclaim.c 
b/src/reclaim/plugin_rest_reclaim.c
index dcda75b65..780a184d2 100644
--- a/src/reclaim/plugin_rest_reclaim.c
+++ b/src/reclaim/plugin_rest_reclaim.c
@@ -31,7 +31,7 @@
 #include "gnunet_gns_service.h"
 #include "gnunet_gnsrecord_lib.h"
 #include "gnunet_identity_service.h"
-#include "gnunet_reclaim_attribute_lib.h"
+#include "gnunet_reclaim_lib.h"
 #include "gnunet_reclaim_service.h"
 #include "gnunet_rest_lib.h"
 #include "gnunet_rest_plugin.h"
@@ -48,9 +48,9 @@
 #define GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES "/reclaim/attributes"
 
 /**
-   * Attestation namespace
-   */
-#define GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE "/reclaim/attestation"
+ * Attestation namespace
+ */
+#define GNUNET_REST_API_NS_RECLAIM_ATTESTATION "/reclaim/attestation"
 
 /**
  * Ticket namespace
@@ -167,7 +167,7 @@ struct RequestHandle
   /**
    * Attribute claim list
    */
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attr_list;
+  struct GNUNET_RECLAIM_AttributeList *attr_list;
 
   /**
    * IDENTITY Operation
@@ -189,6 +189,12 @@ struct RequestHandle
    */
   struct GNUNET_RECLAIM_AttributeIterator *attr_it;
 
+  /**
+   * Attribute iterator
+   */
+  struct GNUNET_RECLAIM_AttestationIterator *attest_it;
+
+
   /**
    * Ticket iterator
    */
@@ -247,8 +253,6 @@ struct RequestHandle
 static void
 cleanup_handle (struct RequestHandle *handle)
 {
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *claim_entry;
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *claim_tmp;
   struct EgoEntry *ego_entry;
   struct EgoEntry *ego_tmp;
 
@@ -261,6 +265,8 @@ cleanup_handle (struct RequestHandle *handle)
     GNUNET_IDENTITY_disconnect (handle->identity_handle);
   if (NULL != handle->attr_it)
     GNUNET_RECLAIM_get_attributes_stop (handle->attr_it);
+  if (NULL != handle->attest_it)
+    GNUNET_RECLAIM_get_attestations_stop (handle->attest_it);
   if (NULL != handle->ticket_it)
     GNUNET_RECLAIM_ticket_iteration_stop (handle->ticket_it);
   if (NULL != handle->idp)
@@ -270,18 +276,7 @@ cleanup_handle (struct RequestHandle *handle)
   if (NULL != handle->emsg)
     GNUNET_free (handle->emsg);
   if (NULL != handle->attr_list)
-  {
-    for (claim_entry = handle->attr_list->list_head; NULL != claim_entry;)
-    {
-      claim_tmp = claim_entry;
-      claim_entry = claim_entry->next;
-      GNUNET_free (claim_tmp->claim);
-      GNUNET_free (claim_tmp->attest);
-      GNUNET_free (claim_tmp->reference);
-      GNUNET_free (claim_tmp);
-    }
-    GNUNET_free (handle->attr_list);
-  }
+    GNUNET_RECLAIM_attribute_list_destroy (handle->attr_list);
   for (ego_entry = handle->ego_head; NULL != ego_entry;)
   {
     ego_tmp = ego_entry;
@@ -366,6 +361,7 @@ finished_cont (void *cls, int32_t success, const char *emsg)
   GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle);
 }
 
+
 static void
 delete_finished_cb (void *cls, int32_t success, const char *emsg)
 {
@@ -382,6 +378,7 @@ delete_finished_cb (void *cls, int32_t success, const char 
*emsg)
   GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle);
 }
 
+
 /**
  * Return attributes for identity
  *
@@ -410,6 +407,7 @@ collect_finished_cb (void *cls)
 
   // Done
   handle->attr_it = NULL;
+  handle->attest_it = NULL;
   handle->ticket_it = NULL;
   GNUNET_SCHEDULER_add_now (&return_response, handle);
 }
@@ -428,7 +426,7 @@ ticket_collect (void *cls, const struct 
GNUNET_RECLAIM_Ticket *ticket)
   char *tmp;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding ticket\n");
-  tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(uint64_t));
+  tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, 
sizeof(ticket->rnd));
   json_resource = json_object ();
   GNUNET_free (tmp);
   json_array_append (handle->resp_object, json_resource);
@@ -447,7 +445,7 @@ ticket_collect (void *cls, const struct 
GNUNET_RECLAIM_Ticket *ticket)
   value = json_string (tmp);
   json_object_set_new (json_resource, "audience", value);
   GNUNET_free (tmp);
-  tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(uint64_t));
+  tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, 
sizeof(ticket->rnd));
   value = json_string (tmp);
   json_object_set_new (json_resource, "rnd", value);
   GNUNET_free (tmp);
@@ -455,85 +453,6 @@ ticket_collect (void *cls, const struct 
GNUNET_RECLAIM_Ticket *ticket)
 }
 
 
-static void
-add_attestation_ref_cont (struct GNUNET_REST_RequestHandle *con_handle,
-                          const char *url,
-                          void *cls)
-{
-  struct RequestHandle *handle = cls;
-  const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity_priv;
-  const char *identity;
-  struct EgoEntry *ego_entry;
-  struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attribute;
-  struct GNUNET_TIME_Relative exp;
-  char term_data[handle->rest_handle->data_size + 1];
-  json_t *data_json;
-  json_error_t err;
-  struct GNUNET_JSON_Specification attrspec[] =
-  { GNUNET_RECLAIM_JSON_spec_claim_attest_ref (&attribute),
-    GNUNET_JSON_spec_end () };
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Adding an attestation reference for %s.\n",
-              handle->url);
-  if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + strlen (
-        "reference/") + 1 >= strlen (
-        handle->url))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n");
-    GNUNET_SCHEDULER_add_now (&do_error, handle);
-    return;
-  }
-  identity = handle->url + strlen (
-    GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + strlen ("reference/")
-             + 1;
-  for (ego_entry = handle->ego_head; NULL != ego_entry;
-       ego_entry = ego_entry->next)
-    if (0 == strcmp (identity, ego_entry->identifier))
-      break;
-  if (NULL == ego_entry)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Identity unknown (%s)\n", identity);
-    return;
-  }
-  identity_priv = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
-  if (0 >= handle->rest_handle->data_size)
-  {
-    GNUNET_SCHEDULER_add_now (&do_error, handle);
-    return;
-  }
-
-  term_data[handle->rest_handle->data_size] = '\0';
-  GNUNET_memcpy (term_data,
-                 handle->rest_handle->data,
-                 handle->rest_handle->data_size);
-  data_json = json_loads (term_data, JSON_DECODE_ANY, &err);
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_JSON_parse (data_json, attrspec, NULL, NULL));
-  json_decref (data_json);
-  if (NULL == attribute)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unable to parse attestation reference from %s\n",
-                term_data);
-    GNUNET_SCHEDULER_add_now (&do_error, handle);
-    return;
-  }
-  /**
-   * New ID for attribute
-   */
-  if (0 == attribute->id)
-    attribute->id = attribute->id_attest;
-  handle->idp = GNUNET_RECLAIM_connect (cfg);
-  exp = GNUNET_TIME_UNIT_HOURS;
-  handle->idp_op = GNUNET_RECLAIM_attestation_reference_store (handle->idp,
-                                                               identity_priv,
-                                                               attribute,
-                                                               &exp,
-                                                               &finished_cont,
-                                                               handle);
-  GNUNET_JSON_parse_free (attrspec);
-}
-
 static void
 parse_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
                         const char *url,
@@ -576,16 +495,16 @@ parse_attestation_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
   }
   if (0 == strcmp (type_str, "JWT"))
   {
-  // The value is a JWT
-  char *decoded_jwt;
-  char delim[] = ".";
-  char *jwt_body = strtok (val_str, delim);
-  jwt_body = strtok (NULL, delim);
-  GNUNET_STRINGS_base64_decode (jwt_body, strlen (jwt_body),
-                                (void **) &decoded_jwt);
-  resp = GNUNET_REST_create_response (decoded_jwt);
-  handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
-  GNUNET_free (decoded_jwt);
+    // The value is a JWT
+    char *decoded_jwt;
+    char delim[] = ".";
+    char *jwt_body = strtok (val_str, delim);
+    jwt_body = strtok (NULL, delim);
+    GNUNET_STRINGS_base64_decode (jwt_body, strlen (jwt_body),
+                                  (void **) &decoded_jwt);
+    resp = GNUNET_REST_create_response (decoded_jwt);
+    handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
+    GNUNET_free (decoded_jwt);
   }
   else
   {
@@ -598,42 +517,31 @@ parse_attestation_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
   json_decref (data_json);
 }
 
+
 static void
 add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
                       const char *url,
                       void *cls)
 {
   struct RequestHandle *handle = cls;
-  /* Check for substring "reference" */
-  if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) < strlen (
+  /* Check for substring "parse"
+   * FIXME UGLY! */
+  if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION) < strlen (
         handle->url))
   {
-    if ( strncmp ("reference/", (handle->url + strlen (
-                                   
GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE)
-                                 + 1), strlen (
-                    "reference/")) == 0)
+    if (strncmp ("parse", (handle->url + strlen (
+                             GNUNET_REST_API_NS_RECLAIM_ATTESTATION)
+                           + 1), strlen (
+                   "parse")) == 0)
     {
-      add_attestation_ref_cont (con_handle,url,cls);
+      parse_attestation_cont (con_handle,url,cls);
       return;
     }
   }
-  /* Check for substring "parse" */
-  if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) < strlen (
-      handle->url))
-      {
-        if ( strncmp ("parse", (handle->url + strlen (
-                          GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE)
-                        + 1), strlen (
-            "parse")) == 0)
-        {
-          parse_attestation_cont (con_handle,url,cls);
-          return;
-        }
-      }
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity_priv;
   const char *identity;
   struct EgoEntry *ego_entry;
-  struct GNUNET_RECLAIM_ATTESTATION_Claim *attribute;
+  struct GNUNET_RECLAIM_Attestation *attribute;
   struct GNUNET_TIME_Relative exp;
   char term_data[handle->rest_handle->data_size + 1];
   json_t *data_json;
@@ -645,7 +553,7 @@ add_attestation_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Adding an attestation for %s.\n",
               handle->url);
-  if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) >= strlen (
+  if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION) >= strlen (
         handle->url))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n");
@@ -653,7 +561,7 @@ add_attestation_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
     return;
   }
   identity = handle->url + strlen (
-    GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + 1;
+    GNUNET_REST_API_NS_RECLAIM_ATTESTATION) + 1;
 
   for (ego_entry = handle->ego_head; NULL != ego_entry;
        ego_entry = ego_entry->next)
@@ -692,9 +600,8 @@ add_attestation_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
   /**
    * New ID for attribute
    */
-  if (0 == attribute->id)
-    attribute->id =
-      GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
+  if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attribute->id))
+    GNUNET_RECLAIM_id_generate (&attribute->id);
   handle->idp = GNUNET_RECLAIM_connect (cfg);
   exp = GNUNET_TIME_UNIT_HOURS;
   handle->idp_op = GNUNET_RECLAIM_attestation_store (handle->idp,
@@ -706,104 +613,6 @@ add_attestation_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
   GNUNET_JSON_parse_free (attrspec);
 }
 
-/**
- * Collect all references for an ego
- *
- */
-static void
-ref_collect (void *cls,
-             const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
-             const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-             const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
-             const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
-{
-  struct RequestHandle *handle = cls;
-  json_t *attr_obj;
-  char *id_str;
-  char *id_attest_str;
-
-  if (NULL == reference)
-  {
-    GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
-    return;
-  }
-
-  if ((NULL == reference->name) || (NULL == reference->reference_value))
-  {
-    return;
-  }
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding reference: %s\n",
-              reference->name);
-  attr_obj = json_object ();
-  json_object_set_new (attr_obj, "name", json_string (reference->name));
-  json_object_set_new (attr_obj, "ref_value", json_string (
-                         reference->reference_value));
-  id_str = GNUNET_STRINGS_data_to_string_alloc (&reference->id,
-                                                sizeof(uint64_t));
-  id_attest_str = GNUNET_STRINGS_data_to_string_alloc (&reference->id_attest,
-                                                       sizeof(uint64_t));
-  json_object_set_new (attr_obj, "id", json_string (id_str));
-  json_object_set_new (attr_obj, "ref_id", json_string (id_attest_str));
-  json_array_append (handle->resp_object, attr_obj);
-  json_decref (attr_obj);
-}
-
-/**
- * Lists references for identity request
- *
- * @param con_handle the connection handle
- * @param url the url
- * @param cls the RequestHandle
- */
-static void
-list_reference_cont (struct GNUNET_REST_RequestHandle *con_handle,
-                     const char *url,
-                     void *cls)
-{
-  const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key;
-  struct RequestHandle *handle = cls;
-  struct EgoEntry *ego_entry;
-  char *identity;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Getting references for %s.\n",
-              handle->url);
-  if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + strlen (
-        "reference/") + 1 >= strlen (
-        handle->url))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n");
-    GNUNET_SCHEDULER_add_now (&do_error, handle);
-    return;
-  }
-  identity = handle->url + strlen (
-    GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + strlen ("reference/")
-             + 1;
-  for (ego_entry = handle->ego_head; NULL != ego_entry;
-       ego_entry = ego_entry->next)
-    if (0 == strcmp (identity, ego_entry->identifier))
-      break;
-  handle->resp_object = json_array ();
-
-  if (NULL == ego_entry)
-  {
-    // Done
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ego %s not found.\n", identity);
-    GNUNET_SCHEDULER_add_now (&return_response, handle);
-    return;
-  }
-  priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
-  handle->idp = GNUNET_RECLAIM_connect (cfg);
-  handle->attr_it = GNUNET_RECLAIM_get_attributes_start (handle->idp,
-                                                         priv_key,
-                                                         &collect_error_cb,
-                                                         handle,
-                                                         &ref_collect,
-                                                         handle,
-                                                         &collect_finished_cb,
-                                                         handle);
-}
 
 /**
  * Collect all attestations for an ego
@@ -812,56 +621,74 @@ list_reference_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
 static void
 attest_collect (void *cls,
                 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
-                const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-                const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
-                const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
+                const struct GNUNET_RECLAIM_Attestation *attest)
 {
   struct RequestHandle *handle = cls;
+  struct GNUNET_RECLAIM_AttributeList *attrs;
+  struct GNUNET_RECLAIM_AttributeListEntry *ale;
+  struct GNUNET_TIME_Absolute exp;
   json_t *attr_obj;
+  json_t *attest_obj;
   const char *type;
   char *tmp_value;
   char *id_str;
+  char *issuer;
 
 
-  if (NULL != reference)
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attestation: %s\n",
+              attest->name);
+  attrs = GNUNET_RECLAIM_attestation_get_attributes (attest);
+  issuer = GNUNET_RECLAIM_attestation_get_issuer (attest);
+  tmp_value = GNUNET_RECLAIM_attestation_value_to_string (attest->type,
+                                                          attest->data,
+                                                          attest->data_size);
+  attest_obj = json_object ();
+  json_object_set_new (attest_obj, "value", json_string (tmp_value));
+  json_object_set_new (attest_obj, "name", json_string (attest->name));
+  type = GNUNET_RECLAIM_attestation_number_to_typename (attest->type);
+  json_object_set_new (attest_obj, "type", json_string (type));
+  if (NULL != issuer)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Attestation Collection with Reference\n");
-    return;
+    json_object_set_new (attest_obj, "issuer", json_string (issuer));
+    GNUNET_free (issuer);
   }
-  if (NULL == attest)
+  if (GNUNET_OK == GNUNET_RECLAIM_attestation_get_expiration (attest,
+                                                              &exp))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Attestation Collection with empty Attestation\n");
-    GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
-    return;
+    json_object_set_new (attest_obj, "expiration", json_integer 
(exp.abs_value_us));
   }
-
-  if ((NULL == attest->name) || (NULL == attest->data))
+  id_str = GNUNET_STRINGS_data_to_string_alloc (&attest->id,
+                                                sizeof(attest->id));
+  json_object_set_new (attest_obj, "id", json_string (id_str));
+  GNUNET_free (tmp_value);
+  GNUNET_free (id_str);
+  if (NULL != attrs)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Attestation Collection with empty Name/Value\n");
-    GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
-    return;
+    json_t *attr_arr = json_array ();
+    for (ale = attrs->list_head; NULL != ale; ale = ale->next)
+    {
+      tmp_value =
+        GNUNET_RECLAIM_attribute_value_to_string (ale->attribute->type,
+                                                  ale->attribute->data,
+                                                  ale->attribute->data_size);
+      attr_obj = json_object ();
+      json_object_set_new (attr_obj, "value", json_string (tmp_value));
+      json_object_set_new (attr_obj, "name", json_string (
+                             ale->attribute->name));
+
+      json_object_set_new (attr_obj, "flag", json_string ("1")); //FIXME
+      type = GNUNET_RECLAIM_attribute_number_to_typename 
(ale->attribute->type);
+      json_object_set_new (attr_obj, "type", json_string (type));
+      json_object_set_new (attr_obj, "id", json_string (""));
+      json_object_set_new (attr_obj, "attestation", json_string (""));
+      json_array_append_new (attr_arr, attr_obj);
+      GNUNET_free (tmp_value);
+    }
+    json_object_set_new (attest_obj, "attributes", attr_arr);
   }
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attestation: %s\n",
-              attest->name);
-
-  tmp_value = GNUNET_RECLAIM_ATTESTATION_value_to_string (attest->type,
-                                                          attest->data,
-                                                          attest->data_size);
-  attr_obj = json_object ();
-  json_object_set_new (attr_obj, "value", json_string (tmp_value));
-  json_object_set_new (attr_obj, "name", json_string (attest->name));
-  type = GNUNET_RECLAIM_ATTESTATION_number_to_typename (attest->type);
-  json_object_set_new (attr_obj, "type", json_string (type));
-  id_str = GNUNET_STRINGS_data_to_string_alloc (&attest->id, sizeof(uint64_t));
-  json_object_set_new (attr_obj, "id", json_string (id_str));
-  json_array_append (handle->resp_object, attr_obj);
-  json_decref (attr_obj);
-  GNUNET_free (tmp_value);
-  GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
+  json_array_append_new (handle->resp_object, attest_obj);
+  GNUNET_RECLAIM_attribute_list_destroy (attrs);
+  GNUNET_RECLAIM_get_attestations_next (handle->attest_it);
 }
 
 
@@ -878,19 +705,6 @@ list_attestation_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
                        void *cls)
 {
   struct RequestHandle *handle = cls;
-  /* Check for substring "reference" */
-  if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) < strlen (
-        handle->url))
-  {
-    if ( strncmp ("reference/", (handle->url + strlen (
-                                   
GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE)
-                                 + 1), strlen (
-                    "reference/")) == 0)
-    {
-      list_reference_cont (con_handle,url,cls);
-      return;
-    }
-  }
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key;
   struct EgoEntry *ego_entry;
   char *identity;
@@ -898,7 +712,7 @@ list_attestation_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Getting attestations for %s.\n",
               handle->url);
-  if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) >= strlen (
+  if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION) >= strlen (
         handle->url))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n");
@@ -906,7 +720,7 @@ list_attestation_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
     return;
   }
   identity = handle->url + strlen (
-    GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + 1;
+    GNUNET_REST_API_NS_RECLAIM_ATTESTATION) + 1;
 
   for (ego_entry = handle->ego_head; NULL != ego_entry;
        ego_entry = ego_entry->next)
@@ -924,109 +738,15 @@ list_attestation_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
   }
   priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
   handle->idp = GNUNET_RECLAIM_connect (cfg);
-  handle->attr_it = GNUNET_RECLAIM_get_attributes_start (handle->idp,
-                                                         priv_key,
-                                                         &collect_error_cb,
-                                                         handle,
-                                                         &attest_collect,
-                                                         handle,
-                                                         &collect_finished_cb,
-                                                         handle);
-}
-
-/**
- * Deletes reference from an identity
- *
- * @param con_handle the connection handle
- * @param url the url
- * @param cls the RequestHandle
- */
-static void
-delete_attestation_ref_cont (struct GNUNET_REST_RequestHandle *con_handle,
-                             const char *url,
-                             void *cls)
-{
-  struct RequestHandle *handle = cls;
-  const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key;
-  struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr;
-  struct EgoEntry *ego_entry;
-  char *identity;
-  char *identity_id_str;
-  char *id;
-  char term_data[handle->rest_handle->data_size + 1];
-  json_t *data_json;
-  json_error_t err;
-
-  struct GNUNET_JSON_Specification attrspec[] =
-  { GNUNET_RECLAIM_JSON_spec_claim_attest_ref (&attr),
-    GNUNET_JSON_spec_end () };
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Deleting attestation reference.\n");
-  if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + strlen (
-        "reference/") + 1 >= strlen (
-        handle->url))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n");
-    GNUNET_SCHEDULER_add_now (&do_error, handle);
-    return;
-  }
-  identity_id_str = strdup (handle->url + strlen (
-                              GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE)
-                            + strlen ("reference/")
-                            + 1);
-  identity = strtok (identity_id_str, "/");
-  id = strtok (NULL, "/");
-
-  if ((NULL == identity) || (NULL == id))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Malformed request.\n");
-    GNUNET_SCHEDULER_add_now (&do_error, handle);
-    return;
-  }
-  for (ego_entry = handle->ego_head; NULL != ego_entry;
-       ego_entry = ego_entry->next)
-    if (0 == strcmp (identity, ego_entry->identifier))
-      break;
-  handle->resp_object = json_array ();
-  if (NULL == ego_entry)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ego %s not found.\n", identity);
-    GNUNET_SCHEDULER_add_now (&return_response, handle);
-    return;
-  }
-  priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
-  if (0 >= handle->rest_handle->data_size)
-  {
-    GNUNET_SCHEDULER_add_now (&do_error, handle);
-    return;
-  }
-
-  term_data[handle->rest_handle->data_size] = '\0';
-  GNUNET_memcpy (term_data,
-                 handle->rest_handle->data,
-                 handle->rest_handle->data_size);
-  data_json = json_loads (term_data, JSON_DECODE_ANY, &err);
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_JSON_parse (data_json, attrspec, NULL, NULL));
-  json_decref (data_json);
-  if (NULL == attr)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unable to parse attestation reference from %s\n",
-                term_data);
-    GNUNET_SCHEDULER_add_now (&do_error, handle);
-    return;
-  }
-  GNUNET_STRINGS_string_to_data (id, strlen (id), &attr->id, sizeof(uint64_t));
-
-  handle->idp = GNUNET_RECLAIM_connect (cfg);
-  handle->idp_op = GNUNET_RECLAIM_attestation_reference_delete (handle->idp,
-                                                                priv_key,
-                                                                attr,
-                                                                &
-                                                                
delete_finished_cb,
-                                                                handle);
-  GNUNET_JSON_parse_free (attrspec);
+  handle->attest_it = GNUNET_RECLAIM_get_attestations_start (handle->idp,
+                                                             priv_key,
+                                                             &collect_error_cb,
+                                                             handle,
+                                                             &attest_collect,
+                                                             handle,
+                                                             &
+                                                             
collect_finished_cb,
+                                                             handle);
 }
 
 
@@ -1043,28 +763,15 @@ delete_attestation_cont (struct 
GNUNET_REST_RequestHandle *con_handle,
                          void *cls)
 {
   struct RequestHandle *handle = cls;
-  /* Check for substring "reference" */
-  if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) < strlen (
-        handle->url))
-  {
-    if ( strncmp ("reference", (handle->url + strlen (
-                                  
GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE)
-                                + 1), strlen (
-                    "reference")) == 0)
-    {
-      delete_attestation_ref_cont (con_handle,url,cls);
-      return;
-    }
-  }
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key;
-  struct GNUNET_RECLAIM_ATTESTATION_Claim attr;
+  struct GNUNET_RECLAIM_Attestation attr;
   struct EgoEntry *ego_entry;
   char *identity_id_str;
   char *identity;
   char *id;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleting attestation.\n");
-  if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) >= strlen (
+  if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION) >= strlen (
         handle->url))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n");
@@ -1073,7 +780,7 @@ delete_attestation_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
   }
   identity_id_str =
     strdup (handle->url + strlen (
-              GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + 1);
+              GNUNET_REST_API_NS_RECLAIM_ATTESTATION) + 1);
   identity = strtok (identity_id_str, "/");
   id = strtok (NULL, "/");
   if ((NULL == identity) || (NULL == id))
@@ -1099,8 +806,8 @@ delete_attestation_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
   }
   priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
   handle->idp = GNUNET_RECLAIM_connect (cfg);
-  memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_ATTESTATION_Claim));
-  GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(uint64_t));
+  memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_Attestation));
+  GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(attr.id));
   attr.name = "";
   handle->idp_op = GNUNET_RECLAIM_attestation_delete (handle->idp,
                                                       priv_key,
@@ -1110,6 +817,7 @@ delete_attestation_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
   GNUNET_free (identity_id_str);
 }
 
+
 /**
  * List tickets for identity request
  *
@@ -1174,7 +882,7 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
   const char *identity;
   struct RequestHandle *handle = cls;
   struct EgoEntry *ego_entry;
-  struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attribute;
+  struct GNUNET_RECLAIM_Attribute *attribute;
   struct GNUNET_TIME_Relative exp;
   char term_data[handle->rest_handle->data_size + 1];
   json_t *data_json;
@@ -1230,9 +938,8 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
   /**
    * New ID for attribute
    */
-  if (0 == attribute->id)
-    attribute->id =
-      GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
+  if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attribute->id))
+    GNUNET_RECLAIM_id_generate (&attribute->id);
   handle->idp = GNUNET_RECLAIM_connect (cfg);
   exp = GNUNET_TIME_UNIT_HOURS;
   handle->idp_op = GNUNET_RECLAIM_attribute_store (handle->idp,
@@ -1244,20 +951,21 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
   GNUNET_JSON_parse_free (attrspec);
 }
 
+
 /**
  * Parse a JWT and return the respective claim value as Attribute
  *
  * @param attest the jwt attestation
  * @param claim the name of the claim in the JWT
  *
- * @return a GNUNET_RECLAIM_ATTRIBUTE_Claim, containing the new value
+ * @return a GNUNET_RECLAIM_Attribute, containing the new value
  */
-struct GNUNET_RECLAIM_ATTRIBUTE_Claim *
-parse_jwt (const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
+struct GNUNET_RECLAIM_Attribute *
+parse_jwt (const struct GNUNET_RECLAIM_Attestation *attest,
            const char *claim)
 {
   char *jwt_string;
-  struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr;
+  struct GNUNET_RECLAIM_Attribute *attr;
   char delim[] = ".";
   const char *type_str = NULL;
   const char *val_str = NULL;
@@ -1269,7 +977,7 @@ parse_jwt (const struct GNUNET_RECLAIM_ATTESTATION_Claim 
*attest,
   json_t *json_val;
   json_error_t *json_err = NULL;
 
-  jwt_string = GNUNET_RECLAIM_ATTESTATION_value_to_string (attest->type,
+  jwt_string = GNUNET_RECLAIM_attestation_value_to_string (attest->type,
                                                            attest->data,
                                                            attest->data_size);
   char *jwt_body = strtok (jwt_string, delim);
@@ -1286,24 +994,26 @@ parse_jwt (const struct GNUNET_RECLAIM_ATTESTATION_Claim 
*attest,
     }
   }
   type_str = "String";
-  type = GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (type_str);
-  if (GNUNET_SYSERR ==(GNUNET_RECLAIM_ATTRIBUTE_string_to_value (type,val_str,
+  type = GNUNET_RECLAIM_attribute_typename_to_number (type_str);
+  if (GNUNET_SYSERR == GNUNET_RECLAIM_attribute_string_to_value (type,val_str,
                                                                  (void **) 
&data,
-                                                                 &data_size)))
+                                                                 &data_size))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Attribute value from JWT Parser invalid!\n");
-    GNUNET_RECLAIM_ATTRIBUTE_string_to_value (type,
+    GNUNET_RECLAIM_attribute_string_to_value (type,
                                               "Error: Referenced Claim Name 
not Found",
                                               (void **) &data,
                                               &data_size);
-    attr = GNUNET_RECLAIM_ATTRIBUTE_claim_new (claim, type, data, data_size);
+    attr = GNUNET_RECLAIM_attribute_new (claim, &attest->id,
+                                         type, data, data_size);
     attr->id = attest->id;
     attr->flag = 1;
   }
   else
   {
-    attr = GNUNET_RECLAIM_ATTRIBUTE_claim_new (claim, type, data, data_size);
+    attr = GNUNET_RECLAIM_attribute_new (claim, &attest->id,
+                                         type, data, data_size);
     attr->id = attest->id;
     attr->flag = 1;
   }
@@ -1318,93 +1028,37 @@ parse_jwt (const struct 
GNUNET_RECLAIM_ATTESTATION_Claim *attest,
 static void
 attr_collect (void *cls,
               const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
-              const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-              const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
-              const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
+              const struct GNUNET_RECLAIM_Attribute *attr)
 {
   struct RequestHandle *handle = cls;
   json_t *attr_obj;
   const char *type;
   char *id_str;
 
-  if ((NULL == attr) && (NULL == reference))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Attribute Collection with empty Attribute/Reference\n");
-    GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
-    return;
-  }
-
-  if (NULL == attr)
-  {
+  char *tmp_value;
+  tmp_value = GNUNET_RECLAIM_attribute_value_to_string (attr->type,
+                                                        attr->data,
+                                                        attr->data_size);
+  attr_obj = json_object ();
+  json_object_set_new (attr_obj, "value", json_string (tmp_value));
+  json_object_set_new (attr_obj, "name", json_string (attr->name));
 
-    if ((NULL == reference->name) || (NULL == reference->reference_value))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Attribute Collection with empty Reference Name/Value\n");
-      return;
-    }
-    struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr2;
-    attr2 = parse_jwt (attest, reference->reference_value);
-    if (NULL == attr2)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Attribute Collection with unparsed Attestation\n");
-      return;
-    }
-    attr2->name = reference->name;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding reference as attribute: %s\n",
-                reference->name);
-    char *tmp_value;
-    tmp_value = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr2->type,
-                                                          attr2->data,
-                                                          attr2->data_size);
-    attr_obj = json_object ();
-
-    json_object_set_new (attr_obj, "value", json_string (tmp_value));
-    json_object_set_new (attr_obj, "name", json_string (attr2->name));
-    json_object_set_new (attr_obj, "flag", json_string ("1"));
-    type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr2->type);
-    json_object_set_new (attr_obj, "type", json_string (type));
-    id_str = GNUNET_STRINGS_data_to_string_alloc (&attr2->id, 
sizeof(uint64_t));
-    json_object_set_new (attr_obj, "id", json_string (id_str));
-    json_array_append (handle->resp_object, attr_obj);
-    json_decref (attr_obj);
-    GNUNET_free (tmp_value);
-  }
-  else
-  {
-    if ((NULL == attr->name) || (NULL == attr->data))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Attribute Collection with empty Attribute Name/Value\n");
-      GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
-      return;
-    }
-    char *tmp_value;
-    char *flag_str;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute: %s\n", attr->name);
-
-    tmp_value = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type,
-                                                          attr->data,
-                                                          attr->data_size);
-
-    attr_obj = json_object ();
-    json_object_set_new (attr_obj, "value", json_string (tmp_value));
-    json_object_set_new (attr_obj, "name", json_string (attr->name));
-    GNUNET_asprintf (&flag_str,"%d",attr->flag);
-    json_object_set_new (attr_obj, "flag", json_string (flag_str));
-    type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type);
-    json_object_set_new (attr_obj, "type", json_string (type));
-    id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(uint64_t));
-    json_object_set_new (attr_obj, "id", json_string (id_str));
-    json_array_append (handle->resp_object, attr_obj);
-    json_decref (attr_obj);
-    GNUNET_free (tmp_value);
-    GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
-  }
+  json_object_set_new (attr_obj, "flag", json_string ("1"));
+  type = GNUNET_RECLAIM_attribute_number_to_typename (attr->type);
+  json_object_set_new (attr_obj, "type", json_string (type));
+  id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->id,
+                                                sizeof(attr->id));
+  json_object_set_new (attr_obj, "id", json_string (id_str));
+  id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->attestation,
+                                                sizeof(attr->attestation));
+  json_object_set_new (attr_obj, "attestation", json_string (id_str));
+  json_array_append (handle->resp_object, attr_obj);
+  json_decref (attr_obj);
+  GNUNET_free (tmp_value);
+  GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
 }
 
+
 /**
  * List attributes for identity request
  *
@@ -1474,7 +1128,7 @@ delete_attribute_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
 {
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key;
   struct RequestHandle *handle = cls;
-  struct GNUNET_RECLAIM_ATTRIBUTE_Claim attr;
+  struct GNUNET_RECLAIM_Attribute attr;
   struct EgoEntry *ego_entry;
   char *identity_id_str;
   char *identity;
@@ -1514,8 +1168,8 @@ delete_attribute_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
   }
   priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
   handle->idp = GNUNET_RECLAIM_connect (cfg);
-  memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_Claim));
-  GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(uint64_t));
+  memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_Attribute));
+  GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(attr.id));
   attr.name = "";
   handle->idp_op = GNUNET_RECLAIM_attribute_delete (handle->idp,
                                                     priv_key,
@@ -1603,9 +1257,8 @@ revoke_ticket_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
 static void
 consume_cont (void *cls,
               const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
-              const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-              const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
-              const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
+              const struct GNUNET_RECLAIM_Attribute *attr,
+              const struct GNUNET_RECLAIM_Attestation *attest)
 {
   struct RequestHandle *handle = cls;
   char *val_str;
@@ -1618,7 +1271,7 @@ consume_cont (void *cls,
   }
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute: %s\n", attr->name);
-  val_str = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type,
+  val_str = GNUNET_RECLAIM_attribute_value_to_string (attr->type,
                                                       attr->data,
                                                       attr->data_size);
   if (NULL == val_str)
@@ -1749,13 +1402,13 @@ init_cont (struct RequestHandle *handle)
       GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES,
       &delete_attribute_cont },
     { MHD_HTTP_METHOD_GET,
-      GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE,
+      GNUNET_REST_API_NS_RECLAIM_ATTESTATION,
       &list_attestation_cont },
     { MHD_HTTP_METHOD_POST,
-      GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE,
+      GNUNET_REST_API_NS_RECLAIM_ATTESTATION,
       &add_attestation_cont },
     { MHD_HTTP_METHOD_DELETE,
-      GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE,
+      GNUNET_REST_API_NS_RECLAIM_ATTESTATION,
       &delete_attestation_cont },
     { MHD_HTTP_METHOD_GET,
       GNUNET_REST_API_NS_IDENTITY_TICKETS,
diff --git a/src/reclaim/reclaim.h b/src/reclaim/reclaim.h
index ff953a096..7b5d7ab19 100644
--- a/src/reclaim/reclaim.h
+++ b/src/reclaim/reclaim.h
@@ -138,6 +138,11 @@ struct AttributeResultMessage
    */
   uint16_t attr_len GNUNET_PACKED;
 
+  /**
+   * Length of serialized attestation data
+   */
+  uint16_t attestation_len GNUNET_PACKED;
+
   /**
    * always zero (for alignment)
    */
@@ -154,9 +159,9 @@ struct AttributeResultMessage
 };
 
 /**
- * Reference plus Attestation is returned from the idp.
+ * Attestation is returned from the idp.
  */
-struct ReferenceResultMessage
+struct AttestationResultMessage
 {
   /**
    * Message header
@@ -169,14 +174,9 @@ struct ReferenceResultMessage
   uint32_t id GNUNET_PACKED;
 
   /**
-   * Length of serialized attestation data
-   */
-  uint16_t attest_len GNUNET_PACKED;
-
-  /**
-   * Length of serialized reference data
+   * Length of serialized attribute data
    */
-  uint16_t ref_len GNUNET_PACKED;
+  uint16_t attestation_len GNUNET_PACKED;
 
   /**
    * always zero (for alignment)
@@ -189,10 +189,11 @@ struct ReferenceResultMessage
   struct GNUNET_CRYPTO_EcdsaPublicKey identity;
 
   /* followed by:
-   * serialized reference data + attestation data
+   * serialized attestation data
    */
 };
 
+
 /**
  * Start a attribute iteration for the given identity
  */
@@ -232,6 +233,62 @@ struct AttributeIterationNextMessage
 };
 
 
+/**
+ * Start a attestation iteration for the given identity
+ */
+struct AttestationIterationStartMessage
+{
+  /**
+   * Message
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * Unique identifier for this request (for key collisions).
+   */
+  uint32_t id GNUNET_PACKED;
+
+  /**
+   * Identity.
+   */
+  struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
+};
+
+
+/**
+ * Ask for next result of attestation iteration for the given operation
+ */
+struct AttestationIterationNextMessage
+{
+  /**
+   * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * Unique identifier for this request (for key collisions).
+   */
+  uint32_t id GNUNET_PACKED;
+};
+
+
+/**
+ * Stop attestation iteration for the given operation
+ */
+struct AttestationIterationStopMessage
+{
+  /**
+   * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * Unique identifier for this request (for key collisions).
+   */
+  uint32_t id GNUNET_PACKED;
+};
+
+
 /**
  * Stop attribute iteration for the given operation
  */
@@ -462,6 +519,11 @@ struct ConsumeTicketResultMessage
    */
   uint16_t attrs_len GNUNET_PACKED;
 
+  /**
+   * Length of attestation data
+   */
+  uint16_t attestations_len;
+
   /**
    * always zero (for alignment)
    */
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c
index 847abb58a..b863789a2 100644
--- a/src/reclaim/reclaim_api.c
+++ b/src/reclaim/reclaim_api.c
@@ -28,7 +28,7 @@
 #include "gnunet_constants.h"
 #include "gnunet_mq_lib.h"
 #include "gnunet_protocols.h"
-#include "gnunet_reclaim_attribute_lib.h"
+#include "gnunet_reclaim_lib.h"
 #include "gnunet_reclaim_service.h"
 #include "reclaim.h"
 
@@ -71,6 +71,16 @@ struct GNUNET_RECLAIM_Operation
    */
   GNUNET_RECLAIM_AttributeResult ar_cb;
 
+  /**
+   * Attribute result callback
+   */
+  GNUNET_RECLAIM_AttributeTicketResult atr_cb;
+
+  /**
+   * Attestation result callback
+   */
+  GNUNET_RECLAIM_AttestationResult at_cb;
+
   /**
    * Revocation result callback
    */
@@ -228,6 +238,73 @@ struct GNUNET_RECLAIM_AttributeIterator
   uint32_t r_id;
 };
 
+/**
+ * Handle for a attestation iterator operation
+ */
+struct GNUNET_RECLAIM_AttestationIterator
+{
+  /**
+   * Kept in a DLL.
+   */
+  struct GNUNET_RECLAIM_AttestationIterator *next;
+
+  /**
+   * Kept in a DLL.
+   */
+  struct GNUNET_RECLAIM_AttestationIterator *prev;
+
+  /**
+   * Main handle to access the service.
+   */
+  struct GNUNET_RECLAIM_Handle *h;
+
+  /**
+   * Function to call on completion.
+   */
+  GNUNET_SCHEDULER_TaskCallback finish_cb;
+
+  /**
+   * Closure for @e finish_cb.
+   */
+  void *finish_cb_cls;
+
+  /**
+   * The continuation to call with the results
+   */
+  GNUNET_RECLAIM_AttestationResult proc;
+
+  /**
+   * Closure for @e proc.
+   */
+  void *proc_cls;
+
+  /**
+   * Function to call on errors.
+   */
+  GNUNET_SCHEDULER_TaskCallback error_cb;
+
+  /**
+   * Closure for @e error_cb.
+   */
+  void *error_cb_cls;
+
+  /**
+   * Envelope of the message to send to the service, if not yet
+   * sent.
+   */
+  struct GNUNET_MQ_Envelope *env;
+
+  /**
+   * Private key of the zone.
+   */
+  struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
+
+  /**
+   * The operation id this zone iteration operation has
+   */
+  uint32_t r_id;
+};
+
 
 /**
  * Handle to the service.
@@ -269,6 +346,16 @@ struct GNUNET_RECLAIM_Handle
    */
   struct GNUNET_RECLAIM_AttributeIterator *it_tail;
 
+  /**
+   * Head of active iterations
+   */
+  struct GNUNET_RECLAIM_AttestationIterator *ait_head;
+
+  /**
+   * Tail of active iterations
+   */
+  struct GNUNET_RECLAIM_AttestationIterator *ait_tail;
+
   /**
    * Head of active iterations
    */
@@ -371,6 +458,23 @@ free_it (struct GNUNET_RECLAIM_AttributeIterator *it)
 }
 
 
+/**
+ * Free @a it.
+ *
+ * @param ait entry to free
+ */
+static void
+free_ait (struct GNUNET_RECLAIM_AttestationIterator *ait)
+{
+  struct GNUNET_RECLAIM_Handle *h = ait->h;
+
+  GNUNET_CONTAINER_DLL_remove (h->ait_head, h->ait_tail, ait);
+  if (NULL != ait->env)
+    GNUNET_MQ_discard (ait->env);
+  GNUNET_free (ait);
+}
+
+
 /**
  * Free @a op
  *
@@ -457,10 +561,13 @@ check_consume_ticket_result (void *cls,
 {
   size_t msg_len;
   size_t attrs_len;
+  size_t attests_len;
 
   msg_len = ntohs (msg->header.size);
   attrs_len = ntohs (msg->attrs_len);
-  if (msg_len != sizeof(struct ConsumeTicketResultMessage) + attrs_len)
+  attests_len = ntohs (msg->attestations_len);
+  if (msg_len !=
+      sizeof(struct ConsumeTicketResultMessage) + attrs_len + attests_len)
   {
     GNUNET_break (0);
     return GNUNET_SYSERR;
@@ -483,9 +590,12 @@ handle_consume_ticket_result (void *cls,
   struct GNUNET_RECLAIM_Handle *h = cls;
   struct GNUNET_RECLAIM_Operation *op;
   size_t attrs_len;
+  size_t attests_len;
   uint32_t r_id = ntohl (msg->id);
+  char *read_ptr;
 
   attrs_len = ntohs (msg->attrs_len);
+  attests_len = ntohs (msg->attestations_len);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing ticket result.\n");
 
 
@@ -496,38 +606,55 @@ handle_consume_ticket_result (void *cls,
     return;
 
   {
-    struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
-    struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
-    struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le2;
+    struct GNUNET_RECLAIM_AttributeList *attrs;
+    struct GNUNET_RECLAIM_AttributeListEntry *le;
+    struct GNUNET_RECLAIM_AttestationList *attests;
+    struct GNUNET_RECLAIM_AttestationListEntry *ale;
     attrs =
-      GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char *) &msg[1], attrs_len);
-    if (NULL != op->ar_cb)
+      GNUNET_RECLAIM_attribute_list_deserialize ((char *) &msg[1], attrs_len);
+    read_ptr = ((char *) &msg[1]) + attrs_len;
+    attests =
+      GNUNET_RECLAIM_attestation_list_deserialize (read_ptr, attests_len);
+    if (NULL != op->atr_cb)
     {
       if (NULL == attrs)
       {
-        op->ar_cb (op->cls, &msg->identity, NULL, NULL, NULL);
+        op->atr_cb (op->cls, &msg->identity, NULL, NULL);
       }
       else
       {
         for (le = attrs->list_head; NULL != le; le = le->next)
         {
-          if (le->reference != NULL && le->attest == NULL)
+          if (GNUNET_NO ==
+              GNUNET_RECLAIM_id_is_zero (&le->attribute->attestation))
           {
-            for (le2 = attrs->list_head; NULL != le2; le2 = le2->next)
+            for (ale = attests->list_head; NULL != ale; ale = ale->next)
             {
-              if (le2->attest != NULL && le2->attest->id == 
le->reference->id_attest)
+              if (GNUNET_YES ==
+                  GNUNET_RECLAIM_id_is_equal (&le->attribute->attestation,
+                                              &ale->attestation->id))
               {
-                op->ar_cb (op->cls, &msg->identity, le->claim, le2->attest, 
le->reference);
+                op->atr_cb (op->cls, &msg->identity,
+                            le->attribute, ale->attestation);
                 break;
               }
 
             }
           }
+          else     // No attestations
+          {
+            op->atr_cb (op->cls, &msg->identity,
+                        le->attribute, NULL);
+          }
         }
-        GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs);
+        if (NULL != attrs)
+          GNUNET_RECLAIM_attribute_list_destroy (attrs);
+        if (NULL != attests)
+          GNUNET_RECLAIM_attestation_list_destroy (attests);
         attrs = NULL;
+        attests = NULL;
       }
-      op->ar_cb (op->cls, NULL, NULL, NULL, NULL);
+      op->atr_cb (op->cls, NULL, NULL, NULL);
     }
     GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
     free_op (op);
@@ -578,9 +705,11 @@ handle_attribute_result (void *cls, const struct 
AttributeResultMessage *msg)
   struct GNUNET_RECLAIM_AttributeIterator *it;
   struct GNUNET_RECLAIM_Operation *op;
   size_t attr_len;
+  size_t attest_len;
   uint32_t r_id = ntohl (msg->id);
 
   attr_len = ntohs (msg->attr_len);
+  attest_len = ntohs (msg->attestation_len);
   LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing attribute result.\n");
 
 
@@ -611,7 +740,7 @@ handle_attribute_result (void *cls, const struct 
AttributeResultMessage *msg)
     if (NULL != op)
     {
       if (NULL != op->ar_cb)
-        op->ar_cb (op->cls, NULL, NULL, NULL, NULL);
+        op->ar_cb (op->cls, NULL, NULL);
       GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
       free_op (op);
     }
@@ -619,17 +748,17 @@ handle_attribute_result (void *cls, const struct 
AttributeResultMessage *msg)
   }
 
   {
-    struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr;
-    attr = GNUNET_RECLAIM_ATTRIBUTE_deserialize ((char *) &msg[1], attr_len);
+    struct GNUNET_RECLAIM_Attribute *attr;
+    attr = GNUNET_RECLAIM_attribute_deserialize ((char *) &msg[1], attr_len);
     if (NULL != it)
     {
       if (NULL != it->proc)
-        it->proc (it->proc_cls, &msg->identity, attr, NULL, NULL);
+        it->proc (it->proc_cls, &msg->identity, attr);
     }
     else if (NULL != op)
     {
       if (NULL != op->ar_cb)
-        op->ar_cb (op->cls, &msg->identity, attr, NULL, NULL);
+        op->ar_cb (op->cls, &msg->identity, attr);
     }
     GNUNET_free (attr);
     return;
@@ -637,23 +766,24 @@ handle_attribute_result (void *cls, const struct 
AttributeResultMessage *msg)
   GNUNET_assert (0);
 }
 
+
 /**
    * Handle an incoming message of type
-   * #GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT
+   * #GNUNET_MESSAGE_TYPE_RECLAIM_attestation_RESULT
    *
    * @param cls
    * @param msg the message we received
    * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
    */
 static int
-check_attestation_result (void *cls, const struct AttributeResultMessage *msg)
+check_attestation_result (void *cls, const struct AttestationResultMessage 
*msg)
 {
   size_t msg_len;
-  size_t attr_len;
+  size_t attest_len;
 
   msg_len = ntohs (msg->header.size);
-  attr_len = ntohs (msg->attr_len);
-  if (msg_len != sizeof(struct AttributeResultMessage) + attr_len)
+  attest_len = ntohs (msg->attestation_len);
+  if (msg_len != sizeof(struct AttestationResultMessage) + attest_len)
   {
     GNUNET_break (0);
     return GNUNET_SYSERR;
@@ -664,26 +794,27 @@ check_attestation_result (void *cls, const struct 
AttributeResultMessage *msg)
 
 /**
  * Handle an incoming message of type
- * #GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT
+ * #GNUNET_MESSAGE_TYPE_RECLAIM_attestation_RESULT
  *
  * @param cls
  * @param msg the message we received
  */
 static void
-handle_attestation_result (void *cls, const struct AttributeResultMessage *msg)
+handle_attestation_result (void *cls, const struct
+                           AttestationResultMessage *msg)
 {
   static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy;
   struct GNUNET_RECLAIM_Handle *h = cls;
-  struct GNUNET_RECLAIM_AttributeIterator *it;
+  struct GNUNET_RECLAIM_AttestationIterator *it;
   struct GNUNET_RECLAIM_Operation *op;
-  size_t attr_len;
+  size_t att_len;
   uint32_t r_id = ntohl (msg->id);
 
-  attr_len = ntohs (msg->attr_len);
+  att_len = ntohs (msg->attestation_len);
   LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing attestation result.\n");
 
 
-  for (it = h->it_head; NULL != it; it = it->next)
+  for (it = h->ait_head; NULL != it; it = it->next)
     if (it->r_id == r_id)
       break;
   for (op = h->op_head; NULL != op; op = op->next)
@@ -705,12 +836,12 @@ handle_attestation_result (void *cls, const struct 
AttributeResultMessage *msg)
     {
       if (NULL != it->finish_cb)
         it->finish_cb (it->finish_cb_cls);
-      free_it (it);
+      free_ait (it);
     }
     if (NULL != op)
     {
-      if (NULL != op->ar_cb)
-        op->ar_cb (op->cls, NULL, NULL, NULL, NULL);
+      if (NULL != op->at_cb)
+        op->at_cb (op->cls, NULL, NULL);
       GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
       free_op (op);
     }
@@ -718,129 +849,26 @@ handle_attestation_result (void *cls, const struct 
AttributeResultMessage *msg)
   }
 
   {
-    struct GNUNET_RECLAIM_ATTESTATION_Claim *attr;
-    attr = GNUNET_RECLAIM_ATTESTATION_deserialize ((char *) &msg[1], attr_len);
-    if (NULL != it)
-    {
-      if (NULL != it->proc)
-        it->proc (it->proc_cls, &msg->identity, NULL, attr, NULL);
-    }
-    else if (NULL != op)
-    {
-      if (NULL != op->ar_cb)
-        op->ar_cb (op->cls, &msg->identity, NULL, attr, NULL);
-    }
-    GNUNET_free (attr);
-    return;
-  }
-  GNUNET_assert (0);
-}
-
-/**
-   * Handle an incoming message of type
-   * #GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT
-   *
-   * @param cls
-   * @param msg the message we received
-   * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
-   */
-static int
-check_reference_result (void *cls, const struct ReferenceResultMessage *msg)
-{
-  size_t msg_len;
-  size_t attr_len;
-  size_t ref_len;
-
-  msg_len = ntohs (msg->header.size);
-  attr_len = ntohs (msg->attest_len);
-  ref_len = ntohs (msg->ref_len);
-  if (msg_len != sizeof(struct ReferenceResultMessage) + attr_len + ref_len)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-/**
-* Handle an incoming message of type
-* #GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT
-*
-* @param cls
-* @param msg the message we received
-*/
-static void
-handle_reference_result (void *cls, const struct ReferenceResultMessage *msg)
-{
-  static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy;
-  struct GNUNET_RECLAIM_Handle *h = cls;
-  struct GNUNET_RECLAIM_AttributeIterator *it;
-  struct GNUNET_RECLAIM_Operation *op;
-  size_t attest_len;
-  size_t ref_len;
-  uint32_t r_id = ntohl (msg->id);
-  attest_len = ntohs (msg->attest_len);
-  ref_len = ntohs (msg->ref_len);
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing reference result.\n");
-  for (it = h->it_head; NULL != it; it = it->next)
-    if (it->r_id == r_id)
-      break;
-  for (op = h->op_head; NULL != op; op = op->next)
-    if (op->r_id == r_id)
-      break;
-  if ((NULL == it) && (NULL == op))
-    return;
-
-  if ((0 ==
-       (memcmp (&msg->identity, &identity_dummy, sizeof(identity_dummy)))))
-  {
-    if ((NULL == it) && (NULL == op))
-    {
-      GNUNET_break (0);
-      force_reconnect (h);
-      return;
-    }
-    if (NULL != it)
-    {
-      if (NULL != it->finish_cb)
-        it->finish_cb (it->finish_cb_cls);
-      free_it (it);
-    }
-    if (NULL != op)
-    {
-      if (NULL != op->ar_cb)
-        op->ar_cb (op->cls, NULL, NULL, NULL, NULL);
-      GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
-      free_op (op);
-    }
-    return;
-  }
+    struct GNUNET_RECLAIM_Attestation *att;
+    att = GNUNET_RECLAIM_attestation_deserialize ((char *) &msg[1], att_len);
 
-  {
-    struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *ref;
-    struct GNUNET_RECLAIM_ATTESTATION_Claim *attest;
-    attest = GNUNET_RECLAIM_ATTESTATION_deserialize ((char *) &msg[1],
-                                                     attest_len);
-    ref = GNUNET_RECLAIM_ATTESTATION_REF_deserialize ((char *) &msg[1]
-                                                      + attest_len,
-                                                      ref_len);
     if (NULL != it)
     {
       if (NULL != it->proc)
-        it->proc (it->proc_cls, &msg->identity, NULL, attest, ref);
+        it->proc (it->proc_cls, &msg->identity, att);
     }
     else if (NULL != op)
     {
-      if (NULL != op->ar_cb)
-        op->ar_cb (op->cls, &msg->identity, NULL, attest, ref);
+      if (NULL != op->at_cb)
+        op->at_cb (op->cls, &msg->identity, att);
     }
-    GNUNET_free (ref);
-    GNUNET_free (attest);
+    GNUNET_free (att);
     return;
   }
   GNUNET_assert (0);
 }
 
+
 /**
  * Handle an incoming message of type
  * #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT
@@ -961,11 +989,7 @@ reconnect (struct GNUNET_RECLAIM_Handle *h)
                            h),
     GNUNET_MQ_hd_var_size (attestation_result,
                            GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT,
-                           struct AttributeResultMessage,
-                           h),
-    GNUNET_MQ_hd_var_size (reference_result,
-                           GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT,
-                           struct ReferenceResultMessage,
+                           struct AttestationResultMessage,
                            h),
     GNUNET_MQ_hd_fixed_size (ticket_result,
                              GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT,
@@ -1075,7 +1099,7 @@ struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_attribute_store (
   struct GNUNET_RECLAIM_Handle *h,
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
-  const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
+  const struct GNUNET_RECLAIM_Attribute *attr,
   const struct GNUNET_TIME_Relative *exp_interval,
   GNUNET_RECLAIM_ContinuationWithStatus cont,
   void *cont_cls)
@@ -1090,7 +1114,7 @@ GNUNET_RECLAIM_attribute_store (
   op->cls = cont_cls;
   op->r_id = h->r_id_gen++;
   GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
-  attr_len = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (attr);
+  attr_len = GNUNET_RECLAIM_attribute_serialize_get_size (attr);
   op->env = GNUNET_MQ_msg_extra (sam,
                                  attr_len,
                                  GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE);
@@ -1098,7 +1122,7 @@ GNUNET_RECLAIM_attribute_store (
   sam->id = htonl (op->r_id);
   sam->exp = GNUNET_htonll (exp_interval->rel_value_us);
 
-  GNUNET_RECLAIM_ATTRIBUTE_serialize (attr, (char *) &sam[1]);
+  GNUNET_RECLAIM_attribute_serialize (attr, (char *) &sam[1]);
 
   sam->attr_len = htons (attr_len);
   if (NULL != h->mq)
@@ -1122,7 +1146,7 @@ struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_attribute_delete (
   struct GNUNET_RECLAIM_Handle *h,
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
-  const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
+  const struct GNUNET_RECLAIM_Attribute *attr,
   GNUNET_RECLAIM_ContinuationWithStatus cont,
   void *cont_cls)
 {
@@ -1136,13 +1160,13 @@ GNUNET_RECLAIM_attribute_delete (
   op->cls = cont_cls;
   op->r_id = h->r_id_gen++;
   GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
-  attr_len = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (attr);
+  attr_len = GNUNET_RECLAIM_attribute_serialize_get_size (attr);
   op->env = GNUNET_MQ_msg_extra (dam,
                                  attr_len,
                                  GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE);
   dam->identity = *pkey;
   dam->id = htonl (op->r_id);
-  GNUNET_RECLAIM_ATTRIBUTE_serialize (attr, (char *) &dam[1]);
+  GNUNET_RECLAIM_attribute_serialize (attr, (char *) &dam[1]);
 
   dam->attr_len = htons (attr_len);
   if (NULL != h->mq)
@@ -1150,6 +1174,7 @@ GNUNET_RECLAIM_attribute_delete (
   return op;
 }
 
+
 /**
    * Store an attestation.  If the attestation is already present,
    * it is replaced with the new attestation.
@@ -1166,7 +1191,7 @@ struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_attestation_store (
   struct GNUNET_RECLAIM_Handle *h,
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
-  const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr,
+  const struct GNUNET_RECLAIM_Attestation *attr,
   const struct GNUNET_TIME_Relative *exp_interval,
   GNUNET_RECLAIM_ContinuationWithStatus cont,
   void *cont_cls)
@@ -1181,7 +1206,7 @@ GNUNET_RECLAIM_attestation_store (
   op->cls = cont_cls;
   op->r_id = h->r_id_gen++;
   GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
-  attr_len = GNUNET_RECLAIM_ATTESTATION_serialize_get_size (attr);
+  attr_len = GNUNET_RECLAIM_attestation_serialize_get_size (attr);
   op->env = GNUNET_MQ_msg_extra (sam,
                                  attr_len,
                                  
GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_STORE);
@@ -1189,7 +1214,7 @@ GNUNET_RECLAIM_attestation_store (
   sam->id = htonl (op->r_id);
   sam->exp = GNUNET_htonll (exp_interval->rel_value_us);
 
-  GNUNET_RECLAIM_ATTESTATION_serialize (attr, (char *) &sam[1]);
+  GNUNET_RECLAIM_attestation_serialize (attr, (char *) &sam[1]);
 
   sam->attr_len = htons (attr_len);
   if (NULL != h->mq)
@@ -1197,6 +1222,7 @@ GNUNET_RECLAIM_attestation_store (
   return op;
 }
 
+
 /**
    * Delete an attestation. Tickets used to share this attestation are updated
    * accordingly.
@@ -1212,7 +1238,7 @@ struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_attestation_delete (
   struct GNUNET_RECLAIM_Handle *h,
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
-  const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr,
+  const struct GNUNET_RECLAIM_Attestation *attr,
   GNUNET_RECLAIM_ContinuationWithStatus cont,
   void *cont_cls)
 {
@@ -1226,13 +1252,13 @@ GNUNET_RECLAIM_attestation_delete (
   op->cls = cont_cls;
   op->r_id = h->r_id_gen++;
   GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
-  attr_len = GNUNET_RECLAIM_ATTESTATION_serialize_get_size (attr);
+  attr_len = GNUNET_RECLAIM_attestation_serialize_get_size (attr);
   op->env = GNUNET_MQ_msg_extra (dam,
                                  attr_len,
                                  
GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_DELETE);
   dam->identity = *pkey;
   dam->id = htonl (op->r_id);
-  GNUNET_RECLAIM_ATTESTATION_serialize (attr, (char *) &dam[1]);
+  GNUNET_RECLAIM_attestation_serialize (attr, (char *) &dam[1]);
 
   dam->attr_len = htons (attr_len);
   if (NULL != h->mq)
@@ -1240,95 +1266,6 @@ GNUNET_RECLAIM_attestation_delete (
   return op;
 }
 
-/**
-   * Store an attestation reference.  If the reference is already present,
-   * it is replaced with the new reference.
-   *
-   * @param h handle to the re:claimID service
-   * @param pkey private key of the identity
-   * @param attr the reference value
-   * @param exp_interval the relative expiration interval for the reference
-   * @param cont continuation to call when done
-   * @param cont_cls closure for @a cont
-   * @return handle to abort the request
-   */
-struct GNUNET_RECLAIM_Operation *
-GNUNET_RECLAIM_attestation_reference_store (
-  struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
-  const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr,
-  const struct GNUNET_TIME_Relative *exp_interval,
-  GNUNET_RECLAIM_ContinuationWithStatus cont,
-  void *cont_cls)
-{
-  struct GNUNET_RECLAIM_Operation *op;
-  struct AttributeStoreMessage *sam;
-  size_t attr_len;
-  op = GNUNET_new (struct GNUNET_RECLAIM_Operation);
-  op->h = h;
-  op->as_cb = cont;
-  op->cls = cont_cls;
-  op->r_id = h->r_id_gen++;
-  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
-  attr_len = GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size (attr);
-  op->env = GNUNET_MQ_msg_extra (sam,
-                                 attr_len,
-                                 GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_STORE);
-  sam->identity = *pkey;
-  sam->id = htonl (op->r_id);
-  sam->exp = GNUNET_htonll (exp_interval->rel_value_us);
-
-  GNUNET_RECLAIM_ATTESTATION_REF_serialize (attr, (char *) &sam[1]);
-
-  sam->attr_len = htons (attr_len);
-  if (NULL != h->mq)
-    GNUNET_MQ_send_copy (h->mq, op->env);
-  return op;
-}
-
-/**
- * Delete an attestation reference. Tickets used to share this reference are 
updated
- * accordingly.
- *
- * @param h handle to the re:claimID service
- * @param pkey Private key of the identity to delete the reference from
- * @param attr The reference
- * @param cont Continuation to call when done
- * @param cont_cls Closure for @a cont
- * @return handle Used to to abort the request
- */
-struct GNUNET_RECLAIM_Operation *
-GNUNET_RECLAIM_attestation_reference_delete (
-  struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
-  const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr,
-  GNUNET_RECLAIM_ContinuationWithStatus cont,
-  void *cont_cls)
-{
-
-  struct GNUNET_RECLAIM_Operation *op;
-  struct AttributeDeleteMessage *dam;
-  size_t attr_len;
-
-  op = GNUNET_new (struct GNUNET_RECLAIM_Operation);
-  op->h = h;
-  op->as_cb = cont;
-  op->cls = cont_cls;
-  op->r_id = h->r_id_gen++;
-  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
-  attr_len = GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size (attr);
-  op->env = GNUNET_MQ_msg_extra (dam,
-                                 attr_len,
-                                 GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_DELETE);
-  dam->identity = *pkey;
-  dam->id = htonl (op->r_id);
-  GNUNET_RECLAIM_ATTESTATION_REF_serialize (attr, (char *) &dam[1]);
-
-  dam->attr_len = htons (attr_len);
-  if (NULL != h->mq)
-    GNUNET_MQ_send_copy (h->mq, op->env);
-  return op;
-}
 
 /**
  * List all attributes for a local identity.
@@ -1439,6 +1376,119 @@ GNUNET_RECLAIM_get_attributes_stop (struct 
GNUNET_RECLAIM_AttributeIterator *it)
 }
 
 
+/**
+ * List all attestations for a local identity.
+ * This MUST lock the `struct GNUNET_RECLAIM_Handle`
+ * for any other calls than #GNUNET_RECLAIM_get_attestations_next() and
+ * #GNUNET_RECLAIM_get_attestations_stop. @a proc will be called once
+ * immediately, and then again after
+ * #GNUNET_RECLAIM_get_attestations_next() is invoked.
+ *
+ * On error (disconnect), @a error_cb will be invoked.
+ * On normal completion, @a finish_cb proc will be
+ * invoked.
+ *
+ * @param h Handle to the re:claimID service
+ * @param identity Identity to iterate over
+ * @param error_cb Function to call on error (i.e. disconnect),
+ *        the handle is afterwards invalid
+ * @param error_cb_cls Closure for @a error_cb
+ * @param proc Function to call on each attestation
+ * @param proc_cls Closure for @a proc
+ * @param finish_cb Function to call on completion
+ *        the handle is afterwards invalid
+ * @param finish_cb_cls Closure for @a finish_cb
+ * @return an iterator Handle to use for iteration
+ */
+struct GNUNET_RECLAIM_AttestationIterator *
+GNUNET_RECLAIM_get_attestations_start (
+  struct GNUNET_RECLAIM_Handle *h,
+  const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
+  GNUNET_SCHEDULER_TaskCallback error_cb,
+  void *error_cb_cls,
+  GNUNET_RECLAIM_AttestationResult proc,
+  void *proc_cls,
+  GNUNET_SCHEDULER_TaskCallback finish_cb,
+  void *finish_cb_cls)
+{
+  struct GNUNET_RECLAIM_AttestationIterator *ait;
+  struct GNUNET_MQ_Envelope *env;
+  struct AttestationIterationStartMessage *msg;
+  uint32_t rid;
+
+  rid = h->r_id_gen++;
+  ait = GNUNET_new (struct GNUNET_RECLAIM_AttestationIterator);
+  ait->h = h;
+  ait->error_cb = error_cb;
+  ait->error_cb_cls = error_cb_cls;
+  ait->finish_cb = finish_cb;
+  ait->finish_cb_cls = finish_cb_cls;
+  ait->proc = proc;
+  ait->proc_cls = proc_cls;
+  ait->r_id = rid;
+  ait->identity = *identity;
+  GNUNET_CONTAINER_DLL_insert_tail (h->ait_head, h->ait_tail, ait);
+  env =
+    GNUNET_MQ_msg (msg,
+                   GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START);
+  msg->id = htonl (rid);
+  msg->identity = *identity;
+  if (NULL == h->mq)
+    ait->env = env;
+  else
+    GNUNET_MQ_send (h->mq, env);
+  return ait;
+}
+
+
+/**
+ * Calls the record processor specified in 
#GNUNET_RECLAIM_get_attestation_start
+ * for the next record.
+ *
+ * @param it the iterator
+ */
+void
+GNUNET_RECLAIM_get_attestations_next (struct
+                                      GNUNET_RECLAIM_AttestationIterator *ait)
+{
+  struct GNUNET_RECLAIM_Handle *h = ait->h;
+  struct AttestationIterationNextMessage *msg;
+  struct GNUNET_MQ_Envelope *env;
+
+  env =
+    GNUNET_MQ_msg (msg, 
GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT);
+  msg->id = htonl (ait->r_id);
+  GNUNET_MQ_send (h->mq, env);
+}
+
+
+/**
+ * Stops iteration and releases the handle for further calls. Must
+ * be called on any iteration that has not yet completed prior to calling
+ * #GNUNET_RECLAIM_disconnect.
+ *
+ * @param it the iterator
+ */
+void
+GNUNET_RECLAIM_get_attestations_stop (struct
+                                      GNUNET_RECLAIM_AttestationIterator *ait)
+{
+  struct GNUNET_RECLAIM_Handle *h = ait->h;
+  struct GNUNET_MQ_Envelope *env;
+  struct AttestationIterationStopMessage *msg;
+
+  if (NULL != h->mq)
+  {
+    env =
+      GNUNET_MQ_msg (msg,
+                     GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP);
+    msg->id = htonl (ait->r_id);
+    GNUNET_MQ_send (h->mq, env);
+  }
+  free_ait (ait);
+}
+
+
 /**
  * Issues a ticket to another relying party. The identity may use
  * @GNUNET_RECLAIM_ticket_consume to consume the ticket
@@ -1457,7 +1507,7 @@ GNUNET_RECLAIM_ticket_issue (
   struct GNUNET_RECLAIM_Handle *h,
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss,
   const struct GNUNET_CRYPTO_EcdsaPublicKey *rp,
-  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
+  const struct GNUNET_RECLAIM_AttributeList *attrs,
   GNUNET_RECLAIM_TicketCallback cb,
   void *cb_cls)
 {
@@ -1472,7 +1522,7 @@ GNUNET_RECLAIM_ticket_issue (
   op->cls = cb_cls;
   op->r_id = h->r_id_gen++;
   GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
-  attr_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (attrs);
+  attr_len = GNUNET_RECLAIM_attribute_list_serialize_get_size (attrs);
   op->env = GNUNET_MQ_msg_extra (tim,
                                  attr_len,
                                  GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET);
@@ -1480,7 +1530,7 @@ GNUNET_RECLAIM_ticket_issue (
   tim->rp = *rp;
   tim->id = htonl (op->r_id);
 
-  GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs, (char *) &tim[1]);
+  GNUNET_RECLAIM_attribute_list_serialize (attrs, (char *) &tim[1]);
 
   tim->attr_len = htons (attr_len);
   if (NULL != h->mq)
@@ -1506,7 +1556,7 @@ GNUNET_RECLAIM_ticket_consume (
   struct GNUNET_RECLAIM_Handle *h,
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
   const struct GNUNET_RECLAIM_Ticket *ticket,
-  GNUNET_RECLAIM_AttributeResult cb,
+  GNUNET_RECLAIM_AttributeTicketResult cb,
   void *cb_cls)
 {
   struct GNUNET_RECLAIM_Operation *op;
@@ -1514,7 +1564,7 @@ GNUNET_RECLAIM_ticket_consume (
 
   op = GNUNET_new (struct GNUNET_RECLAIM_Operation);
   op->h = h;
-  op->ar_cb = cb;
+  op->atr_cb = cb;
   op->cls = cb_cls;
   op->r_id = h->r_id_gen++;
   GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
diff --git a/src/reclaim/reclaim_attestation.c 
b/src/reclaim/reclaim_attestation.c
new file mode 100644
index 000000000..66da8e74a
--- /dev/null
+++ b/src/reclaim/reclaim_attestation.c
@@ -0,0 +1,563 @@
+/*
+   This file is part of GNUnet
+   Copyright (C) 2010-2015 GNUnet e.V.
+
+   GNUnet is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Affero General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   GNUnet is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   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 reclaim-attribute/reclaim_attestation.c
+ * @brief helper library to manage identity attribute attestations
+ * @author Martin Schanzenbach
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_reclaim_plugin.h"
+#include "reclaim_attestation.h"
+
+
+/**
+ * Handle for a plugin
+ */
+struct Plugin
+{
+  /**
+   * Name of the plugin
+   */
+  char *library_name;
+
+  /**
+   * Plugin API
+   */
+  struct GNUNET_RECLAIM_AttestationPluginFunctions *api;
+};
+
+
+/**
+ * Plugins
+ */
+static struct Plugin **attest_plugins;
+
+
+/**
+ * Number of plugins
+ */
+static unsigned int num_plugins;
+
+
+/**
+ * Init canary
+ */
+static int initialized;
+
+
+/**
+ * Add a plugin
+ *
+ * @param cls closure
+ * @param library_name name of the API library
+ * @param lib_ret the plugin API pointer
+ */
+static void
+add_plugin (void *cls, const char *library_name, void *lib_ret)
+{
+  struct GNUNET_RECLAIM_AttestationPluginFunctions *api = lib_ret;
+  struct Plugin *plugin;
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Loading attestation plugin `%s'\n",
+              library_name);
+  plugin = GNUNET_new (struct Plugin);
+  plugin->api = api;
+  plugin->library_name = GNUNET_strdup (library_name);
+  GNUNET_array_append (attest_plugins, num_plugins, plugin);
+}
+
+
+/**
+ * Load plugins
+ */
+static void
+init ()
+{
+  if (GNUNET_YES == initialized)
+    return;
+  initialized = GNUNET_YES;
+  GNUNET_PLUGIN_load_all ("libgnunet_plugin_reclaim_attestation_",
+                          NULL,
+                          &add_plugin,
+                          NULL);
+}
+
+
+/**
+ * Convert an attestation type name to the corresponding number
+ *
+ * @param typename name to convert
+ * @return corresponding number, UINT32_MAX on error
+ */
+uint32_t
+GNUNET_RECLAIM_attestation_typename_to_number (const char *typename)
+{
+  unsigned int i;
+  struct Plugin *plugin;
+  uint32_t ret;
+  init ();
+  for (i = 0; i < num_plugins; i++)
+  {
+    plugin = attest_plugins[i];
+    if (UINT32_MAX !=
+        (ret = plugin->api->typename_to_number (plugin->api->cls,
+                                                typename)))
+      return ret;
+  }
+  return UINT32_MAX;
+}
+
+
+/**
+ * Convert an attestation type number to the corresponding attestation type 
string
+ *
+ * @param type number of a type
+ * @return corresponding typestring, NULL on error
+ */
+const char *
+GNUNET_RECLAIM_attestation_number_to_typename (uint32_t type)
+{
+  unsigned int i;
+  struct Plugin *plugin;
+  const char *ret;
+
+  init ();
+  for (i = 0; i < num_plugins; i++)
+  {
+    plugin = attest_plugins[i];
+    if (NULL !=
+        (ret = plugin->api->number_to_typename (plugin->api->cls, type)))
+      return ret;
+  }
+  return NULL;
+}
+
+
+/**
+ * Convert human-readable version of a 'claim' of an attestation to the binary
+ * representation
+ *
+ * @param type type of the claim
+ * @param s human-readable string
+ * @param data set to value in binary encoding (will be allocated)
+ * @param data_size set to number of bytes in @a data
+ * @return #GNUNET_OK on success
+ */
+int
+GNUNET_RECLAIM_attestation_string_to_value (uint32_t type,
+                                            const char *s,
+                                            void **data,
+                                            size_t *data_size)
+{
+  unsigned int i;
+  struct Plugin *plugin;
+
+  init ();
+  for (i = 0; i < num_plugins; i++)
+  {
+    plugin = attest_plugins[i];
+    if (GNUNET_OK == plugin->api->string_to_value (plugin->api->cls,
+                                                   type,
+                                                   s,
+                                                   data,
+                                                   data_size))
+      return GNUNET_OK;
+  }
+  return GNUNET_SYSERR;
+}
+
+
+/**
+ * Convert the 'claim' of an attestation to a string
+ *
+ * @param type the type of attestation
+ * @param data claim in binary encoding
+ * @param data_size number of bytes in @a data
+ * @return NULL on error, otherwise human-readable representation of the claim
+ */
+char *
+GNUNET_RECLAIM_attestation_value_to_string (uint32_t type,
+                                            const void *data,
+                                            size_t data_size)
+{
+  unsigned int i;
+  struct Plugin *plugin;
+  char *ret;
+
+  init ();
+  for (i = 0; i < num_plugins; i++)
+  {
+    plugin = attest_plugins[i];
+    if (NULL != (ret = plugin->api->value_to_string (plugin->api->cls,
+                                                     type,
+                                                     data,
+                                                     data_size)))
+      return ret;
+  }
+  return NULL;
+}
+
+
+/**
+   * Create a new attestation.
+   *
+   * @param attr_name the attestation name
+   * @param type the attestation type
+   * @param data the attestation value
+   * @param data_size the attestation value size
+   * @return the new attestation
+   */
+struct GNUNET_RECLAIM_Attestation *
+GNUNET_RECLAIM_attestation_new (const char *attr_name,
+                                uint32_t type,
+                                const void *data,
+                                size_t data_size)
+{
+  struct GNUNET_RECLAIM_Attestation *attr;
+  char *write_ptr;
+  char *attr_name_tmp = GNUNET_strdup (attr_name);
+
+  GNUNET_STRINGS_utf8_tolower (attr_name, attr_name_tmp);
+
+  attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Attestation)
+                        + strlen (attr_name_tmp) + 1 + data_size);
+  attr->type = type;
+  attr->data_size = data_size;
+  attr->flag = 0;
+  write_ptr = (char *) &attr[1];
+  GNUNET_memcpy (write_ptr, attr_name_tmp, strlen (attr_name_tmp) + 1);
+  attr->name = write_ptr;
+  write_ptr += strlen (attr->name) + 1;
+  GNUNET_memcpy (write_ptr, data, data_size);
+  attr->data = write_ptr;
+  GNUNET_free (attr_name_tmp);
+  return attr;
+}
+
+
+/**
+ * Get required size for serialization buffer
+ *
+ * @param attrs the attribute list to serialize
+ * @return the required buffer size
+ */
+size_t
+GNUNET_RECLAIM_attestation_list_serialize_get_size (
+  const struct GNUNET_RECLAIM_AttestationList *attestations)
+{
+  struct GNUNET_RECLAIM_AttestationListEntry *le;
+  size_t len = 0;
+
+  for (le = attestations->list_head; NULL != le; le = le->next)
+  {
+    GNUNET_assert (NULL != le->attestation);
+    len += GNUNET_RECLAIM_attestation_serialize_get_size (le->attestation);
+    len += sizeof(struct GNUNET_RECLAIM_AttestationListEntry);
+  }
+  return len;
+}
+
+
+/**
+ * Serialize an attribute list
+ *
+ * @param attrs the attribute list to serialize
+ * @param result the serialized attribute
+ * @return length of serialized data
+ */
+size_t
+GNUNET_RECLAIM_attestation_list_serialize (
+  const struct GNUNET_RECLAIM_AttestationList *attestations,
+  char *result)
+{
+  struct GNUNET_RECLAIM_AttestationListEntry *le;
+  size_t len;
+  size_t total_len;
+  char *write_ptr;
+  write_ptr = result;
+  total_len = 0;
+  for (le = attestations->list_head; NULL != le; le = le->next)
+  {
+    GNUNET_assert (NULL != le->attestation);
+    len = GNUNET_RECLAIM_attestation_serialize (le->attestation, write_ptr);
+    total_len += len;
+    write_ptr += len;
+  }
+  return total_len;
+}
+
+
+/**
+ * Deserialize an attestation list
+ *
+ * @param data the serialized attribute list
+ * @param data_size the length of the serialized data
+ * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller
+ */
+struct GNUNET_RECLAIM_AttestationList *
+GNUNET_RECLAIM_attestation_list_deserialize (const char *data, size_t 
data_size)
+{
+  struct GNUNET_RECLAIM_AttestationList *al;
+  struct GNUNET_RECLAIM_AttestationListEntry *ale;
+  size_t att_len;
+  const char *read_ptr;
+
+  al = GNUNET_new (struct GNUNET_RECLAIM_AttestationList);
+
+  if ((data_size < sizeof(struct
+                          Attestation)
+       + sizeof(struct GNUNET_RECLAIM_AttestationListEntry)))
+    return al;
+
+  read_ptr = data;
+  while (((data + data_size) - read_ptr) >= sizeof(struct Attestation))
+  {
+    ale = GNUNET_new (struct GNUNET_RECLAIM_AttestationListEntry);
+    ale->attestation =
+      GNUNET_RECLAIM_attestation_deserialize (read_ptr,
+                                              data_size - (read_ptr - data));
+    GNUNET_CONTAINER_DLL_insert (al->list_head, al->list_tail, ale);
+    att_len = GNUNET_RECLAIM_attestation_serialize_get_size (ale->attestation);
+    read_ptr += att_len;
+  }
+  return al;
+}
+
+
+/**
+ * Make a (deep) copy of the attestation list
+ * @param attrs claim list to copy
+ * @return copied claim list
+ */
+struct GNUNET_RECLAIM_AttestationList *
+GNUNET_RECLAIM_attestation_list_dup (
+  const struct GNUNET_RECLAIM_AttestationList *al)
+{
+  struct GNUNET_RECLAIM_AttestationListEntry *ale;
+  struct GNUNET_RECLAIM_AttestationListEntry *result_ale;
+  struct GNUNET_RECLAIM_AttestationList *result;
+
+  result = GNUNET_new (struct GNUNET_RECLAIM_AttestationList);
+  for (ale = al->list_head; NULL != ale; ale = ale->next)
+  {
+    result_ale = GNUNET_new (struct GNUNET_RECLAIM_AttestationListEntry);
+    GNUNET_assert (NULL != ale->attestation);
+    result_ale->attestation =
+      GNUNET_RECLAIM_attestation_new (ale->attestation->name,
+                                      ale->attestation->type,
+                                      ale->attestation->data,
+                                      ale->attestation->data_size);
+    result_ale->attestation->id = ale->attestation->id;
+    GNUNET_CONTAINER_DLL_insert (result->list_head,
+                                 result->list_tail,
+                                 result_ale);
+  }
+  return result;
+}
+
+
+/**
+ * Destroy attestation list
+ *
+ * @param attrs list to destroy
+ */
+void
+GNUNET_RECLAIM_attestation_list_destroy (
+  struct GNUNET_RECLAIM_AttestationList *al)
+{
+  struct GNUNET_RECLAIM_AttestationListEntry *ale;
+  struct GNUNET_RECLAIM_AttestationListEntry *tmp_ale;
+
+  for (ale = al->list_head; NULL != ale;)
+  {
+    if (NULL != ale->attestation)
+      GNUNET_free (ale->attestation);
+    tmp_ale = ale;
+    ale = ale->next;
+    GNUNET_free (tmp_ale);
+  }
+  GNUNET_free (al);
+}
+
+
+/**
+ * Get required size for serialization buffer
+ *
+ * @param attr the attestation to serialize
+ * @return the required buffer size
+ */
+size_t
+GNUNET_RECLAIM_attestation_serialize_get_size (
+  const struct GNUNET_RECLAIM_Attestation *attestation)
+{
+  return sizeof(struct Attestation) + strlen (attestation->name)
+         + attestation->data_size;
+}
+
+
+/**
+ * Serialize an attestation
+ *
+ * @param attr the attestation to serialize
+ * @param result the serialized attestation
+ * @return length of serialized data
+ */
+size_t
+GNUNET_RECLAIM_attestation_serialize (
+  const struct GNUNET_RECLAIM_Attestation *attestation,
+  char *result)
+{
+  size_t data_len_ser;
+  size_t name_len;
+  struct Attestation *atts;
+  char *write_ptr;
+
+  atts = (struct Attestation *) result;
+  atts->attestation_type = htons (attestation->type);
+  atts->attestation_flag = htonl (attestation->flag);
+  atts->attestation_id = attestation->id;
+  name_len = strlen (attestation->name);
+  atts->name_len = htons (name_len);
+  write_ptr = (char *) &atts[1];
+  GNUNET_memcpy (write_ptr, attestation->name, name_len);
+  write_ptr += name_len;
+  // TODO plugin-ize
+  // data_len_ser = plugin->serialize_attribute_value (attr,
+  //                                                  &attr_ser[1]);
+  data_len_ser = attestation->data_size;
+  GNUNET_memcpy (write_ptr, attestation->data, attestation->data_size);
+  atts->data_size = htons (data_len_ser);
+
+  return sizeof(struct Attestation) + strlen (attestation->name)
+         + attestation->data_size;
+}
+
+
+/**
+ * Deserialize an attestation
+ *
+ * @param data the serialized attestation
+ * @param data_size the length of the serialized data
+ *
+ * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
+ */
+struct GNUNET_RECLAIM_Attestation *
+GNUNET_RECLAIM_attestation_deserialize (const char *data, size_t data_size)
+{
+  struct GNUNET_RECLAIM_Attestation *attestation;
+  struct Attestation *atts;
+  size_t data_len;
+  size_t name_len;
+  char *write_ptr;
+
+  if (data_size < sizeof(struct Attestation))
+    return NULL;
+
+  atts = (struct Attestation *) data;
+  data_len = ntohs (atts->data_size);
+  name_len = ntohs (atts->name_len);
+  if (data_size < sizeof(struct Attestation) + data_len + name_len)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Buffer too small to deserialize\n");
+    return NULL;
+  }
+  attestation = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Attestation)
+                               + data_len + name_len + 1);
+  attestation->type = ntohs (atts->attestation_type);
+  attestation->flag = ntohl (atts->attestation_flag);
+  attestation->id = atts->attestation_id;
+  attestation->data_size = data_len;
+
+  write_ptr = (char *) &attestation[1];
+  GNUNET_memcpy (write_ptr, &atts[1], name_len);
+  write_ptr[name_len] = '\0';
+  attestation->name = write_ptr;
+
+  write_ptr += name_len + 1;
+  GNUNET_memcpy (write_ptr, (char *) &atts[1] + name_len,
+                 attestation->data_size);
+  attestation->data = write_ptr;
+  return attestation;
+}
+
+
+struct GNUNET_RECLAIM_AttributeList*
+GNUNET_RECLAIM_attestation_get_attributes (const struct
+                                           GNUNET_RECLAIM_Attestation *attest)
+{
+  unsigned int i;
+  struct Plugin *plugin;
+  struct GNUNET_RECLAIM_AttributeList *ret;
+  init ();
+  for (i = 0; i < num_plugins; i++)
+  {
+    plugin = attest_plugins[i];
+    if (NULL !=
+        (ret = plugin->api->get_attributes (plugin->api->cls,
+                                            attest)))
+      return ret;
+  }
+  return NULL;
+}
+
+
+char*
+GNUNET_RECLAIM_attestation_get_issuer (const struct
+                                       GNUNET_RECLAIM_Attestation *attest)
+{
+  unsigned int i;
+  struct Plugin *plugin;
+  char *ret;
+  init ();
+  for (i = 0; i < num_plugins; i++)
+  {
+    plugin = attest_plugins[i];
+    if (NULL !=
+        (ret = plugin->api->get_issuer (plugin->api->cls,
+                                        attest)))
+      return ret;
+  }
+  return NULL;
+}
+
+
+int
+GNUNET_RECLAIM_attestation_get_expiration (const struct
+                                           GNUNET_RECLAIM_Attestation *attest,
+                                           struct GNUNET_TIME_Absolute* exp)
+{
+  unsigned int i;
+  struct Plugin *plugin;
+  init ();
+  for (i = 0; i < num_plugins; i++)
+  {
+    plugin = attest_plugins[i];
+    if (GNUNET_OK !=  plugin->api->get_expiration (plugin->api->cls,
+                                                   attest,
+                                                   exp))
+      continue;
+    return GNUNET_OK;
+  }
+  return GNUNET_SYSERR;
+}
diff --git a/src/reclaim-attribute/reclaim_attribute.h 
b/src/reclaim/reclaim_attestation.h
similarity index 53%
copy from src/reclaim-attribute/reclaim_attribute.h
copy to src/reclaim/reclaim_attestation.h
index 80f1e5aac..5747d8896 100644
--- a/src/reclaim-attribute/reclaim_attribute.h
+++ b/src/reclaim/reclaim_attestation.h
@@ -19,48 +19,15 @@
  */
 /**
  * @author Martin Schanzenbach
- * @file reclaim-attribute/reclaim_attribute.h
- * @brief GNUnet reclaim identity attributes
+ * @file reclaim-attribute/reclaim_attestation.h
+ * @brief GNUnet reclaim identity attribute attestations
  *
  */
-#ifndef RECLAIM_ATTRIBUTE_H
-#define RECLAIM_ATTRIBUTE_H
+#ifndef RECLAIM_ATTESTATION_H
+#define RECLAIM_ATTESTATION_H
 
 #include "gnunet_reclaim_service.h"
 
-/**
- * Serialized claim
- */
-struct Attribute
-{
-  /**
-   * Attribute type
-   */
-  uint32_t attribute_type;
-
-  /**
-   * Attribute version
-   */
-  uint32_t attribute_version;
-
-  /**
-   * Attribute ID
-   */
-  uint64_t attribute_id;
-
-  /**
-   * Name length
-   */
-  uint32_t name_len;
-
-  /**
-   * Data size
-   */
-  uint32_t data_size;
-
-  // followed by data_size Attribute value data
-};
-
 /**
  * Serialized attestation claim
  */
@@ -72,14 +39,14 @@ struct Attestation
   uint32_t attestation_type;
 
   /**
-   * Attestation version
+   * Attestation flag
    */
-  uint32_t attestation_version;
+  uint32_t attestation_flag;
 
   /**
    * Attestation ID
    */
-  uint64_t attestation_id;
+  struct GNUNET_RECLAIM_Identifier attestation_id;
 
   /**
    * Name length
@@ -94,33 +61,4 @@ struct Attestation
   // followed by data_size Attestation value data
 };
 
-/**
- * Serialized attestation reference
- */
-struct Attestation_Reference
-{
-  /**
-   * Reference ID
-   */
-  uint64_t reference_id;
-
-  /**
-   * The ID of the referenced attestation
-   */
-  uint64_t attestation_id;
-
-  /**
-   * Claim Name length
-   */
-  uint32_t name_len;
-
-    /**
-   * Length of the referenced value
-   */
-  uint32_t ref_value_len;
-
-
-  // followed by the name and referenced value
-};
-
 #endif
diff --git a/src/reclaim/reclaim_attribute.c b/src/reclaim/reclaim_attribute.c
new file mode 100644
index 000000000..12f124c15
--- /dev/null
+++ b/src/reclaim/reclaim_attribute.c
@@ -0,0 +1,539 @@
+/*
+   This file is part of GNUnet
+   Copyright (C) 2010-2015 GNUnet e.V.
+
+   GNUnet is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Affero General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   GNUnet is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   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 reclaim-attribute/reclaim_attribute.c
+ * @brief helper library to manage identity attributes
+ * @author Martin Schanzenbach
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_reclaim_plugin.h"
+#include "reclaim_attribute.h"
+
+
+/**
+ * Handle for a plugin
+ */
+struct Plugin
+{
+  /**
+   * Name of the plugin
+   */
+  char *library_name;
+
+  /**
+   * Plugin API
+   */
+  struct GNUNET_RECLAIM_AttributePluginFunctions *api;
+};
+
+
+/**
+ * Plugins
+ */
+static struct Plugin **attr_plugins;
+
+
+/**
+ * Number of plugins
+ */
+static unsigned int num_plugins;
+
+
+/**
+ * Init canary
+ */
+static int initialized;
+
+
+/**
+ * Add a plugin
+ *
+ * @param cls closure
+ * @param library_name name of the API library
+ * @param lib_ret the plugin API pointer
+ */
+static void
+add_plugin (void *cls, const char *library_name, void *lib_ret)
+{
+  struct GNUNET_RECLAIM_AttributePluginFunctions *api = lib_ret;
+  struct Plugin *plugin;
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Loading attribute plugin `%s'\n",
+              library_name);
+  plugin = GNUNET_new (struct Plugin);
+  plugin->api = api;
+  plugin->library_name = GNUNET_strdup (library_name);
+  GNUNET_array_append (attr_plugins, num_plugins, plugin);
+}
+
+
+/**
+ * Load plugins
+ */
+static void
+init ()
+{
+  if (GNUNET_YES == initialized)
+    return;
+  initialized = GNUNET_YES;
+  GNUNET_PLUGIN_load_all ("libgnunet_plugin_reclaim_attribute_",
+                          NULL,
+                          &add_plugin,
+                          NULL);
+}
+
+
+/**
+ * Convert a type name to the corresponding number
+ *
+ * @param typename name to convert
+ * @return corresponding number, UINT32_MAX on error
+ */
+uint32_t
+GNUNET_RECLAIM_attribute_typename_to_number (const char *typename)
+{
+  unsigned int i;
+  struct Plugin *plugin;
+  uint32_t ret;
+
+  init ();
+  for (i = 0; i < num_plugins; i++)
+  {
+    plugin = attr_plugins[i];
+    if (UINT32_MAX !=
+        (ret = plugin->api->typename_to_number (plugin->api->cls, typename)))
+      return ret;
+  }
+  return UINT32_MAX;
+}
+
+
+/**
+ * Convert a type number to the corresponding type string
+ *
+ * @param type number of a type
+ * @return corresponding typestring, NULL on error
+ */
+const char *
+GNUNET_RECLAIM_attribute_number_to_typename (uint32_t type)
+{
+  unsigned int i;
+  struct Plugin *plugin;
+  const char *ret;
+
+  init ();
+  for (i = 0; i < num_plugins; i++)
+  {
+    plugin = attr_plugins[i];
+    if (NULL !=
+        (ret = plugin->api->number_to_typename (plugin->api->cls, type)))
+      return ret;
+  }
+  return NULL;
+}
+
+
+/**
+ * Convert human-readable version of a 'claim' of an attribute to the binary
+ * representation
+ *
+ * @param type type of the claim
+ * @param s human-readable string
+ * @param data set to value in binary encoding (will be allocated)
+ * @param data_size set to number of bytes in @a data
+ * @return #GNUNET_OK on success
+ */
+int
+GNUNET_RECLAIM_attribute_string_to_value (uint32_t type,
+                                          const char *s,
+                                          void **data,
+                                          size_t *data_size)
+{
+  unsigned int i;
+  struct Plugin *plugin;
+
+  init ();
+  for (i = 0; i < num_plugins; i++)
+  {
+    plugin = attr_plugins[i];
+    if (GNUNET_OK == plugin->api->string_to_value (plugin->api->cls,
+                                                   type,
+                                                   s,
+                                                   data,
+                                                   data_size))
+      return GNUNET_OK;
+  }
+  return GNUNET_SYSERR;
+}
+
+
+/**
+ * Convert the 'claim' of an attribute to a string
+ *
+ * @param type the type of attribute
+ * @param data claim in binary encoding
+ * @param data_size number of bytes in @a data
+ * @return NULL on error, otherwise human-readable representation of the claim
+ */
+char *
+GNUNET_RECLAIM_attribute_value_to_string (uint32_t type,
+                                          const void *data,
+                                          size_t data_size)
+{
+  unsigned int i;
+  struct Plugin *plugin;
+  char *ret;
+
+  init ();
+  for (i = 0; i < num_plugins; i++)
+  {
+    plugin = attr_plugins[i];
+    if (NULL != (ret = plugin->api->value_to_string (plugin->api->cls,
+                                                     type,
+                                                     data,
+                                                     data_size)))
+      return ret;
+  }
+  return NULL;
+}
+
+
+/**
+ * Create a new attribute.
+ *
+ * @param attr_name the attribute name
+ * @param attestation attestation ID of the attribute (maybe NULL)
+ * @param type the attribute type
+ * @param data the attribute value
+ * @param data_size the attribute value size
+ * @return the new attribute
+ */
+struct GNUNET_RECLAIM_Attribute *
+GNUNET_RECLAIM_attribute_new (const char *attr_name,
+                              const struct GNUNET_RECLAIM_Identifier 
*attestation,
+                              uint32_t type,
+                              const void *data,
+                              size_t data_size)
+{
+  struct GNUNET_RECLAIM_Attribute *attr;
+  char *write_ptr;
+  char *attr_name_tmp = GNUNET_strdup (attr_name);
+
+  GNUNET_STRINGS_utf8_tolower (attr_name, attr_name_tmp);
+
+  attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Attribute)
+                        + strlen (attr_name_tmp) + 1 + data_size);
+  if (NULL != attestation)
+    attr->attestation = *attestation;
+  attr->type = type;
+  attr->data_size = data_size;
+  attr->flag = 0;
+  write_ptr = (char *) &attr[1];
+  GNUNET_memcpy (write_ptr, attr_name_tmp, strlen (attr_name_tmp) + 1);
+  attr->name = write_ptr;
+  write_ptr += strlen (attr->name) + 1;
+  GNUNET_memcpy (write_ptr, data, data_size);
+  attr->data = write_ptr;
+  GNUNET_free (attr_name_tmp);
+  return attr;
+}
+
+
+/**
+ * Add a new attribute to a claim list
+ *
+ * @param attr_name the name of the new attribute claim
+ * @param type the type of the claim
+ * @param data claim payload
+ * @param data_size claim payload size
+ */
+void
+GNUNET_RECLAIM_attribute_list_add (
+  struct GNUNET_RECLAIM_AttributeList *al,
+  const char *attr_name,
+  const struct GNUNET_RECLAIM_Identifier *attestation,
+  uint32_t type,
+  const void *data,
+  size_t data_size)
+{
+  struct GNUNET_RECLAIM_AttributeListEntry *ale;
+
+  ale = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry);
+  ale->attribute =
+    GNUNET_RECLAIM_attribute_new (attr_name, attestation,
+                                  type, data, data_size);
+  GNUNET_CONTAINER_DLL_insert (al->list_head,
+                               al->list_tail,
+                               ale);
+}
+
+
+/**
+ * Get required size for serialization buffer
+ *
+ * @param attrs the attribute list to serialize
+ * @return the required buffer size
+ */
+size_t
+GNUNET_RECLAIM_attribute_list_serialize_get_size (
+  const struct GNUNET_RECLAIM_AttributeList *al)
+{
+  struct GNUNET_RECLAIM_AttributeListEntry *ale;
+  size_t len = 0;
+
+  for (ale = al->list_head; NULL != ale; ale = ale->next)
+  {
+    GNUNET_assert (NULL != ale->attribute);
+    len += GNUNET_RECLAIM_attribute_serialize_get_size (ale->attribute);
+    len += sizeof(struct GNUNET_RECLAIM_AttributeListEntry);
+  }
+  return len;
+}
+
+
+/**
+ * Serialize an attribute list
+ *
+ * @param attrs the attribute list to serialize
+ * @param result the serialized attribute
+ * @return length of serialized data
+ */
+size_t
+GNUNET_RECLAIM_attribute_list_serialize (
+  const struct GNUNET_RECLAIM_AttributeList *al,
+  char *result)
+{
+  struct GNUNET_RECLAIM_AttributeListEntry *ale;
+  size_t len;
+  size_t total_len;
+  char *write_ptr;
+  write_ptr = result;
+  total_len = 0;
+  for (ale = al->list_head; NULL != ale; ale = ale->next)
+  {
+    GNUNET_assert (NULL != ale->attribute);
+    len = GNUNET_RECLAIM_attribute_serialize (ale->attribute, write_ptr);
+    total_len += len;
+    write_ptr += len;
+  }
+  return total_len;
+}
+
+
+/**
+ * Deserialize an attribute list
+ *
+ * @param data the serialized attribute list
+ * @param data_size the length of the serialized data
+ * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller
+ */
+struct GNUNET_RECLAIM_AttributeList *
+GNUNET_RECLAIM_attribute_list_deserialize (const char *data, size_t data_size)
+{
+  struct GNUNET_RECLAIM_AttributeList *al;
+  struct GNUNET_RECLAIM_AttributeListEntry *ale;
+  size_t attr_len;
+  const char *read_ptr;
+
+  al = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
+  if (data_size < sizeof(struct Attribute) + sizeof(struct
+                                                    
GNUNET_RECLAIM_AttributeListEntry))
+    return al;
+  read_ptr = data;
+  while (((data + data_size) - read_ptr) >= sizeof(struct Attribute))
+  {
+    ale = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry);
+    ale->attribute =
+      GNUNET_RECLAIM_attribute_deserialize (read_ptr,
+                                            data_size - (read_ptr - data));
+    GNUNET_CONTAINER_DLL_insert (al->list_head, al->list_tail, ale);
+    attr_len = GNUNET_RECLAIM_attribute_serialize_get_size (ale->attribute);
+    read_ptr += attr_len;
+  }
+  return al;
+}
+
+
+/**
+ * Make a (deep) copy of a claim list
+ * @param attrs claim list to copy
+ * @return copied claim list
+ */
+struct GNUNET_RECLAIM_AttributeList *
+GNUNET_RECLAIM_attribute_list_dup (
+  const struct GNUNET_RECLAIM_AttributeList *al)
+{
+  struct GNUNET_RECLAIM_AttributeListEntry *ale;
+  struct GNUNET_RECLAIM_AttributeListEntry *result_ale;
+  struct GNUNET_RECLAIM_AttributeList *result;
+
+  result = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
+  for (ale = al->list_head; NULL != ale; ale = ale->next)
+  {
+    result_ale = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry);
+    GNUNET_assert (NULL != ale->attribute);
+    {
+      result_ale->attribute =
+        GNUNET_RECLAIM_attribute_new (ale->attribute->name,
+                                      &ale->attribute->attestation,
+                                      ale->attribute->type,
+                                      ale->attribute->data,
+                                      ale->attribute->data_size);
+
+      result_ale->attribute->id = ale->attribute->id;
+      result_ale->attribute->flag = ale->attribute->flag;
+    }
+    GNUNET_CONTAINER_DLL_insert (result->list_head,
+                                 result->list_tail,
+                                 result_ale);
+  }
+  return result;
+}
+
+
+/**
+ * Destroy claim list
+ *
+ * @param attrs list to destroy
+ */
+void
+GNUNET_RECLAIM_attribute_list_destroy (
+  struct GNUNET_RECLAIM_AttributeList *al)
+{
+  struct GNUNET_RECLAIM_AttributeListEntry *ale;
+  struct GNUNET_RECLAIM_AttributeListEntry *tmp_ale;
+
+  for (ale = al->list_head; NULL != ale;)
+  {
+    if (NULL != ale->attribute)
+      GNUNET_free (ale->attribute);
+    tmp_ale = ale;
+    ale = ale->next;
+    GNUNET_free (tmp_ale);
+  }
+  GNUNET_free (al);
+}
+
+
+/**
+ * Get required size for serialization buffer
+ *
+ * @param attr the attribute to serialize
+ * @return the required buffer size
+ */
+size_t
+GNUNET_RECLAIM_attribute_serialize_get_size (
+  const struct GNUNET_RECLAIM_Attribute *attr)
+{
+  return sizeof(struct Attribute) + strlen (attr->name) + attr->data_size;
+}
+
+
+/**
+ * Serialize an attribute
+ *
+ * @param attr the attribute to serialize
+ * @param result the serialized attribute
+ * @return length of serialized data
+ */
+size_t
+GNUNET_RECLAIM_attribute_serialize (
+  const struct GNUNET_RECLAIM_Attribute *attr,
+  char *result)
+{
+  size_t data_len_ser;
+  size_t name_len;
+  struct Attribute *attr_ser;
+  char *write_ptr;
+
+  attr_ser = (struct Attribute *) result;
+  attr_ser->attribute_type = htons (attr->type);
+  attr_ser->attribute_flag = htonl (attr->flag);
+  attr_ser->attribute_id = attr->id;
+  attr_ser->attestation_id = attr->attestation;
+  name_len = strlen (attr->name);
+  attr_ser->name_len = htons (name_len);
+  write_ptr = (char *) &attr_ser[1];
+  GNUNET_memcpy (write_ptr, attr->name, name_len);
+  write_ptr += name_len;
+  // TODO plugin-ize
+  // data_len_ser = plugin->serialize_attribute_value (attr,
+  //                                                  &attr_ser[1]);
+  data_len_ser = attr->data_size;
+  GNUNET_memcpy (write_ptr, attr->data, attr->data_size);
+  attr_ser->data_size = htons (data_len_ser);
+
+  return sizeof(struct Attribute) + strlen (attr->name) + attr->data_size;
+}
+
+
+/**
+ * Deserialize an attribute
+ *
+ * @param data the serialized attribute
+ * @param data_size the length of the serialized data
+ *
+ * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
+ */
+struct GNUNET_RECLAIM_Attribute *
+GNUNET_RECLAIM_attribute_deserialize (const char *data, size_t data_size)
+{
+  struct GNUNET_RECLAIM_Attribute *attr;
+  struct Attribute *attr_ser;
+  size_t data_len;
+  size_t name_len;
+  char *write_ptr;
+
+  if (data_size < sizeof(struct Attribute))
+    return NULL;
+
+  attr_ser = (struct Attribute *) data;
+  data_len = ntohs (attr_ser->data_size);
+  name_len = ntohs (attr_ser->name_len);
+  if (data_size < sizeof(struct Attribute) + data_len + name_len)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Buffer too small to deserialize\n");
+    return NULL;
+  }
+  attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Attribute)
+                        + data_len + name_len + 1);
+  attr->type = ntohs (attr_ser->attribute_type);
+  attr->flag = ntohl (attr_ser->attribute_flag);
+  attr->id = attr_ser->attribute_id;
+  attr->attestation = attr_ser->attestation_id;
+  attr->data_size = data_len;
+
+  write_ptr = (char *) &attr[1];
+  GNUNET_memcpy (write_ptr, &attr_ser[1], name_len);
+  write_ptr[name_len] = '\0';
+  attr->name = write_ptr;
+
+  write_ptr += name_len + 1;
+  GNUNET_memcpy (write_ptr, (char *) &attr_ser[1] + name_len, attr->data_size);
+  attr->data = write_ptr;
+  return attr;
+}
+
+
+/* end of reclaim_attribute.c */
diff --git a/src/reclaim-attribute/reclaim_attribute.h 
b/src/reclaim/reclaim_attribute.h
similarity index 75%
rename from src/reclaim-attribute/reclaim_attribute.h
rename to src/reclaim/reclaim_attribute.h
index 80f1e5aac..e54b210b9 100644
--- a/src/reclaim-attribute/reclaim_attribute.h
+++ b/src/reclaim/reclaim_attribute.h
@@ -39,14 +39,19 @@ struct Attribute
   uint32_t attribute_type;
 
   /**
-   * Attribute version
+   * Attribute flag
    */
-  uint32_t attribute_version;
+  uint32_t attribute_flag;
 
   /**
    * Attribute ID
    */
-  uint64_t attribute_id;
+  struct GNUNET_RECLAIM_Identifier attribute_id;
+
+  /**
+   * Attestation ID
+   */
+  struct GNUNET_RECLAIM_Identifier attestation_id;
 
   /**
    * Name length
@@ -72,14 +77,14 @@ struct Attestation
   uint32_t attestation_type;
 
   /**
-   * Attestation version
+   * Attestation flag
    */
-  uint32_t attestation_version;
+  uint32_t attestation_flag;
 
   /**
    * Attestation ID
    */
-  uint64_t attestation_id;
+  struct GNUNET_RECLAIM_Identifier attestation_id;
 
   /**
    * Name length
@@ -94,33 +99,4 @@ struct Attestation
   // followed by data_size Attestation value data
 };
 
-/**
- * Serialized attestation reference
- */
-struct Attestation_Reference
-{
-  /**
-   * Reference ID
-   */
-  uint64_t reference_id;
-
-  /**
-   * The ID of the referenced attestation
-   */
-  uint64_t attestation_id;
-
-  /**
-   * Claim Name length
-   */
-  uint32_t name_len;
-
-    /**
-   * Length of the referenced value
-   */
-  uint32_t ref_value_len;
-
-
-  // followed by the name and referenced value
-};
-
 #endif
diff --git a/src/util/strings.c b/src/util/strings.c
index 4e7451283..a291dc4e1 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -1897,6 +1897,41 @@ GNUNET_STRINGS_base64_encode (const void *in, size_t 
len, char **output)
 }
 
 
+/**
+ * Encode into Base64url. RFC7515
+ *
+ * @param in the data to encode
+ * @param len the length of the input
+ * @param output where to write the output (*output should be NULL,
+ *   is allocated)
+ * @return the size of the output
+ */
+size_t
+GNUNET_STRINGS_base64url_encode (const void *in, size_t len, char **output)
+{
+  char *enc;
+  size_t pos;
+
+  GNUNET_STRINGS_base64_encode (in, len, output);
+  enc = *output;
+  // Replace with correct characters for base64url
+  pos = 0;
+  while ('\0' != enc[pos])
+  {
+    if ('+' == enc[pos])
+      enc[pos] = '-';
+    if ('/' == enc[pos])
+      enc[pos] = '_';
+    if ('=' == enc[pos])
+    {
+      enc[pos] = '\0';
+      break;
+    }
+    pos++;
+  }
+  return strlen (enc);
+}
+
 #define cvtfind(a)                        \
   ((((a) >= 'A') && ((a) <= 'Z'))         \
    ? (a) - 'A'                          \
@@ -1929,7 +1964,7 @@ GNUNET_STRINGS_base64_decode (const char *data, size_t 
len, void **out)
                 "ignoring CR/LF\n");                              \
     i++;                                                          \
     if (i >= len)                                                 \
-      goto END;                                                   \
+    goto END;                                                   \
   }
 
   output = GNUNET_malloc ((len * 3 / 4) + 8);
@@ -1978,4 +2013,52 @@ END:
 }
 
 
+/**
+ * Decode from Base64url. RFC7515
+ *
+ * @param data the data to decode
+ * @param len the length of the input
+ * @param output where to write the output (*output should be NULL,
+ *   is allocated)
+ * @return the size of the output
+ */
+size_t
+GNUNET_STRINGS_base64url_decode (const char *data, size_t len, void **out)
+{
+  char *s;
+  int padding;
+  size_t ret;
+
+  /* make enough space for padding */
+  s = GNUNET_malloc (len + 3);
+  memcpy (s, data, len);
+
+  for (int i = 0; i < strlen (s); i++)
+  {
+    if (s[i] == '-')
+      s[i] = '+';
+    if (s[i] == '_')
+      s[i] = '/';
+  }
+  padding = len % 4;
+  switch (padding) // Pad with trailing '='s
+  {
+  case 0:
+    break;   // No pad chars in this case
+  case 2:
+    strncpy (&s[len], "==", 2);
+    break;         // Two pad chars
+  case 3:
+    s[len] = '=';
+    break;         // One pad char
+  default:
+    GNUNET_assert (0);
+    break;
+  }
+  ret = GNUNET_STRINGS_base64_decode (s, strlen (s), out);
+  GNUNET_free (s);
+  return ret;
+}
+
+
 /* end of strings.c */

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]