gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated (61625d483 -> e06031377)


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated (61625d483 -> e06031377)
Date: Sun, 14 Apr 2019 10:01:59 +0200

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

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

    from 61625d483 potential fix html block
     new 94f8e5437 RECLAIM: Start move to GNS encryption
     new 947b84dcd RECLAIM: improve help
     new a12b8c2c4 RECLAIM: refactoring; cleanup
     new dfe11b6b5 RECLAIM: Towards -sql
     new 7a923f1b2 RECLAIM: Refactoring
     new 0a6ac0458 RECLAIM: Refactoring
     new 41d086c02 RECLAIM: less unneccessary crypto; syntax and build fixes
     new 38f1f248a RECLAIM: fix cli
     new af90492d9 RECLAIM: refactor revoke
     new eb2d072aa RECLAIM: Simplify logic
     new 48b97768c RECLAIM: remove sqlite plugin; housekeeping
     new e06031377 RECLAIM: debug messages

The 12 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:
 po/POTFILES.in                               |    1 +
 src/Makefile.am                              |   14 +-
 src/include/gnunet_gnsrecord_lib.h           |  142 +-
 src/include/gnunet_reclaim_attribute_lib.h   |   44 +-
 src/include/gnunet_reclaim_service.h         |  272 ++-
 src/reclaim-attribute/reclaim_attribute.c    |   66 +-
 src/reclaim-attribute/reclaim_attribute.h    |    9 +-
 src/reclaim/Makefile.am                      |   44 +-
 src/reclaim/gnunet-reclaim.c                 |  400 ++---
 src/reclaim/gnunet-service-reclaim.c         | 2437 +++++---------------------
 src/reclaim/gnunet-service-reclaim_tickets.c | 1041 +++++++++++
 src/reclaim/gnunet-service-reclaim_tickets.h |  125 ++
 src/reclaim/plugin_gnsrecord_reclaim.c       |  176 +-
 src/reclaim/plugin_reclaim_sqlite.c          |  736 --------
 src/reclaim/reclaim.conf                     |    4 -
 src/reclaim/reclaim.h                        |   15 +-
 src/reclaim/reclaim_api.c                    |  569 +++---
 17 files changed, 2260 insertions(+), 3835 deletions(-)
 create mode 100644 src/reclaim/gnunet-service-reclaim_tickets.c
 create mode 100644 src/reclaim/gnunet-service-reclaim_tickets.h
 delete mode 100644 src/reclaim/plugin_reclaim_sqlite.c

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 000d9939e..5c6a91963 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -283,6 +283,7 @@ 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
diff --git a/src/Makefile.am b/src/Makefile.am
index c1c708aa6..6eaafdeee 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,19 +11,17 @@ endif
 
 if HAVE_EXPERIMENTAL
  EXP_DIR = \
-  rps
+  rps \
+  credential \
+  reclaim-attribute \
+  reclaim
 if HAVE_ABE
-if HAVE_JSON
  EXP_DIR += \
-    abe \
-    credential \
-    reclaim-attribute \
-    reclaim
-endif
+  abe
 endif
 if HAVE_JSON
  EXP_DIR += \
-    auction
+  auction
 endif
 endif
 
diff --git a/src/include/gnunet_gnsrecord_lib.h 
b/src/include/gnunet_gnsrecord_lib.h
index 7c25bdf15..a92cdc2e7 100644
--- a/src/include/gnunet_gnsrecord_lib.h
+++ b/src/include/gnunet_gnsrecord_lib.h
@@ -11,7 +11,7 @@
      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/>.
 
@@ -35,9 +35,8 @@
 #define GNUNET_GNSRECORD_LIB_H
 
 #ifdef __cplusplus
-extern "C"
-{
-#if 0                           /* keep Emacsens' auto-indent happy */
+extern "C" {
+#if 0 /* keep Emacsens' auto-indent happy */
 }
 #endif
 #endif
@@ -94,19 +93,18 @@ extern "C"
 #define GNUNET_GNSRECORD_TYPE_PHONE 65543
 
 /**
- * Record type for identity attributes (of IDENTITY).
+ * Record type for identity attributes (of RECLAIM).
  */
-#define GNUNET_GNSRECORD_TYPE_ID_ATTR 65544
+#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR 65544
 
 /**
- * Record type for an identity token (of IDENTITY-TOKEN).
+ * Record type for local ticket references
  */
-#define GNUNET_GNSRECORD_TYPE_ID_TOKEN 65545
+#define GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET 65545
 
 /**
- * Record type for the private metadata of an identity token (of 
IDENTITY-TOKEN).
+ * 65546 reserved
  */
-#define GNUNET_GNSRECORD_TYPE_ID_TOKEN_METADATA 65546
 
 /**
  * Record type for credential
@@ -124,14 +122,14 @@ extern "C"
 #define GNUNET_GNSRECORD_TYPE_ATTRIBUTE 65549
 
 /**
- * Record type for ABE records
+ * Record type for reclaim records
  */
-#define GNUNET_GNSRECORD_TYPE_ABE_KEY 65550
+#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF 65550
 
 /**
- * Record type for ABE master keys
+ * Record type for RECLAIM master
  */
-#define GNUNET_GNSRECORD_TYPE_ABE_MASTER 65551
+#define GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER 65551
 
 /**
  * Record type for reclaim OIDC clients
@@ -146,8 +144,7 @@ extern "C"
 /**
  * Flags that can be set for a record.
  */
-enum GNUNET_GNSRECORD_Flags
-{
+enum GNUNET_GNSRECORD_Flags {
 
   /**
    * No special options.
@@ -178,17 +175,17 @@ enum GNUNET_GNSRECORD_Flags
    */
   GNUNET_GNSRECORD_RF_SHADOW_RECORD = 16
 
-  /**
-   * When comparing flags for record equality for removal,
-   * which flags should must match (in addition to the type,
-   * name, expiration value and data of the record)?  All flags
-   * that are not listed here will be ignored for this purpose.
-   * (for example, we don't expect that users will remember to
-   * pass the '--private' option when removing a record from
-   * the namestore, hence we don't require this particular option
-   * to match upon removal).  See also
-   * #GNUNET_GNSRECORD_records_cmp.
-   */
+/**
+ * When comparing flags for record equality for removal,
+ * which flags should must match (in addition to the type,
+ * name, expiration value and data of the record)?  All flags
+ * that are not listed here will be ignored for this purpose.
+ * (for example, we don't expect that users will remember to
+ * pass the '--private' option when removing a record from
+ * the namestore, hence we don't require this particular option
+ * to match upon removal).  See also
+ * #GNUNET_GNSRECORD_records_cmp.
+ */
 #define GNUNET_GNSRECORD_RF_RCMP_FLAGS 
(GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)
 };
 
@@ -196,8 +193,7 @@ enum GNUNET_GNSRECORD_Flags
 /**
  * A GNS record.
  */
-struct GNUNET_GNSRECORD_Data
-{
+struct GNUNET_GNSRECORD_Data {
 
   /**
    * Binary value stored in the DNS record.  Note: "data" must never
@@ -235,8 +231,7 @@ GNUNET_NETWORK_STRUCT_BEGIN
 /**
  * Data stored in a PLACE record.
  */
-struct GNUNET_GNSRECORD_PlaceData
-{
+struct GNUNET_GNSRECORD_PlaceData {
   /**
    * Public key of the place.
    */
@@ -259,8 +254,7 @@ struct GNUNET_GNSRECORD_PlaceData
 /**
  * Information we have in an encrypted block with record data (i.e. in the 
DHT).
  */
-struct GNUNET_GNSRECORD_Block
-{
+struct GNUNET_GNSRECORD_Block {
 
   /**
    * Signature of the block.
@@ -297,8 +291,7 @@ struct GNUNET_GNSRECORD_Block
  * records do not require a separate network request, thus making TLSA
  * records inseparable from the "main" A/AAAA/VPN/etc. records.
  */
-struct GNUNET_GNSRECORD_BoxRecord
-{
+struct GNUNET_GNSRECORD_BoxRecord {
 
   /**
    * Protocol of the boxed record (6 = TCP, 17 = UDP, etc.).
@@ -317,7 +310,6 @@ struct GNUNET_GNSRECORD_BoxRecord
   uint32_t record_type GNUNET_PACKED;
 
   /* followed by the 'original' record */
-
 };
 
 /**
@@ -327,8 +319,7 @@ struct GNUNET_GNSRECORD_BoxRecord
  * the namespace the record belongs to.
  * It is exclusively found under the label ``+''.
  */
-struct GNUNET_GNSRECORD_ReverseRecord
-{
+struct GNUNET_GNSRECORD_ReverseRecord {
   /**
    * The public key of the namespace the is delegating to our namespace
    */
@@ -352,11 +343,8 @@ GNUNET_NETWORK_STRUCT_END
  * @param rd_count number of entries in @a rd array
  * @param rd array of records with data to store
  */
-typedef void
-(*GNUNET_GNSRECORD_RecordCallback) (void *cls,
-                                    unsigned int rd_count,
-                                    const struct GNUNET_GNSRECORD_Data *rd);
-
+typedef void (*GNUNET_GNSRECORD_RecordCallback) (
+    void *cls, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd);
 
 
 /* ***************** API related to GNSRECORD plugins ************** */
@@ -371,9 +359,8 @@ typedef void
  * @return NULL on error, otherwise human-readable representation of the value
  */
 char *
-GNUNET_GNSRECORD_value_to_string (uint32_t type,
-                                 const void *data,
-                                 size_t data_size);
+GNUNET_GNSRECORD_value_to_string (uint32_t type, const void *data,
+                                  size_t data_size);
 
 
 /**
@@ -387,10 +374,8 @@ GNUNET_GNSRECORD_value_to_string (uint32_t type,
  * @return #GNUNET_OK on success
  */
 int
-GNUNET_GNSRECORD_string_to_value (uint32_t type,
-                                 const char *s,
-                                 void **data,
-                                 size_t *data_size);
+GNUNET_GNSRECORD_string_to_value (uint32_t type, const char *s, void **data,
+                                  size_t *data_size);
 
 
 /**
@@ -425,7 +410,7 @@ GNUNET_GNSRECORD_number_to_typename (uint32_t type);
  */
 ssize_t
 GNUNET_GNSRECORD_records_get_size (unsigned int rd_count,
-                                  const struct GNUNET_GNSRECORD_Data *rd);
+                                   const struct GNUNET_GNSRECORD_Data *rd);
 
 
 /**
@@ -439,9 +424,8 @@ GNUNET_GNSRECORD_records_get_size (unsigned int rd_count,
  */
 ssize_t
 GNUNET_GNSRECORD_records_serialize (unsigned int rd_count,
-                                   const struct GNUNET_GNSRECORD_Data *rd,
-                                   size_t dest_size,
-                                   char *dest);
+                                    const struct GNUNET_GNSRECORD_Data *rd,
+                                    size_t dest_size, char *dest);
 
 
 /**
@@ -454,16 +438,14 @@ GNUNET_GNSRECORD_records_serialize (unsigned int rd_count,
  * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
  */
 int
-GNUNET_GNSRECORD_records_deserialize (size_t len,
-                                     const char *src,
-                                     unsigned int rd_count,
-                                     struct GNUNET_GNSRECORD_Data *dest);
+GNUNET_GNSRECORD_records_deserialize (size_t len, const char *src,
+                                      unsigned int rd_count,
+                                      struct GNUNET_GNSRECORD_Data *dest);
 
 
 /* ******* general APIs relating to blocks, records and labels ******** */
 
 
-
 /**
  * Test if a given record is expired.
  *
@@ -490,7 +472,8 @@ GNUNET_GNSRECORD_string_to_lowercase (const char *src);
  * NOT reentrant!
  *
  * @param z public key of a zone
- * @return string form; will be overwritten by next call to 
#GNUNET_GNSRECORD_z2s.
+ * @return string form; will be overwritten by next call to
+ * #GNUNET_GNSRECORD_z2s.
  */
 const char *
 GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_EcdsaPublicKey *z);
@@ -521,7 +504,7 @@ GNUNET_GNSRECORD_pkey_to_zkey (const struct 
GNUNET_CRYPTO_EcdsaPublicKey *pkey);
  */
 int
 GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey,
-                              struct GNUNET_CRYPTO_EcdsaPublicKey *pkey);
+                               struct GNUNET_CRYPTO_EcdsaPublicKey *pkey);
 
 
 /**
@@ -532,9 +515,9 @@ GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey,
  * @param query hash to use for the query
  */
 void
-GNUNET_GNSRECORD_query_from_private_key (const struct 
GNUNET_CRYPTO_EcdsaPrivateKey *zone,
-                                        const char *label,
-                                        struct GNUNET_HashCode *query);
+GNUNET_GNSRECORD_query_from_private_key (
+    const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label,
+    struct GNUNET_HashCode *query);
 
 
 /**
@@ -545,9 +528,9 @@ GNUNET_GNSRECORD_query_from_private_key (const struct 
GNUNET_CRYPTO_EcdsaPrivate
  * @param query hash to use for the query
  */
 void
-GNUNET_GNSRECORD_query_from_public_key (const struct 
GNUNET_CRYPTO_EcdsaPublicKey *pub,
-                                       const char *label,
-                                       struct GNUNET_HashCode *query);
+GNUNET_GNSRECORD_query_from_public_key (
+    const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, const char *label,
+    struct GNUNET_HashCode *query);
 
 
 /**
@@ -561,10 +544,10 @@ GNUNET_GNSRECORD_query_from_public_key (const struct 
GNUNET_CRYPTO_EcdsaPublicKe
  */
 struct GNUNET_GNSRECORD_Block *
 GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
-                              struct GNUNET_TIME_Absolute expire,
-                              const char *label,
-                              const struct GNUNET_GNSRECORD_Data *rd,
-                              unsigned int rd_count);
+                               struct GNUNET_TIME_Absolute expire,
+                               const char *label,
+                               const struct GNUNET_GNSRECORD_Data *rd,
+                               unsigned int rd_count);
 
 
 /**
@@ -609,11 +592,10 @@ GNUNET_GNSRECORD_block_verify (const struct 
GNUNET_GNSRECORD_Block *block);
  *        not well-formed
  */
 int
-GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block,
-                               const struct GNUNET_CRYPTO_EcdsaPublicKey 
*zone_key,
-                               const char *label,
-                               GNUNET_GNSRECORD_RecordCallback proc,
-                               void *proc_cls);
+GNUNET_GNSRECORD_block_decrypt (
+    const struct GNUNET_GNSRECORD_Block *block,
+    const struct GNUNET_CRYPTO_EcdsaPublicKey *zone_key, const char *label,
+    GNUNET_GNSRECORD_RecordCallback proc, void *proc_cls);
 
 
 /**
@@ -638,11 +620,11 @@ GNUNET_GNSRECORD_records_cmp (const struct 
GNUNET_GNSRECORD_Data *a,
  * @return absolute expiration time
  */
 struct GNUNET_TIME_Absolute
-GNUNET_GNSRECORD_record_get_expiration_time (unsigned int rd_count,
-                                            const struct GNUNET_GNSRECORD_Data 
*rd);
+GNUNET_GNSRECORD_record_get_expiration_time (
+    unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd);
 
 
-#if 0                           /* keep Emacsens' auto-indent happy */
+#if 0 /* keep Emacsens' auto-indent happy */
 {
 #endif
 #ifdef __cplusplus
@@ -651,4 +633,4 @@ GNUNET_GNSRECORD_record_get_expiration_time (unsigned int 
rd_count,
 
 #endif
 
-/** @} */  /* end of group */
+/** @} */ /* end of group */
diff --git a/src/include/gnunet_reclaim_attribute_lib.h 
b/src/include/gnunet_reclaim_attribute_lib.h
index 1f26927b2..db009da3f 100644
--- a/src/include/gnunet_reclaim_attribute_lib.h
+++ b/src/include/gnunet_reclaim_attribute_lib.h
@@ -11,7 +11,7 @@
      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/>.
 
@@ -59,10 +59,9 @@ extern "C"
 struct GNUNET_RECLAIM_ATTRIBUTE_Claim
 {
   /**
-   * The name of the attribute. Note "name" must never be individually
-   * free'd
+   * ID
    */
-  const char* name;
+  uint64_t id;
 
   /**
    * Type of Claim
@@ -73,6 +72,11 @@ struct GNUNET_RECLAIM_ATTRIBUTE_Claim
    * Version
    */
   uint32_t version;
+  /**
+   * The name of the attribute. Note "name" must never be individually
+   * free'd
+   */
+  const char* name;
 
   /**
    * Number of bytes in @e data.
@@ -130,9 +134,9 @@ struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry
  */
 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *
 GNUNET_RECLAIM_ATTRIBUTE_claim_new (const char* attr_name,
-                                     uint32_t type,
-                                     const void* data,
-                                     size_t data_size);
+                                    uint32_t type,
+                                    const void* data,
+                                    size_t data_size);
 
 
 /**
@@ -150,10 +154,10 @@ GNUNET_RECLAIM_ATTRIBUTE_list_destroy (struct 
GNUNET_RECLAIM_ATTRIBUTE_ClaimList
 
 void
 GNUNET_RECLAIM_ATTRIBUTE_list_add (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList 
*attrs,
-                                   const char* attr_name,
-                                   uint32_t type,
-                                   const void* data,
-                                   size_t data_size);
+                                   const char* attr_name,
+                                   uint32_t type,
+                                   const void* data,
+                                   size_t data_size);
 
 /**
  * Serialize an attribute list
@@ -165,7 +169,7 @@ GNUNET_RECLAIM_ATTRIBUTE_list_add (struct 
GNUNET_RECLAIM_ATTRIBUTE_ClaimList *at
  */
 size_t
 GNUNET_RECLAIM_ATTRIBUTE_list_serialize (const struct 
GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
-                     char *result);
+                                         char *result);
 
 /**
  * Deserialize an attribute list
@@ -177,7 +181,7 @@ GNUNET_RECLAIM_ATTRIBUTE_list_serialize (const struct 
GNUNET_RECLAIM_ATTRIBUTE_C
  */
 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *
 GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (const char* data,
-                            size_t data_size);
+                                           size_t data_size);
 
 
 /**
@@ -202,7 +206,7 @@ GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (const struct 
GNUNET_RECLAIM_ATTRIBU
  */
 size_t
 GNUNET_RECLAIM_ATTRIBUTE_serialize (const struct 
GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-                     char *result);
+                                    char *result);
 
 /**
  * Deserialize an attribute
@@ -214,7 +218,7 @@ GNUNET_RECLAIM_ATTRIBUTE_serialize (const struct 
GNUNET_RECLAIM_ATTRIBUTE_Claim
  */
 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *
 GNUNET_RECLAIM_ATTRIBUTE_deserialize (const char* data,
-                       size_t data_size);
+                                      size_t data_size);
 
 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList*
 GNUNET_RECLAIM_ATTRIBUTE_list_dup (const struct 
GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
@@ -240,9 +244,9 @@ GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (const char 
*typename);
  */
 int
 GNUNET_RECLAIM_ATTRIBUTE_string_to_value (uint32_t type,
-                                           const char *s,
-                                           void **data,
-                                           size_t *data_size);
+                                          const char *s,
+                                          void **data,
+                                          size_t *data_size);
 
 /**
  * Convert the 'claim' of an attribute to a string
@@ -254,8 +258,8 @@ GNUNET_RECLAIM_ATTRIBUTE_string_to_value (uint32_t type,
  */
 char *
 GNUNET_RECLAIM_ATTRIBUTE_value_to_string (uint32_t type,
-                                           const void* data,
-                                           size_t data_size);
+                                          const void* data,
+                                          size_t data_size);
 
 /**
  * Convert a type number to the corresponding type string
diff --git a/src/include/gnunet_reclaim_service.h 
b/src/include/gnunet_reclaim_service.h
index 3029e1f4d..d179485bb 100644
--- a/src/include/gnunet_reclaim_service.h
+++ b/src/include/gnunet_reclaim_service.h
@@ -11,7 +11,7 @@
      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/>.
 
@@ -31,43 +31,47 @@
 #define GNUNET_RECLAIM_SERVICE_H
 
 #ifdef __cplusplus
-extern "C"
-{
-#if 0                           /* keep Emacsens' auto-indent happy */
+extern "C" {
+#if 0 /* keep Emacsens' auto-indent happy */
 }
 #endif
 #endif
 
-#include "gnunet_util_lib.h"
 #include "gnunet_reclaim_attribute_lib.h"
+#include "gnunet_util_lib.h"
 
 /**
- * Version number of GNUnet Identity Provider API.
+ * Version number of the re:claimID API.
  */
 #define GNUNET_RECLAIM_VERSION 0x00000000
 
 /**
- * Handle to access the identity service.
+ * Opaque handle to access the service.
  */
 struct GNUNET_RECLAIM_Handle;
 
+
 /**
- * Handle for a token.
+ * Opaque handle for an operation at the re:claimID service.
  */
-struct GNUNET_RECLAIM_Token;
+struct GNUNET_RECLAIM_Operation;
+
 
 /**
- * The ticket
+ * The an authorization ticket. This ticket is meant to be transferred
+ * out of band the a relying party.
+ * The contents of a ticket must be protected and should be treated as a
+ * SHARED SECRET between user and relying party.
  */
 struct GNUNET_RECLAIM_Ticket
 {
   /**
-   * The ticket issuer
+   * The ticket issuer (= the user)
    */
   struct GNUNET_CRYPTO_EcdsaPublicKey identity;
 
   /**
-   * The ticket audience
+   * The ticket audience (= relying party)
    */
   struct GNUNET_CRYPTO_EcdsaPublicKey audience;
 
@@ -77,74 +81,77 @@ struct GNUNET_RECLAIM_Ticket
   uint64_t rnd;
 };
 
-/**
- * Handle for an operation with the identity provider service.
- */
-struct GNUNET_RECLAIM_Operation;
-
 
 /**
- * Connect to the identity provider service.
+ * Method called when a token has been issued.
+ * On success returns a ticket that can be given to the relying party to 
retrive
+ * the token
  *
- * @param cfg Configuration to contact the identity provider service.
- * @return handle to communicate with identity provider service
+ * @param cls closure
+ * @param ticket the ticket
  */
-struct GNUNET_RECLAIM_Handle *
-GNUNET_RECLAIM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
+typedef void (*GNUNET_RECLAIM_TicketCallback) (
+    void *cls, const struct GNUNET_RECLAIM_Ticket *ticket);
+
 
 /**
  * Continuation called to notify client about result of the
  * operation.
  *
- * @param cls closure
- * @param success #GNUNET_SYSERR on failure (including timeout/queue 
drop/failure to validate)
- *                #GNUNET_NO if content was already there or not found
- *                #GNUNET_YES (or other positive value) on success
+ * @param cls The callback closure
+ * @param success #GNUNET_SYSERR on failure
  * @param emsg NULL on success, otherwise an error message
  */
-typedef void
-(*GNUNET_RECLAIM_ContinuationWithStatus) (void *cls,
-                                            int32_t success,
-                                            const char *emsg);
+typedef void (*GNUNET_RECLAIM_ContinuationWithStatus) (void *cls,
+                                                       int32_t success,
+                                                       const char *emsg);
 
 
 /**
- * Store an attribute.  If the attribute is already present,
- * it is replaced with the new attribute.
+ * Callback used to notify the client of attribute results.
  *
- * @param h handle to the identity provider
- * @param pkey private key of the identity
- * @param attr the attribute
- * @param exp_interval the relative expiration interval for the attribute
- * @param cont continuation to call when done
- * @param cont_cls closure for @a cont
- * @return handle to abort the request
+ * @param cls The callback closure
+ * @param identity The identity authoritative over the attributes
+ * @param attr The attribute
  */
-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_TIME_Relative 
*exp_interval,
-                                          
GNUNET_RECLAIM_ContinuationWithStatus cont,
-                                          void *cont_cls);
+typedef void (*GNUNET_RECLAIM_AttributeResult) (
+    void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
+    const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr);
 
 
 /**
- * Process an attribute that was stored in the idp.
+ * Connect to the re:claimID service.
  *
- * @param cls closure
- * @param identity the identity
- * @param attr the attribute
+ * @param cfg Configuration to contact the re:claimID service.
+ * @return handle to communicate with the service
  */
-typedef void
-(*GNUNET_RECLAIM_AttributeResult) (void *cls,
-                                   const struct GNUNET_CRYPTO_EcdsaPublicKey 
*identity,
-                                   const struct GNUNET_RECLAIM_ATTRIBUTE_Claim 
*attr);
+struct GNUNET_RECLAIM_Handle *
+GNUNET_RECLAIM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
+
 
+/**
+ * Store an attribute.  If the attribute is already present,
+ * it is replaced with the new attribute.
+ *
+ * @param h handle to the re:claimID service
+ * @param pkey Private key of the identity to add an attribute to
+ * @param attr The attribute
+ * @param exp_interval The relative expiration interval for the attribute
+ * @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_attribute_store (
+    struct GNUNET_RECLAIM_Handle *h,
+    const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
+    const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
+    const struct GNUNET_TIME_Relative *exp_interval,
+    GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls);
 
 
 /**
- * List all attributes for a local identity. 
+ * List all attributes for a local identity.
  * This MUST lock the `struct GNUNET_RECLAIM_Handle`
  * for any other calls than #GNUNET_RECLAIM_get_attributes_next() and
  * #GNUNET_RECLAIM_get_attributes_stop. @a proc will be called once
@@ -155,87 +162,76 @@ typedef void
  * On normal completion, @a finish_cb proc will be
  * invoked.
  *
- * @param h handle to the idp
- * @param identity identity to access
- * @param error_cb function to call on error (i.e. disconnect),
+ * @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 attribute; it
- *        will be called repeatedly with a value (if available)
- * @param proc_cls closure for @a proc
- * @param finish_cb function to call on completion
+ * @param error_cb_cls Closure for @a error_cb
+ * @param proc Function to call on each attribute
+ * @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
+ * @param finish_cb_cls Closure for @a finish_cb
+ * @return an iterator Handle to use for iteration
  */
 struct GNUNET_RECLAIM_AttributeIterator *
-GNUNET_RECLAIM_get_attributes_start (struct GNUNET_RECLAIM_Handle *h,
-                                               const struct 
GNUNET_CRYPTO_EcdsaPrivateKey *identity,
-                                               GNUNET_SCHEDULER_TaskCallback 
error_cb,
-                                               void *error_cb_cls,
-                                               GNUNET_RECLAIM_AttributeResult 
proc,
-                                               void *proc_cls,
-                                               GNUNET_SCHEDULER_TaskCallback 
finish_cb,
-                                               void *finish_cb_cls);
+GNUNET_RECLAIM_get_attributes_start (
+    struct GNUNET_RECLAIM_Handle *h,
+    const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
+    GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls,
+    GNUNET_RECLAIM_AttributeResult proc, void *proc_cls,
+    GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls);
 
 
 /**
  * Calls the record processor specified in #GNUNET_RECLAIM_get_attributes_start
  * for the next record.
  *
- * @param it the iterator
+ * @param it The iterator
  */
 void
-GNUNET_RECLAIM_get_attributes_next (struct GNUNET_RECLAIM_AttributeIterator 
*it);
+GNUNET_RECLAIM_get_attributes_next (
+    struct GNUNET_RECLAIM_AttributeIterator *it);
 
 
 /**
- * Stops iteration and releases the idp handle for further calls.  Must
+ * 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_attributes_stop (struct GNUNET_RECLAIM_AttributeIterator 
*it);
+GNUNET_RECLAIM_get_attributes_stop (
+    struct GNUNET_RECLAIM_AttributeIterator *it);
 
 
 /**
- * Method called when a token has been issued.
- * On success returns a ticket that can be given to the audience to retrive the
- * token
- *
- * @param cls closure
- * @param ticket the ticket
- */
-typedef void
-(*GNUNET_RECLAIM_TicketCallback)(void *cls,
-                            const struct GNUNET_RECLAIM_Ticket *ticket);
-
-/**
- * Issues a ticket to another identity. The identity may use
+ * Issues a ticket to a relying party. The identity may use
  * GNUNET_RECLAIM_ticket_consume to consume the ticket
- * and retrieve the attributes specified in the AttributeList.
+ * and retrieve the attributes specified in the attribute list.
  *
  * @param h the identity provider to use
- * @param iss the issuing identity
- * @param rp the subject of the ticket (the relying party)
+ * @param iss the issuing identity (= the user)
+ * @param rp the subject of the ticket (= the relying party)
  * @param attrs the attributes that the relying party is given access to
  * @param cb the callback
  * @param cb_cls the callback closure
  * @return handle to abort the operation
  */
 struct GNUNET_RECLAIM_Operation *
-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,
-                                       GNUNET_RECLAIM_TicketCallback cb,
-                                       void *cb_cls);
+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,
+    GNUNET_RECLAIM_TicketCallback cb, void *cb_cls);
 
 /**
  * Revoked an issued ticket. The relying party will be unable to retrieve
- * updated attributes.
+ * attributes. Other issued tickets remain unaffected.
+ * This includes tickets issued to other relying parties as well as to
+ * other tickets issued to the audience specified in this ticket.
  *
  * @param h the identity provider to use
  * @param identity the issuing identity
@@ -245,31 +241,31 @@ GNUNET_RECLAIM_ticket_issue (struct GNUNET_RECLAIM_Handle 
*h,
  * @return handle to abort the operation
  */
 struct GNUNET_RECLAIM_Operation *
-GNUNET_RECLAIM_ticket_revoke (struct GNUNET_RECLAIM_Handle *h,
-                                        const struct 
GNUNET_CRYPTO_EcdsaPrivateKey *identity,
-                                        const struct GNUNET_RECLAIM_Ticket 
*ticket,
-                                        GNUNET_RECLAIM_ContinuationWithStatus 
cb,
-                                        void *cb_cls);
-
+GNUNET_RECLAIM_ticket_revoke (
+    struct GNUNET_RECLAIM_Handle *h,
+    const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
+    const struct GNUNET_RECLAIM_Ticket *ticket,
+    GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls);
 
 
 /**
- * Consumes an issued ticket. The ticket is persisted
- * and used to retrieve identity information from the issuer
+ * Consumes an issued ticket. The ticket is used to retrieve identity
+ * information from the issuer
  *
  * @param h the identity provider to use
- * @param identity the identity that is the subject of the issued ticket (the 
audience)
+ * @param identity the identity that is the subject of the issued ticket (the
+ * relying party)
  * @param ticket the issued ticket to consume
  * @param cb the callback to call
  * @param cb_cls the callback closure
  * @return handle to abort the operation
  */
 struct GNUNET_RECLAIM_Operation *
-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_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);
 
 /**
  * Lists all tickets that have been issued to remote
@@ -289,45 +285,17 @@ GNUNET_RECLAIM_ticket_consume (struct 
GNUNET_RECLAIM_Handle *h,
  * @return an iterator handle to use for iteration
  */
 struct GNUNET_RECLAIM_TicketIterator *
-GNUNET_RECLAIM_ticket_iteration_start (struct GNUNET_RECLAIM_Handle *h,
-                                                 const struct 
GNUNET_CRYPTO_EcdsaPrivateKey *identity,
-                                                 GNUNET_SCHEDULER_TaskCallback 
error_cb,
-                                                 void *error_cb_cls,
-                                                 GNUNET_RECLAIM_TicketCallback 
proc,
-                                                 void *proc_cls,
-                                                 GNUNET_SCHEDULER_TaskCallback 
finish_cb,
-                                                 void *finish_cb_cls);
+GNUNET_RECLAIM_ticket_iteration_start (
+    struct GNUNET_RECLAIM_Handle *h,
+    const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
+    GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls,
+    GNUNET_RECLAIM_TicketCallback proc, void *proc_cls,
+    GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls);
 
-/**
- * Lists all tickets that have been issued to remote
- * identites (relying parties)
- *
- * @param h the identity provider to use
- * @param identity the issuing identity
- * @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 ticket; it
- *        will be called repeatedly with a value (if available)
- * @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_TicketIterator *
-GNUNET_RECLAIM_ticket_iteration_start_rp (struct GNUNET_RECLAIM_Handle *h,
-                                                    const struct 
GNUNET_CRYPTO_EcdsaPublicKey *identity,
-                                                    
GNUNET_SCHEDULER_TaskCallback error_cb,
-                                                    void *error_cb_cls,
-                                                    
GNUNET_RECLAIM_TicketCallback proc,
-                                                    void *proc_cls,
-                                                    
GNUNET_SCHEDULER_TaskCallback finish_cb,
-                                                    void *finish_cb_cls);
 
 /**
- * Calls the record processor specified in 
#GNUNET_RECLAIM_ticket_iteration_start
- * for the next record.
+ * Calls the ticket processor specified in
+ * #GNUNET_RECLAIM_ticket_iteration_start for the next record.
  *
  * @param it the iterator
  */
@@ -335,7 +303,7 @@ void
 GNUNET_RECLAIM_ticket_iteration_next (struct GNUNET_RECLAIM_TicketIterator 
*it);
 
 /**
- * Stops iteration and releases the idp handle for further calls.  Must
+ * 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.
  *
@@ -364,7 +332,7 @@ GNUNET_RECLAIM_disconnect (struct GNUNET_RECLAIM_Handle *h);
 void
 GNUNET_RECLAIM_cancel (struct GNUNET_RECLAIM_Operation *op);
 
-#if 0                           /* keep Emacsens' auto-indent happy */
+#if 0 /* keep Emacsens' auto-indent happy */
 {
 #endif
 #ifdef __cplusplus
diff --git a/src/reclaim-attribute/reclaim_attribute.c 
b/src/reclaim-attribute/reclaim_attribute.c
index a5520cbcf..86f0f8f67 100644
--- a/src/reclaim-attribute/reclaim_attribute.c
+++ b/src/reclaim-attribute/reclaim_attribute.c
@@ -11,7 +11,7 @@
       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/>.
 
@@ -104,7 +104,7 @@ 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++)
   {
@@ -152,9 +152,9 @@ GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (uint32_t type)
  */
 int
 GNUNET_RECLAIM_ATTRIBUTE_string_to_value (uint32_t type,
-                                           const char *s,
-                                           void **data,
-                                           size_t *data_size)
+                                          const char *s,
+                                          void **data,
+                                          size_t *data_size)
 {
   unsigned int i;
   struct Plugin *plugin;
@@ -183,8 +183,8 @@ GNUNET_RECLAIM_ATTRIBUTE_string_to_value (uint32_t type,
  */
 char *
 GNUNET_RECLAIM_ATTRIBUTE_value_to_string (uint32_t type,
-                                           const void* data,
-                                           size_t data_size)
+                                          const void* data,
+                                          size_t data_size)
 {
   unsigned int i;
   struct Plugin *plugin;
@@ -214,9 +214,9 @@ GNUNET_RECLAIM_ATTRIBUTE_value_to_string (uint32_t type,
  */
 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *
 GNUNET_RECLAIM_ATTRIBUTE_claim_new (const char* attr_name,
-               uint32_t type,
-               const void* data,
-               size_t data_size)
+                                    uint32_t type,
+                                    const void* data,
+                                    size_t data_size)
 {
   struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr;
   char *write_ptr;
@@ -256,20 +256,20 @@ GNUNET_RECLAIM_ATTRIBUTE_claim_new (const char* attr_name,
  */
 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)
+                                   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);
+                                                  type,
+                                                  data,
+                                                  data_size);
   GNUNET_CONTAINER_DLL_insert (claim_list->list_head,
-                              claim_list->list_tail,
-                              le);
+                               claim_list->list_tail,
+                               le);
 }
 
 size_t
@@ -279,12 +279,12 @@ GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (const 
struct GNUNET_RECLAIM_AT
   size_t len = 0;
   for (le = attrs->list_head; NULL != le; le = le->next)
     len += GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (le->claim);
-  return len; 
+  return len;
 }
 
 size_t
 GNUNET_RECLAIM_ATTRIBUTE_list_serialize (const struct 
GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
-                          char *result)
+                                         char *result)
 {
   struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
   size_t len;
@@ -296,7 +296,7 @@ GNUNET_RECLAIM_ATTRIBUTE_list_serialize (const struct 
GNUNET_RECLAIM_ATTRIBUTE_C
   for (le = attrs->list_head; NULL != le; le = le->next)
   {
     len = GNUNET_RECLAIM_ATTRIBUTE_serialize (le->claim,
-                               write_ptr);
+                                              write_ptr);
     total_len += len;
     write_ptr += len;
   }
@@ -305,7 +305,7 @@ GNUNET_RECLAIM_ATTRIBUTE_list_serialize (const struct 
GNUNET_RECLAIM_ATTRIBUTE_C
 
 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *
 GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (const char* data,
-                       size_t data_size)
+                                           size_t data_size)
 {
   struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
   struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
@@ -314,7 +314,7 @@ GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (const char* data,
 
   if (data_size < sizeof (struct Attribute))
     return NULL;
-  
+
   attrs = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
   read_ptr = data;
   while (((data + data_size) - read_ptr) >= sizeof (struct Attribute))
@@ -322,7 +322,7 @@ GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (const char* data,
 
     le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
     le->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize (read_ptr,
-                                           data_size - (read_ptr - data));
+                                                      data_size - (read_ptr - 
data));
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Deserialized attribute %s\n", le->claim->name);
     GNUNET_CONTAINER_DLL_insert (attrs->list_head,
@@ -346,9 +346,11 @@ GNUNET_RECLAIM_ATTRIBUTE_list_dup (const struct 
GNUNET_RECLAIM_ATTRIBUTE_ClaimLi
   {
     result_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
     result_le->claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (le->claim->name,
-                                                     le->claim->type,
-                                                     le->claim->data,
-                                                     le->claim->data_size);
+                                                           le->claim->type,
+                                                           le->claim->data,
+                                                           
le->claim->data_size);
+    result_le->claim->version = le->claim->version;
+    result_le->claim->id = le->claim->id;
     GNUNET_CONTAINER_DLL_insert (result->list_head,
                                  result->list_tail,
                                  result_le);
@@ -377,14 +379,14 @@ GNUNET_RECLAIM_ATTRIBUTE_list_destroy (struct 
GNUNET_RECLAIM_ATTRIBUTE_ClaimList
 size_t
 GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (const struct 
GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
 {
-  return sizeof (struct Attribute) 
+  return sizeof (struct Attribute)
     + strlen (attr->name)
     + attr->data_size;
 }
 
 size_t
 GNUNET_RECLAIM_ATTRIBUTE_serialize (const struct 
GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-                     char *result)
+                                    char *result)
 {
   size_t data_len_ser;
   size_t name_len;
@@ -394,6 +396,7 @@ GNUNET_RECLAIM_ATTRIBUTE_serialize (const struct 
GNUNET_RECLAIM_ATTRIBUTE_Claim
   attr_ser = (struct Attribute*)result;
   attr_ser->attribute_type = htons (attr->type);
   attr_ser->attribute_version = htonl (attr->version);
+  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];
@@ -411,7 +414,7 @@ GNUNET_RECLAIM_ATTRIBUTE_serialize (const struct 
GNUNET_RECLAIM_ATTRIBUTE_Claim
 
 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *
 GNUNET_RECLAIM_ATTRIBUTE_deserialize (const char* data,
-                       size_t data_size)
+                                      size_t data_size)
 {
   struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr;
   struct Attribute *attr_ser;
@@ -429,6 +432,7 @@ GNUNET_RECLAIM_ATTRIBUTE_deserialize (const char* data,
                         + data_len + name_len + 1);
   attr->type = ntohs (attr_ser->attribute_type);
   attr->version = ntohl (attr_ser->attribute_version);
+  attr->id = GNUNET_ntohll (attr_ser->attribute_id);
   attr->data_size = ntohs (attr_ser->data_size);
 
   write_ptr =  (char*)&attr[1];
diff --git a/src/reclaim-attribute/reclaim_attribute.h 
b/src/reclaim-attribute/reclaim_attribute.h
index 43228f5c3..773d39c5a 100644
--- a/src/reclaim-attribute/reclaim_attribute.h
+++ b/src/reclaim-attribute/reclaim_attribute.h
@@ -11,7 +11,7 @@
    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/>.
 
@@ -40,11 +40,16 @@ struct Attribute
    */
   uint32_t attribute_version;
 
+  /**
+   * Attribute ID
+   */
+  uint64_t attribute_id;
+
   /**
    * Name length
    */
   uint32_t name_len;
-  
+
   /**
    * Data size
    */
diff --git a/src/reclaim/Makefile.am b/src/reclaim/Makefile.am
index be50cce26..67d640357 100644
--- a/src/reclaim/Makefile.am
+++ b/src/reclaim/Makefile.am
@@ -12,9 +12,6 @@ if USE_COVERAGE
   XLIB = -lgcov
 endif
 
-if HAVE_SQLITE
-SQLITE_PLUGIN = libgnunet_plugin_reclaim_sqlite.la
-endif
 
 if HAVE_MHD
 if HAVE_JSON
@@ -41,7 +38,6 @@ lib_LTLIBRARIES = \
   libgnunetreclaim.la
 plugin_LTLIBRARIES = \
   libgnunet_plugin_gnsrecord_reclaim.la \
-  $(SQLITE_PLUGIN) \
   $(REST_PLUGIN)
 
 bin_PROGRAMS = \
@@ -93,30 +89,16 @@ libgnunet_plugin_gnsrecord_reclaim_la_LIBADD = \
 libgnunet_plugin_gnsrecord_reclaim_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
 
-libgnunet_plugin_reclaim_sqlite_la_SOURCES = \
-  plugin_reclaim_sqlite.c
-libgnunet_plugin_reclaim_sqlite_la_LIBADD = \
-  libgnunetreclaim.la  \
-  $(top_builddir)/src/sq/libgnunetsq.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-       $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3 \
-  $(LTLIBINTL)
-libgnunet_plugin_reclaim_sqlite_la_LDFLAGS = \
- $(GN_PLUGIN_LDFLAGS)
-
-
 
 gnunet_service_reclaim_SOURCES = \
- gnunet-service-reclaim.c
+ gnunet-service-reclaim.c \
+ gnunet-service-reclaim_tickets.c
 gnunet_service_reclaim_LDADD = \
  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
  $(top_builddir)/src/util/libgnunetutil.la \
  $(top_builddir)/src/namestore/libgnunetnamestore.la \
  $(top_builddir)/src/identity/libgnunetidentity.la \
  $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/abe/libgnunetabe.la \
- $(top_builddir)/src/credential/libgnunetcredential.la \
  $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
  libgnunetreclaim.la \
  $(top_builddir)/src/gns/libgnunetgns.la \
@@ -127,26 +109,26 @@ libgnunetreclaim_la_SOURCES = \
  reclaim.h
 libgnunetreclaim_la_LIBADD = \
   $(top_builddir)/src/util/libgnunetutil.la \
-       $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
-       $(GN_LIBINTL) $(XLIB)
+  $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
+  $(GN_LIBINTL) $(XLIB)
 libgnunetreclaim_la_LDFLAGS = \
-       $(GN_LIB_LDFLAGS)  $(WINFLAGS) \
-       -version-info 0:0:0
+  $(GN_LIB_LDFLAGS)  $(WINFLAGS) \
+  -version-info 0:0:0
 
 gnunet_reclaim_SOURCES = \
  gnunet-reclaim.c
 gnunet_reclaim_LDADD = \
   $(top_builddir)/src/util/libgnunetutil.la \
-       $(top_builddir)/src/namestore/libgnunetnamestore.la \
-       libgnunetreclaim.la \
-       $(top_builddir)/src/identity/libgnunetidentity.la \
-       $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
+  $(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 = \
-       test_reclaim_attribute.sh \
-       test_reclaim_issue.sh \
-       test_reclaim_consume.sh \
+  test_reclaim_attribute.sh \
+  test_reclaim_issue.sh \
+  test_reclaim_consume.sh \
   test_reclaim_revoke.sh
 
 if ENABLE_TEST_RUN
diff --git a/src/reclaim/gnunet-reclaim.c b/src/reclaim/gnunet-reclaim.c
index 177f505c6..1c3b4174d 100644
--- a/src/reclaim/gnunet-reclaim.c
+++ b/src/reclaim/gnunet-reclaim.c
@@ -11,7 +11,7 @@
    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/>.
 
@@ -23,14 +23,15 @@
  * @brief Identity Provider utility
  *
  */
-
 #include "platform.h"
+#include <inttypes.h>
+
 #include "gnunet_util_lib.h"
+
+#include "gnunet_identity_service.h"
 #include "gnunet_namestore_service.h"
 #include "gnunet_reclaim_service.h"
-#include "gnunet_identity_service.h"
 #include "gnunet_signatures.h"
-
 /**
  * return value
  */
@@ -44,42 +45,47 @@ static int list;
 /**
  * Relying party
  */
-static char* rp;
+static char *rp;
 
 /**
  * The attribute
  */
-static char* attr_name;
+static char *attr_name;
 
 /**
  * Attribute value
  */
-static char* attr_value;
+static char *attr_value;
 
 /**
  * Attributes to issue
  */
-static char* issue_attrs;
+static char *issue_attrs;
 
 /**
  * Ticket to consume
  */
-static char* consume_ticket;
+static char *consume_ticket;
 
 /**
  * Attribute type
  */
-static char* type_str;
+static char *type_str;
 
 /**
  * Ticket to revoke
  */
-static char* revoke_ticket;
+static char *revoke_ticket;
+
+/**
+ * Ticket listing
+ */
+static int list_tickets;
 
 /**
  * Ego name
  */
-static char* ego_name;
+static char *ego_name;
 
 /**
  * Identity handle
@@ -101,6 +107,11 @@ static struct GNUNET_RECLAIM_Operation *reclaim_op;
  */
 static struct GNUNET_RECLAIM_AttributeIterator *attr_iterator;
 
+/**
+ * Ticket iterator
+ */
+static struct GNUNET_RECLAIM_TicketIterator *ticket_iterator;
+
 /**
  * Master ABE key
  */
@@ -147,7 +158,7 @@ static struct GNUNET_SCHEDULER_Task *cleanup_task;
 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *claim;
 
 static void
-do_cleanup(void *cls)
+do_cleanup (void *cls)
 {
   cleanup_task = NULL;
   if (NULL != timeout)
@@ -156,6 +167,8 @@ do_cleanup(void *cls)
     GNUNET_RECLAIM_cancel (reclaim_op);
   if (NULL != attr_iterator)
     GNUNET_RECLAIM_get_attributes_stop (attr_iterator);
+  if (NULL != ticket_iterator)
+    GNUNET_RECLAIM_ticket_iteration_stop (ticket_iterator);
   if (NULL != reclaim_handle)
     GNUNET_RECLAIM_disconnect (reclaim_handle);
   if (NULL != identity_handle)
@@ -167,68 +180,86 @@ do_cleanup(void *cls)
 }
 
 static void
-ticket_issue_cb (void* cls,
-                 const struct GNUNET_RECLAIM_Ticket *ticket)
+ticket_issue_cb (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
 {
-  char* ticket_str;
+  char *ticket_str;
   reclaim_op = NULL;
   if (NULL != ticket) {
-    ticket_str = GNUNET_STRINGS_data_to_string_alloc (ticket,
-                                                      sizeof (struct 
GNUNET_RECLAIM_Ticket));
-    printf("%s\n",
-           ticket_str);
+    ticket_str = GNUNET_STRINGS_data_to_string_alloc (
+        ticket, sizeof (struct GNUNET_RECLAIM_Ticket));
+    printf ("%s\n", ticket_str);
     GNUNET_free (ticket_str);
   }
   cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
 }
 
 static void
-store_attr_cont (void *cls,
-                 int32_t success,
-                 const char*emsg)
+store_attr_cont (void *cls, int32_t success, const char *emsg)
 {
   reclaim_op = NULL;
   if (GNUNET_SYSERR == success) {
-    fprintf (stderr,
-             "%s\n", emsg);
+    fprintf (stderr, "%s\n", emsg);
   }
   cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
 }
 
 static void
-process_attrs (void *cls,
-         const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
-         const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
+process_attrs (void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
+               const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
 {
   char *value_str;
-  const char* attr_type;
+  const char *attr_type;
 
-  if (NULL == identity)
-  {
+  if (NULL == identity) {
     reclaim_op = NULL;
     cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
     return;
   }
-  if (NULL == attr)
-  {
+  if (NULL == attr) {
     ret = 1;
     return;
   }
-  value_str = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type,
-                                                        attr->data,
+  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);
-  fprintf (stdout,
-           "%s: %s [%s,v%u]\n", attr->name, value_str, attr_type, 
attr->version);
+  fprintf (stdout, "%s: %s [%s,v%u,id=%" PRIu64 "]\n", attr->name, value_str,
+           attr_type, attr->version, attr->id);
+}
+
+static void
+ticket_iter_err (void *cls)
+{
+  ticket_iterator = NULL;
+  fprintf (stderr, "Failed to iterate over tickets\n");
+  cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
 }
 
+static void
+ticket_iter_fin (void *cls)
+{
+  ticket_iterator = NULL;
+  cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
+}
+
+static void
+ticket_iter (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
+{
+  char *aud;
+  char *ref;
+
+  aud = 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));
+
+  fprintf (stdout, "Ticket ID: %s | Audience: %s\n", ref, aud);
+  GNUNET_RECLAIM_ticket_iteration_next (ticket_iterator);
+}
 
 static void
 iter_error (void *cls)
 {
   attr_iterator = NULL;
-  fprintf (stderr,
-           "Failed to iterate over attributes\n");
+  fprintf (stderr, "Failed to iterate over attributes\n");
   cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
 }
 
@@ -237,20 +268,17 @@ timeout_task (void *cls)
 {
   timeout = NULL;
   ret = 1;
-  fprintf (stderr,
-           "Timeout\n");
+  fprintf (stderr, "Timeout\n");
   if (NULL == cleanup_task)
     cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
 }
 
 static void
-process_rvk (void *cls, int success, const char* msg)
+process_rvk (void *cls, int success, const char *msg)
 {
   reclaim_op = NULL;
-  if (GNUNET_OK != success)
-  {
-    fprintf (stderr,
-             "Revocation failed.\n");
+  if (GNUNET_OK != success) {
+    fprintf (stderr, "Revocation failed.\n");
     ret = 1;
   }
   cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
@@ -264,73 +292,48 @@ iter_finished (void *cls)
   int type;
 
   attr_iterator = NULL;
-  if (list)
-  {
+  if (list) {
     cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
     return;
   }
 
-  if (issue_attrs)
-  {
-    reclaim_op = GNUNET_RECLAIM_ticket_issue (reclaim_handle,
-                                              pkey,
-                                              &rp_key,
-                                              attr_list,
-                                              &ticket_issue_cb,
-                                              NULL);
+  if (issue_attrs) {
+    reclaim_op = GNUNET_RECLAIM_ticket_issue (
+        reclaim_handle, pkey, &rp_key, attr_list, &ticket_issue_cb, NULL);
     return;
   }
-  if (consume_ticket)
-  {
-    reclaim_op = GNUNET_RECLAIM_ticket_consume (reclaim_handle,
-                                                pkey,
-                                                &ticket,
-                                                &process_attrs,
-                                                NULL);
-    timeout = GNUNET_SCHEDULER_add_delayed 
(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 10),
-                                            &timeout_task,
-                                            NULL);
+  if (consume_ticket) {
+    reclaim_op = GNUNET_RECLAIM_ticket_consume (reclaim_handle, pkey, &ticket,
+                                                &process_attrs, NULL);
+    timeout = GNUNET_SCHEDULER_add_delayed (
+        GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10),
+        &timeout_task, NULL);
     return;
   }
-  if (revoke_ticket)
-  {
-    reclaim_op = GNUNET_RECLAIM_ticket_revoke (reclaim_handle,
-                                               pkey,
-                                               &ticket,
-                                               &process_rvk,
-                                               NULL);
+  if (revoke_ticket) {
+    reclaim_op = GNUNET_RECLAIM_ticket_revoke (reclaim_handle, pkey, &ticket,
+                                               &process_rvk, NULL);
     return;
   }
-  if (attr_name)
-  {
+  if (attr_name) {
     if (NULL == type_str)
       type = GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING;
     else
       type = GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (type_str);
 
-    GNUNET_assert (GNUNET_SYSERR != GNUNET_RECLAIM_ATTRIBUTE_string_to_value 
(type,
-                                                                              
attr_value,
-                                                                              
(void**)&data,
-                                                                              
&data_size));
-    if (NULL != claim)
-    {
+    GNUNET_assert (GNUNET_SYSERR !=
+                   GNUNET_RECLAIM_ATTRIBUTE_string_to_value (
+                       type, attr_value, (void **)&data, &data_size));
+    if (NULL != claim) {
       claim->type = type;
       claim->data = data;
       claim->data_size = data_size;
+    } else {
+      claim =
+          GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr_name, type, data, 
data_size);
     }
-    else
-    {
-      claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr_name,
-                                                  type,
-                                                  data,
-                                                  data_size);
-    }
-    reclaim_op = GNUNET_RECLAIM_attribute_store (reclaim_handle,
-                                                 pkey,
-                                                 claim,
-                                                 &exp_interval,
-                                                 &store_attr_cont,
-                                                 NULL);
+    reclaim_op = GNUNET_RECLAIM_attribute_store (
+        reclaim_handle, pkey, claim, &exp_interval, &store_attr_cont, NULL);
     GNUNET_free (data);
     GNUNET_free (claim);
     return;
@@ -339,8 +342,7 @@ iter_finished (void *cls)
 }
 
 static void
-iter_cb (void *cls,
-         const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
+iter_cb (void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
          const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
 {
   struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
@@ -348,18 +350,12 @@ iter_cb (void *cls,
   char *attr_str;
   const char *attr_type;
 
-  if ((NULL != attr_name) && (NULL != claim))
-  {
-    if (0 == strcasecmp (attr_name, attr->name))
-    {
-      claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr->name,
-                                                            attr->type,
-                                                            attr->data,
-                                                            attr->data_size);
+  if ((NULL != attr_name) && (NULL != claim)) {
+    if (0 == strcasecmp (attr_name, attr->name)) {
+      claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr->name, attr->type,
+                                                  attr->data, attr->data_size);
     }
-  }
-  else if (issue_attrs)
-  {
+  } else if (issue_attrs) {
     attrs_tmp = GNUNET_strdup (issue_attrs);
     attr_str = strtok (attrs_tmp, ",");
     while (NULL != attr_str) {
@@ -368,82 +364,69 @@ iter_cb (void *cls,
         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 = GNUNET_RECLAIM_ATTRIBUTE_claim_new (
+          attr->name, attr->type, attr->data, attr->data_size);
       le->claim->version = attr->version;
-      GNUNET_CONTAINER_DLL_insert (attr_list->list_head,
-                                   attr_list->list_tail,
+      le->claim->id = attr->id;
+      GNUNET_CONTAINER_DLL_insert (attr_list->list_head, attr_list->list_tail,
                                    le);
       break;
     }
     GNUNET_free (attrs_tmp);
-  } 
-  else if (list)
-  {
-    attr_str = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type,
-                                                         attr->data,
+  } else if (list) {
+    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);
-    fprintf (stdout,
-             "%s: %s [%s,v%u]\n", attr->name, attr_str, attr_type, 
attr->version);
+    fprintf (stdout, "%s: %s [%s,v%u,id=%" PRIu64 "]\n", attr->name, attr_str,
+             attr_type, attr->version, attr->id);
   }
   GNUNET_RECLAIM_get_attributes_next (attr_iterator);
 }
 
 static void
-start_get_attributes ()
+start_process ()
 {
-  if (NULL == pkey)
-  {
-    fprintf (stderr,
-             "Ego %s not found\n", ego_name);
+  if (NULL == pkey) {
+    fprintf (stderr, "Ego %s not found\n", ego_name);
     cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
     return;
   }
 
+  if (list_tickets) {
+    ticket_iterator = GNUNET_RECLAIM_ticket_iteration_start (
+        reclaim_handle, pkey, &ticket_iter_err, NULL, &ticket_iter, NULL,
+        &ticket_iter_fin, NULL);
+    return;
+  }
+
   if (NULL != rp)
-    GNUNET_CRYPTO_ecdsa_public_key_from_string (rp,
-                                                strlen (rp),
-                                                &rp_key);
+    GNUNET_CRYPTO_ecdsa_public_key_from_string (rp, strlen (rp), &rp_key);
   if (NULL != consume_ticket)
-    GNUNET_STRINGS_string_to_data (consume_ticket,
-                                   strlen (consume_ticket),
+    GNUNET_STRINGS_string_to_data (consume_ticket, strlen (consume_ticket),
                                    &ticket,
                                    sizeof (struct GNUNET_RECLAIM_Ticket));
   if (NULL != revoke_ticket)
-    GNUNET_STRINGS_string_to_data (revoke_ticket,
-                                   strlen (revoke_ticket),
+    GNUNET_STRINGS_string_to_data (revoke_ticket, strlen (revoke_ticket),
                                    &ticket,
                                    sizeof (struct GNUNET_RECLAIM_Ticket));
 
   attr_list = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
   claim = NULL;
-  attr_iterator = GNUNET_RECLAIM_get_attributes_start (reclaim_handle,
-                                                       pkey,
-                                                       &iter_error,
-                                                       NULL,
-                                                       &iter_cb,
-                                                       NULL,
-                                                       &iter_finished,
-                                                       NULL);
-
-
+  attr_iterator = GNUNET_RECLAIM_get_attributes_start (
+      reclaim_handle, pkey, &iter_error, NULL, &iter_cb, NULL, &iter_finished,
+      NULL);
 }
 
 static int init = GNUNET_YES;
 
 static void
-ego_cb (void *cls,
-        struct GNUNET_IDENTITY_Ego *ego,
-        void **ctx,
+ego_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx,
         const char *name)
 {
   if (NULL == name) {
     if (GNUNET_YES == init) {
       init = GNUNET_NO;
-      start_get_attributes();
+      start_process ();
     }
     return;
   }
@@ -454,108 +437,77 @@ ego_cb (void *cls,
 
 
 static void
-run (void *cls,
-     char *const *args,
-     const char *cfgfile,
+run (void *cls, char *const *args, const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
   ret = 0;
-  if (NULL == ego_name)
-  {
+  if (NULL == ego_name) {
     ret = 1;
-    fprintf (stderr,
-             _("Ego is required\n"));
+    fprintf (stderr, _ ("Ego is required\n"));
     return;
   }
 
-  if ( (NULL == attr_value) && (NULL != attr_name) )
-  {
+  if ((NULL == attr_value) && (NULL != attr_name)) {
     ret = 1;
-    fprintf (stderr,
-             _("Attribute value missing!\n"));
+    fprintf (stderr, _ ("Attribute value missing!\n"));
     return;
   }
 
-  if ( (NULL == rp) && (NULL != issue_attrs) )
-  {
+  if ((NULL == rp) && (NULL != issue_attrs)) {
     ret = 1;
-    fprintf (stderr,
-             _("Requesting party key is required!\n"));
+    fprintf (stderr, _ ("Requesting party key is required!\n"));
     return;
   }
 
   reclaim_handle = GNUNET_RECLAIM_connect (c);
-  //Get Ego
-  identity_handle = GNUNET_IDENTITY_connect (c,
-                                             &ego_cb,
-                                             NULL);
-
-
+  // Get Ego
+  identity_handle = GNUNET_IDENTITY_connect (c, &ego_cb, NULL);
 }
 
 
 int
-main(int argc, char *const argv[])
+main (int argc, char *const argv[])
 {
   exp_interval = GNUNET_TIME_UNIT_HOURS;
   struct GNUNET_GETOPT_CommandLineOption options[] = {
 
-    GNUNET_GETOPT_option_string ('a',
-                                 "add",
-                                 NULL,
-                                 gettext_noop ("Add attribute"),
-                                 &attr_name),
-
-    GNUNET_GETOPT_option_string ('V',
-                                 "value",
-                                 NULL,
-                                 gettext_noop ("Attribute value"),
-                                 &attr_value),
-    GNUNET_GETOPT_option_string ('e',
-                                 "ego",
-                                 NULL,
-                                 gettext_noop ("Ego"),
-                                 &ego_name),
-    GNUNET_GETOPT_option_string ('r',
-                                 "rp",
-                                 NULL,
-                                 gettext_noop ("Audience (relying party)"),
-                                 &rp),
-    GNUNET_GETOPT_option_flag ('D',
-                               "dump",
-                               gettext_noop ("List attributes for Ego"),
-                               &list),
-    GNUNET_GETOPT_option_string ('i',
-                                 "issue",
-                                 NULL,
-                                 gettext_noop ("Issue a ticket"),
-                                 &issue_attrs),
-    GNUNET_GETOPT_option_string ('C',
-                                 "consume",
-                                 NULL,
-                                 gettext_noop ("Consume a ticket"),
-                                 &consume_ticket),
-    GNUNET_GETOPT_option_string ('R',
-                                 "revoke",
-                                 NULL,
-                                 gettext_noop ("Revoke a ticket"),
-                                 &revoke_ticket),
-    GNUNET_GETOPT_option_string ('t',
-                                 "type",
-                                 NULL,
-                                 gettext_noop ("Type of attribute"),
-                                 &type_str),
-    GNUNET_GETOPT_option_relative_time ('E',
-                                        "expiration",
-                                        NULL,
-                                        gettext_noop ("Expiration interval of 
the attribute"),
-                                        &exp_interval),
-
-    GNUNET_GETOPT_OPTION_END
-  };
-  if (GNUNET_OK != GNUNET_PROGRAM_run (argc, argv, "ct",
-                                       "ct", options,
-                                       &run, NULL))
+      GNUNET_GETOPT_option_string ('a', "add", "NAME",
+                                   gettext_noop ("Add an attribute NAME"),
+                                   &attr_name),
+
+      GNUNET_GETOPT_option_string ('V', "value", "VALUE",
+                                   gettext_noop ("The attribute VALUE"),
+                                   &attr_value),
+      GNUNET_GETOPT_option_string ('e', "ego", "EGO",
+                                   gettext_noop ("The EGO to use"), &ego_name),
+      GNUNET_GETOPT_option_string (
+          'r', "rp", "RP", gettext_noop ("Specify the relying party for 
issue"),
+          &rp),
+      GNUNET_GETOPT_option_flag (
+          'D', "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_string ('C', "consume", "TICKET",
+                                   gettext_noop ("Consume a ticket"),
+                                   &consume_ticket),
+      GNUNET_GETOPT_option_string ('R', "revoke", "TICKET",
+                                   gettext_noop ("Revoke a ticket"),
+                                   &revoke_ticket),
+      GNUNET_GETOPT_option_string (
+          't', "type", "TYPE", gettext_noop ("Type of attribute"), &type_str),
+      GNUNET_GETOPT_option_flag (
+          'T', "tickets", gettext_noop ("List tickets of ego"), &list_tickets),
+      GNUNET_GETOPT_option_relative_time (
+          'E', "expiration", "INTERVAL",
+          gettext_noop ("Expiration interval of the attribute"), 
&exp_interval),
+
+      GNUNET_GETOPT_OPTION_END};
+  if (GNUNET_OK != GNUNET_PROGRAM_run (argc, argv, "gnunet-reclaim",
+                                       _ ("re:claimID command line tool"),
+                                       options, &run, NULL))
     return 1;
   else
     return ret;
diff --git a/src/reclaim/gnunet-service-reclaim.c 
b/src/reclaim/gnunet-service-reclaim.c
index 97b8aa338..2bb4f5a74 100644
--- a/src/reclaim/gnunet-service-reclaim.c
+++ b/src/reclaim/gnunet-service-reclaim.c
@@ -11,11 +11,11 @@
    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
+   SPDX-License-Identifier: AGPL3.0-or-later
    */
 /**
  * @author Martin Schanzenbach
@@ -24,18 +24,17 @@
  *
  */
 #include "platform.h"
+
 #include "gnunet_util_lib.h"
+
+#include "gnunet-service-reclaim_tickets.h"
 #include "gnunet_constants.h"
-#include "gnunet_protocols.h"
-#include "gnunet_identity_service.h"
 #include "gnunet_gnsrecord_lib.h"
+#include "gnunet_identity_service.h"
 #include "gnunet_namestore_service.h"
-#include "gnunet_abe_lib.h"
-#include "gnunet_credential_service.h"
-#include "gnunet_statistics_service.h"
-#include "gnunet_gns_service.h"
-#include "gnunet_reclaim_plugin.h"
+#include "gnunet_protocols.h"
 #include "gnunet_reclaim_attribute_lib.h"
+#include "gnunet_reclaim_plugin.h"
 #include "gnunet_signatures.h"
 #include "reclaim.h"
 
@@ -82,27 +81,7 @@ static struct GNUNET_TIME_Relative token_expiration_interval;
 /**
  * Namestore handle
  */
-static struct GNUNET_NAMESTORE_Handle *ns_handle;
-
-/**
- * GNS handle
- */
-static struct GNUNET_GNS_Handle *gns_handle;
-
-/**
- * Credential handle
- */
-static struct GNUNET_CREDENTIAL_Handle *credential_handle;
-
-/**
- * Namestore qe
- */
-static struct GNUNET_NAMESTORE_QueueEntry *ns_qe;
-
-/**
- * Namestore iterator
- */
-static struct GNUNET_NAMESTORE_ZoneIterator *ns_it;
+static struct GNUNET_NAMESTORE_Handle *nsh;
 
 /**
  * Timeout task
@@ -114,27 +93,6 @@ static struct GNUNET_SCHEDULER_Task *timeout_task;
  */
 static struct GNUNET_SCHEDULER_Task *update_task;
 
-
-/**
- * Currently processed token
- */
-static struct IdentityToken *token;
-
-/**
- * Label for currently processed token
- */
-static char* label;
-
-/**
- * Scopes for processed token
- */
-static char* scopes;
-
-/**
- * Handle to the statistics service.
- */
-static struct GNUNET_STATISTICS_Handle *stats;
-
 /**
  * Our configuration.
  */
@@ -148,8 +106,7 @@ struct IdpClient;
 /**
  * A ticket iteration operation.
  */
-struct TicketIteration
-{
+struct TicketIteration {
   /**
    * DLL
    */
@@ -165,83 +122,21 @@ struct TicketIteration
    */
   struct IdpClient *client;
 
-  /**
-   * Key of the identity we are iterating over.
-   */
-  struct GNUNET_CRYPTO_EcdsaPublicKey identity;
-
-  /**
-   * Identity is audience
-   */
-  uint32_t is_audience;
-
   /**
    * The operation id fot the iteration in the response for the client
    */
   uint32_t r_id;
 
   /**
-   * Offset of the iteration used to address next result of the 
-   * iteration in the store
-   *
-   * Initialy set to 0 in handle_iteration_start
-   * Incremented with by every call to handle_iteration_next
-   */
-  uint32_t offset;
-
-};
-
-
-
-/**
- * Callback after an ABE bootstrap
- *
- * @param cls closure
- * @param abe_key the ABE key that exists or was created
- */
-typedef void
-(*AbeBootstrapResult) (void *cls,
-                       struct GNUNET_ABE_AbeMasterKey *abe_key);
-
-
-struct AbeBootstrapHandle
-{
-  /**
-   * Function to call when finished
-   */
-  AbeBootstrapResult proc;
-
-  /**
-   * Callback closure
-   */
-  char *proc_cls;
-
-  /**
-   * Key of the zone we are iterating over.
-   */
-  struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
-
-  /**
-   * Namestore Queue Entry
-   */
-  struct GNUNET_NAMESTORE_QueueEntry *ns_qe;
-
-  /**
-   * The issuer egos ABE master key
-   */
-  struct GNUNET_ABE_AbeMasterKey *abe_key;
-
-  /**
-   * Recreate master keys
+   * The ticket iterator
    */
-  int recreate;
+  struct RECLAIM_TICKETS_Iterator *iter;
 };
 
 /**
  * An attribute iteration operation.
  */
-struct AttributeIterator
-{
+struct AttributeIterator {
   /**
    * Next element in the DLL
    */
@@ -262,11 +157,6 @@ struct AttributeIterator
    */
   struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
 
-  /**
-   * The issuer egos ABE master key
-   */
-  struct GNUNET_ABE_AbeMasterKey *abe_key;
-
   /**
    * Namestore iterator
    */
@@ -276,16 +166,12 @@ struct AttributeIterator
    * The operation id fot the zone iteration in the response for the client
    */
   uint32_t request_id;
-
 };
 
-
-
 /**
  * An idp client
  */
-struct IdpClient
-{
+struct IdpClient {
 
   /**
    * The client
@@ -296,17 +182,17 @@ struct IdpClient
    * Message queue for transmission to @e client
    */
   struct GNUNET_MQ_Handle *mq;
-  
+
   /**
    * Head of the DLL of
-   * Attribute iteration operations in 
+   * Attribute iteration operations in
    * progress initiated by this client
    */
   struct AttributeIterator *attr_iter_head;
 
   /**
    * Tail of the DLL of
-   * Attribute iteration operations 
+   * Attribute iteration operations
    * in progress initiated by this client
    */
   struct AttributeIterator *attr_iter_tail;
@@ -324,32 +210,32 @@ struct IdpClient
   /**
    * Head of DLL of ticket revocation ops
    */
-  struct TicketRevocationHandle *revoke_op_head;
+  struct TicketRevocationOperation *revoke_op_head;
 
   /**
    * Tail of DLL of ticket revocation ops
    */
-  struct TicketRevocationHandle *revoke_op_tail;
+  struct TicketRevocationOperation *revoke_op_tail;
 
   /**
    * Head of DLL of ticket issue ops
    */
-  struct TicketIssueHandle *issue_op_head;
+  struct TicketIssueOperation *issue_op_head;
 
   /**
    * Tail of DLL of ticket issue ops
    */
-  struct TicketIssueHandle *issue_op_tail;
+  struct TicketIssueOperation *issue_op_tail;
 
   /**
    * Head of DLL of ticket consume ops
    */
-  struct ConsumeTicketHandle *consume_op_head;
+  struct ConsumeTicketOperation *consume_op_head;
 
   /**
    * Tail of DLL of ticket consume ops
    */
-  struct ConsumeTicketHandle *consume_op_tail;
+  struct ConsumeTicketOperation *consume_op_tail;
 
   /**
    * Head of DLL of attribute store ops
@@ -360,11 +246,9 @@ struct IdpClient
    * Tail of DLL of attribute store ops
    */
   struct AttributeStoreHandle *store_op_tail;
-
 };
 
-struct AttributeStoreHandle
-{
+struct AttributeStoreHandle {
   /**
    * DLL
    */
@@ -390,11 +274,6 @@ struct AttributeStoreHandle
    */
   struct GNUNET_CRYPTO_EcdsaPublicKey identity_pkey;
 
-  /**
-   * The issuer egos ABE master key
-   */
-  struct GNUNET_ABE_AbeMasterKey *abe_key;
-
   /**
    * QueueEntry
    */
@@ -416,21 +295,16 @@ struct AttributeStoreHandle
   uint32_t r_id;
 };
 
-
-/* Prototype */
-struct ParallelLookup;
-
-struct ConsumeTicketHandle
-{
+struct ConsumeTicketOperation {
   /**
    * DLL
    */
-  struct ConsumeTicketHandle *next;
+  struct ConsumeTicketOperation *next;
 
   /**
    * DLL
    */
-  struct ConsumeTicketHandle *prev;
+  struct ConsumeTicketOperation *prev;
 
   /**
    * Client connection
@@ -438,101 +312,54 @@ struct ConsumeTicketHandle
   struct IdpClient *client;
 
   /**
-   * Ticket
-   */
-  struct GNUNET_RECLAIM_Ticket ticket;
-
-  /**
-   * LookupRequest
-   */
-  struct GNUNET_GNS_LookupRequest *lookup_request;
-
-  /**
-   * Audience Key
-   */
-  struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
-
-  /**
-   * Audience Key
+   * request id
    */
-  struct GNUNET_CRYPTO_EcdsaPublicKey identity_pub;
+  uint32_t r_id;
 
   /**
-   * Lookup DLL
+   * Ticket consume handle
    */
-  struct ParallelLookup *parallel_lookups_head;
+  struct RECLAIM_TICKETS_ConsumeHandle *ch;
+};
 
+/**
+ * Updated attribute IDs
+ */
+struct TicketAttributeUpdateEntry {
   /**
-   * Lookup DLL
-   */
-  struct ParallelLookup *parallel_lookups_tail;
-  
-  /**
-   * Kill task
+   * DLL
    */
-  struct GNUNET_SCHEDULER_Task *kill_task;
+  struct TicketAttributeUpdateEntry *next;
 
   /**
-   * The ABE key
+   * DLL
    */
-  struct GNUNET_ABE_AbeKey *key;
+  struct TicketAttributeUpdateEntry *prev;
 
   /**
-   * Attributes
-   */
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
-  
-  /**
-   * Lookup time
+   * The old ID
    */
-  struct GNUNET_TIME_Absolute lookup_start_time;
- 
-  /**
-   * request id
-   */
-  uint32_t r_id;
-};
-
-/**
- * Handle for a parallel GNS lookup job
- */
-struct ParallelLookup
-{
-  /* DLL */
-  struct ParallelLookup *next;
-
-  /* DLL */
-  struct ParallelLookup *prev;
-
-  /* The GNS request */
-  struct GNUNET_GNS_LookupRequest *lookup_request;
-
-  /* The handle the return to */
-  struct ConsumeTicketHandle *handle;
+  uint64_t old_id;
 
   /**
-   * Lookup time
+   * The new ID
    */
-  struct GNUNET_TIME_Absolute lookup_start_time;
-
-  /* The label to look up */
-  char *label;
+  uint64_t new_id;
 };
 
 /**
  * Ticket revocation request handle
  */
-struct TicketRevocationHandle
-{
+struct TicketRevocationOperation {
   /**
    * DLL
    */
-  struct TicketRevocationHandle *prev;
+  struct TicketRevocationOperation *prev;
 
   /**
    * DLL
    */
-  struct TicketRevocationHandle *next;
+  struct TicketRevocationOperation *next;
 
   /**
    * Client connection
@@ -540,44 +367,9 @@ struct TicketRevocationHandle
   struct IdpClient *client;
 
   /**
-   * Attributes to reissue
-   */
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
-
-  /**
-   * Attributes to revoke
-   */
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *rvk_attrs;
-
-  /**
-   * Issuer Key
-   */
-  struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
-
-  /**
-   * Ticket to issue
-   */
-  struct GNUNET_RECLAIM_Ticket ticket;
-
-  /**
-   * QueueEntry
-   */
-  struct GNUNET_NAMESTORE_QueueEntry *ns_qe;
-
-  /**
-   * Namestore iterator
-   */
-  struct GNUNET_NAMESTORE_ZoneIterator *ns_it;
-
-  /**
-   * The ABE master key
-   */
-  struct GNUNET_ABE_AbeMasterKey *abe_key;
-
-  /**
-   * Offset
+   * Revocation handle
    */
-  uint32_t offset;
+  struct RECLAIM_TICKETS_RevokeHandle *rh;
 
   /**
    * request id
@@ -585,61 +377,37 @@ struct TicketRevocationHandle
   uint32_t r_id;
 };
 
-
-
 /**
- * Ticket issue request handle
+ * Ticket issue operation handle
  */
-struct TicketIssueHandle
-{
+struct TicketIssueOperation {
   /**
    * DLL
    */
-  struct TicketIssueHandle *prev;
+  struct TicketIssueOperation *prev;
 
   /**
    * DLL
    */
-  struct TicketIssueHandle *next;
+  struct TicketIssueOperation *next;
 
   /**
    * Client connection
    */
   struct IdpClient *client;
 
-  /**
-   * Attributes to issue
-   */
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
-
-  /**
-   * Issuer Key
-   */
-  struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
-
-  /**
-   * Ticket to issue
-   */
-  struct GNUNET_RECLAIM_Ticket ticket;
-
-  /**
-   * QueueEntry
-   */
-  struct GNUNET_NAMESTORE_QueueEntry *ns_qe;
-
   /**
    * request id
    */
   uint32_t r_id;
 };
 
-
 /**
- * DLL for ego handles to egos containing the ID_ATTRS in a map in json_t 
format
+ * DLL for ego handles to egos containing the RECLAIM_ATTRS in a
+ * map in json_t format
  *
  */
-struct EgoEntry
-{
+struct EgoEntry {
   /**
    * DLL
    */
@@ -659,25 +427,18 @@ struct EgoEntry
    * Attribute map. Contains the attributes as json_t
    */
   struct GNUNET_CONTAINER_MultiHashMap *attr_map;
-
 };
 
 /**
  * Cleanup task
  */
 static void
-cleanup()
+cleanup ()
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Cleaning up\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n");
 
-  if (NULL != stats)
-  {
-    GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
-    stats = NULL;
-  }
-  GNUNET_break (NULL == GNUNET_PLUGIN_unload (db_lib_name,
-                                              TKT_database)); 
+  RECLAIM_TICKETS_deinit ();
+  GNUNET_break (NULL == GNUNET_PLUGIN_unload (db_lib_name, TKT_database));
   GNUNET_free (db_lib_name);
   db_lib_name = NULL;
   if (NULL != timeout_task)
@@ -686,19 +447,8 @@ cleanup()
     GNUNET_SCHEDULER_cancel (update_task);
   if (NULL != identity_handle)
     GNUNET_IDENTITY_disconnect (identity_handle);
-  if (NULL != gns_handle)
-    GNUNET_GNS_disconnect (gns_handle);
-  if (NULL != credential_handle)
-    GNUNET_CREDENTIAL_disconnect (credential_handle);
-  if (NULL != ns_it)
-    GNUNET_NAMESTORE_zone_iteration_stop (ns_it);
-  if (NULL != ns_qe)
-    GNUNET_NAMESTORE_cancel (ns_qe);
-  if (NULL != ns_handle)
-    GNUNET_NAMESTORE_disconnect (ns_handle);
-  GNUNET_free_non_null (token);
-  GNUNET_free_non_null (label);
-
+  if (NULL != nsh)
+    GNUNET_NAMESTORE_disconnect (nsh);
 }
 
 /**
@@ -709,1004 +459,144 @@ cleanup()
 static void
 do_shutdown (void *cls)
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Shutting down...\n");
-  cleanup();
-}
-
-/**
- * Finished storing newly bootstrapped ABE key
- */
-static void
-bootstrap_store_cont (void *cls,
-                      int32_t success,
-                      const char *emsg)
-{
-  struct AbeBootstrapHandle *abh = cls;
-  if (GNUNET_SYSERR == success)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Failed to bootstrap ABE master %s\n",
-                emsg);
-    abh->proc (abh->proc_cls, NULL);
-    GNUNET_free (abh->abe_key);
-    GNUNET_free (abh);
-    return;
-  }
-  abh->proc (abh->proc_cls, abh->abe_key);
-  GNUNET_free (abh);
-}
-
-
-/**
- * Error checking for ABE master
- */
-static void
-bootstrap_abe_error (void *cls)
-{
-  struct AbeBootstrapHandle *abh = cls;
-  abh->proc (abh->proc_cls, NULL);
-  GNUNET_free (abh);
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down...\n");
+  cleanup ();
 }
 
 
-/**
- * Handle ABE lookup in namestore
- */
 static void
-bootstrap_abe_result (void *cls,
-                      const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
-                      const char *label,
-                      unsigned int rd_count,
-                      const struct GNUNET_GNSRECORD_Data *rd)
+send_ticket_result (const struct IdpClient *client, uint32_t r_id,
+                    const struct GNUNET_RECLAIM_Ticket *ticket,
+                    uint32_t success)
 {
-  struct AbeBootstrapHandle *abh = cls;
-  struct GNUNET_ABE_AbeMasterKey *abe_key;
-
-  for (uint32_t i=0;i<rd_count;i++) {
-    if (GNUNET_GNSRECORD_TYPE_ABE_MASTER != rd[i].record_type)
-      continue;
-    if (GNUNET_YES == abh->recreate)
-      continue;
-    abe_key = GNUNET_ABE_cpabe_deserialize_master_key (rd[i].data,
-                                                       rd[i].data_size);
-    abh->proc (abh->proc_cls, abe_key);
-    GNUNET_free (abh);
-    return;
-  }
+  struct TicketResultMessage *irm;
+  struct GNUNET_MQ_Envelope *env;
+  struct GNUNET_RECLAIM_Ticket *ticket_buf;
 
-  //No ABE master found, bootstrapping...
-  abh->abe_key = GNUNET_ABE_cpabe_create_master_key ();
-
-  {
-    struct GNUNET_GNSRECORD_Data rdn[rd_count+1];
-    char *key;
-    unsigned int rd_count_new = rd_count + 1;
-
-    for (uint32_t i=0;i<rd_count;i++) {
-      if ((GNUNET_YES == abh->recreate) &&
-          (GNUNET_GNSRECORD_TYPE_ABE_MASTER == rd[i].record_type))
-      {
-        rdn[i].data_size = GNUNET_ABE_cpabe_serialize_master_key (abh->abe_key,
-                                                                  
(void**)&key);
-        rdn[i].data = key;
-        rdn[i].record_type = GNUNET_GNSRECORD_TYPE_ABE_MASTER;
-        rdn[i].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION | 
GNUNET_GNSRECORD_RF_PRIVATE;
-        rdn[i].expiration_time = GNUNET_TIME_UNIT_HOURS.rel_value_us; //TODO 
sane?
-        rd_count_new = rd_count;
-      } else {
-        GNUNET_memcpy (&rdn[i],
-                       &rd[i],
-                       sizeof (struct GNUNET_GNSRECORD_Data));
-      }
-    }
-    if (rd_count < rd_count_new) {
-      rdn[rd_count].data_size = GNUNET_ABE_cpabe_serialize_master_key 
(abh->abe_key,
-                                                                       
(void**)&key);
-      rdn[rd_count].data = key;
-      rdn[rd_count].record_type = GNUNET_GNSRECORD_TYPE_ABE_MASTER;
-      rdn[rd_count].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION | 
GNUNET_GNSRECORD_RF_PRIVATE;
-      rdn[rd_count].expiration_time = GNUNET_TIME_UNIT_HOURS.rel_value_us; 
//TODO sane?
-    }
-
-    abh->ns_qe = GNUNET_NAMESTORE_records_store (ns_handle,
-                                                 &abh->identity,
-                                                 GNUNET_GNS_EMPTY_LABEL_AT,
-                                                 rd_count_new,
-                                                 rdn,
-                                                 &bootstrap_store_cont,
-                                                 abh);
-    GNUNET_free (key);
+  if (NULL != ticket) {
+    env = GNUNET_MQ_msg_extra (irm, sizeof (struct GNUNET_RECLAIM_Ticket),
+                               GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
+    ticket_buf = (struct GNUNET_RECLAIM_Ticket *)&irm[1];
+    *ticket_buf = *ticket;
+  } else {
+    env = GNUNET_MQ_msg (irm, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
   }
+  // TODO add success member
+  irm->id = htonl (r_id);
+  GNUNET_MQ_send (client->mq, env);
 }
 
-/**
- * Bootstrap ABE master if it does not yet exists.
- * Will call the AbeBootstrapResult processor when done.
- * will always recreate the ABE key of GNUNET_YES == recreate
- */
 static void
-bootstrap_abe (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
-               AbeBootstrapResult proc,
-               void* cls,
-               int recreate)
-{
-  struct AbeBootstrapHandle *abh;
-
-  abh = GNUNET_new (struct AbeBootstrapHandle);
-  abh->proc = proc;
-  abh->proc_cls = cls;
-  abh->identity = *identity;
-  if (GNUNET_YES == recreate)
-  {
-    abh->abe_key = GNUNET_ABE_cpabe_create_master_key ();
-    abh->recreate = GNUNET_YES;
-  } else {
-    abh->recreate = GNUNET_NO;
+issue_ticket_result_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket,
+                        int32_t success, const char *emsg)
+{
+  struct TicketIssueOperation *tio = cls;
+  if (GNUNET_OK != success) {
+    send_ticket_result (tio->client, tio->r_id, NULL, GNUNET_SYSERR);
+    GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head,
+                                 tio->client->issue_op_tail, tio);
+    GNUNET_free (tio);
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error issuing ticket: %s\n", emsg);
+    return;
   }
-  abh->ns_qe = GNUNET_NAMESTORE_records_lookup (ns_handle,
-                                                identity,
-                                                GNUNET_GNS_EMPTY_LABEL_AT,
-                                                &bootstrap_abe_error,
-                                                abh,
-                                                &bootstrap_abe_result,
-                                                abh);
+  send_ticket_result (tio->client, tio->r_id, ticket, GNUNET_SYSERR);
+  GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head,
+                               tio->client->issue_op_tail, tio);
+  GNUNET_free (tio);
 }
 
-
-
 static int
-create_sym_key_from_ecdh(const struct GNUNET_HashCode *new_key_hash,
-                         struct GNUNET_CRYPTO_SymmetricSessionKey *skey,
-                         struct GNUNET_CRYPTO_SymmetricInitializationVector 
*iv)
+check_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
 {
-  struct GNUNET_CRYPTO_HashAsciiEncoded new_key_hash_str;
-
-  GNUNET_CRYPTO_hash_to_enc (new_key_hash,
-                             &new_key_hash_str);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating symmetric rsa key from %s\n", 
(char*)&new_key_hash_str);
-  static const char ctx_key[] = "gnuid-aes-ctx-key";
-  GNUNET_CRYPTO_kdf (skey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey),
-                     new_key_hash, sizeof (struct GNUNET_HashCode),
-                     ctx_key, strlen (ctx_key),
-                     NULL, 0);
-  static const char ctx_iv[] = "gnuid-aes-ctx-iv";
-  GNUNET_CRYPTO_kdf (iv, sizeof (struct 
GNUNET_CRYPTO_SymmetricInitializationVector),
-                     new_key_hash, sizeof (struct GNUNET_HashCode),
-                     ctx_iv, strlen (ctx_iv),
-                     NULL, 0);
+  uint16_t size;
+
+  size = ntohs (im->header.size);
+  if (size <= sizeof (struct IssueTicketMessage)) {
+    GNUNET_break (0);
+    return GNUNET_SYSERR;
+  }
   return GNUNET_OK;
 }
 
-/**
- * Cleanup ticket consume handle
- * @param handle the handle to clean up
- */
 static void
-cleanup_ticket_issue_handle (struct TicketIssueHandle *handle)
+handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
 {
-  if (NULL != handle->attrs)
-    GNUNET_RECLAIM_ATTRIBUTE_list_destroy (handle->attrs);
-  if (NULL != handle->ns_qe)
-    GNUNET_NAMESTORE_cancel (handle->ns_qe);
-  GNUNET_free (handle);
+  struct TicketIssueOperation *tio;
+  struct IdpClient *idp = cls;
+  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
+  size_t attrs_len;
+
+  tio = GNUNET_new (struct TicketIssueOperation);
+  attrs_len = ntohs (im->attr_len);
+  attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char *)&im[1], 
attrs_len);
+  tio->r_id = ntohl (im->id);
+  tio->client = idp;
+  GNUNET_CONTAINER_DLL_insert (idp->issue_op_head, idp->issue_op_tail, tio);
+  RECLAIM_TICKETS_issue (&im->identity, attrs, &im->rp, 
&issue_ticket_result_cb,
+                         tio);
+  GNUNET_SERVICE_client_continue (idp->client);
+  GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs);
 }
 
+/**********************************************************
+ * Revocation
+ **********************************************************/
 
 static void
-send_ticket_result (struct IdpClient *client,
-                    uint32_t r_id,
-                    const struct GNUNET_RECLAIM_Ticket *ticket,
-                    const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
+revoke_result_cb (void *cls, int32_t success)
 {
-  struct TicketResultMessage *irm;
+  struct TicketRevocationOperation *rop = cls;
   struct GNUNET_MQ_Envelope *env;
-  struct GNUNET_RECLAIM_Ticket *ticket_buf;
+  struct RevokeTicketResultMessage *trm;
 
-  /* store ticket in DB */
-  if (GNUNET_OK != TKT_database->store_ticket (TKT_database->cls,
-                                               ticket,
-                                               attrs))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unable to store ticket after issue\n");
+  rop->rh = NULL;
+  env = GNUNET_MQ_msg (trm, GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT);
+  trm->id = htonl (rop->r_id);
+  trm->success = htonl (success);
+  GNUNET_MQ_send (rop->client->mq, env);
+  GNUNET_CONTAINER_DLL_remove (rop->client->revoke_op_head,
+                               rop->client->revoke_op_tail, rop);
+  GNUNET_free (rop);
+}
+
+
+static int
+check_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *im)
+{
+  uint16_t size;
+
+  size = ntohs (im->header.size);
+  if (size <= sizeof (struct RevokeTicketMessage)) {
     GNUNET_break (0);
+    return GNUNET_SYSERR;
   }
-
-  env = GNUNET_MQ_msg_extra (irm,
-                             sizeof (struct GNUNET_RECLAIM_Ticket),
-                             GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
-  ticket_buf = (struct GNUNET_RECLAIM_Ticket *)&irm[1];
-  *ticket_buf = *ticket;
-  irm->id = htonl (r_id);
-  GNUNET_MQ_send (client->mq,
-                  env);
+  return GNUNET_OK;
 }
 
 static void
-store_ticket_issue_cont (void *cls,
-                         int32_t success,
-                         const char *emsg)
+handle_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *rm)
 {
-  struct TicketIssueHandle *handle = cls;
-
-  handle->ns_qe = NULL;
-  GNUNET_CONTAINER_DLL_remove (handle->client->issue_op_head,
-                               handle->client->issue_op_tail,
-                               handle);
-  if (GNUNET_SYSERR == success)
-  {
-    cleanup_ticket_issue_handle (handle);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n",
-                "Unknown Error\n");
-    GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
-    return;
-  }
-  send_ticket_result (handle->client,
-                      handle->r_id,
-                      &handle->ticket,
-                      handle->attrs);
-  cleanup_ticket_issue_handle (handle);
-}
-
-
-
-int
-serialize_abe_keyinfo2 (const struct GNUNET_RECLAIM_Ticket *ticket,
-                        const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
-                        const struct GNUNET_ABE_AbeKey *rp_key,
-                        struct GNUNET_CRYPTO_EcdhePrivateKey **ecdh_privkey,
-                        char **result)
-{
-  struct GNUNET_CRYPTO_EcdhePublicKey ecdh_pubkey;
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
-  char *enc_keyinfo;
-  char *serialized_key;
-  char *buf;
-  char *write_ptr;
-  char attrs_str_len;
-  ssize_t size;
-
-  struct GNUNET_CRYPTO_SymmetricSessionKey skey;
-  struct GNUNET_CRYPTO_SymmetricInitializationVector iv;
-  struct GNUNET_HashCode new_key_hash;
-  ssize_t enc_size;
-
-  size = GNUNET_ABE_cpabe_serialize_key (rp_key,
-                                         (void**)&serialized_key);
-  attrs_str_len = 0;
-  for (le = attrs->list_head; NULL != le; le = le->next) {
-    attrs_str_len += strlen (le->claim->name) + 1;
-  }
-  buf = GNUNET_malloc (attrs_str_len + size);
-  write_ptr = buf;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Writing attributes\n");
-  for (le = attrs->list_head; NULL != le; le = le->next) {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "%s\n", le->claim->name);
-
-
-    GNUNET_memcpy (write_ptr,
-                   le->claim->name,
-                   strlen (le->claim->name));
-    write_ptr[strlen (le->claim->name)] = ',';
-    write_ptr += strlen (le->claim->name) + 1;
-  }
-  write_ptr--;
-  write_ptr[0] = '\0'; //replace last , with a 0-terminator
-  write_ptr++;
-  GNUNET_memcpy (write_ptr,
-                 serialized_key,
-                 size);
-  GNUNET_free (serialized_key);
-  // ECDH keypair E = eG
-  *ecdh_privkey = GNUNET_CRYPTO_ecdhe_key_create();
-  GNUNET_CRYPTO_ecdhe_key_get_public (*ecdh_privkey,
-                                      &ecdh_pubkey);
-  enc_keyinfo = GNUNET_malloc (size + attrs_str_len);
-  // Derived key K = H(eB)
-  GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_ecdh_ecdsa (*ecdh_privkey,
-                                                        &ticket->audience,
-                                                        &new_key_hash));
-  create_sym_key_from_ecdh(&new_key_hash, &skey, &iv);
-  enc_size = GNUNET_CRYPTO_symmetric_encrypt (buf,
-                                              size + attrs_str_len,
-                                              &skey, &iv,
-                                              enc_keyinfo);
-  *result = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)+
-                           enc_size);
-  GNUNET_memcpy (*result,
-                 &ecdh_pubkey,
-                 sizeof (struct GNUNET_CRYPTO_EcdhePublicKey));
-  GNUNET_memcpy (*result + sizeof (struct GNUNET_CRYPTO_EcdhePublicKey),
-                 enc_keyinfo,
-                 enc_size);
-  GNUNET_free (enc_keyinfo);
-  GNUNET_free (buf);
-  return sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)+enc_size;
-}
-
-
-
-static void
-issue_ticket_after_abe_bootstrap (void *cls,
-                                  struct GNUNET_ABE_AbeMasterKey *abe_key)
-{
-  struct TicketIssueHandle *ih = cls;
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
-  struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey;
-  struct GNUNET_GNSRECORD_Data code_record[1];
-  struct GNUNET_ABE_AbeKey *rp_key;
-  char *code_record_data;
-  char **attrs;
-  char *label;
-  char *policy;
-  int attrs_len;
-  uint32_t i;
-  size_t code_record_len;
-
-  //Create new ABE key for RP
-  attrs_len = 0;
-  for (le = ih->attrs->list_head; NULL != le; le = le->next)
-    attrs_len++;
-  attrs = GNUNET_malloc ((attrs_len + 1)*sizeof (char*));
-  i = 0;
-  for (le = ih->attrs->list_head; NULL != le; le = le->next) {
-    GNUNET_asprintf (&policy, "%s_%lu",
-                     le->claim->name,
-                     le->claim->version);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Adding attribute to key: %s\n",
-                policy);
-    attrs[i] = policy;
-    i++;
-  }
-  attrs[i] = NULL;
-  rp_key = GNUNET_ABE_cpabe_create_key (abe_key,
-                                        attrs);
-
-  //TODO review this wireformat
-  code_record_len = serialize_abe_keyinfo2 (&ih->ticket,
-                                            ih->attrs,
-                                            rp_key,
-                                            &ecdhe_privkey,
-                                            &code_record_data);
-  code_record[0].data = code_record_data;
-  code_record[0].data_size = code_record_len;
-  code_record[0].expiration_time = GNUNET_TIME_UNIT_DAYS.rel_value_us;
-  code_record[0].record_type = GNUNET_GNSRECORD_TYPE_ABE_KEY;
-  code_record[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
-
-  label = GNUNET_STRINGS_data_to_string_alloc (&ih->ticket.rnd,
-                                               sizeof (uint64_t));
-  //Publish record
-  ih->ns_qe = GNUNET_NAMESTORE_records_store (ns_handle,
-                                              &ih->identity,
-                                              label,
-                                              1,
-                                              code_record,
-                                              &store_ticket_issue_cont,
-                                              ih);
-  //for (; i > 0; i--)
-  //  GNUNET_free (attrs[i-1]);
-  GNUNET_free (ecdhe_privkey);
-  GNUNET_free (label);
-  GNUNET_free (attrs);
-  GNUNET_free (code_record_data);
-  GNUNET_ABE_cpabe_delete_key (rp_key,
-                               GNUNET_YES);
-  GNUNET_ABE_cpabe_delete_master_key (abe_key);
-}
-
-
-static int
-check_issue_ticket_message(void *cls,
-                           const struct IssueTicketMessage *im)
-{
-  uint16_t size;
-
-  size = ntohs (im->header.size);
-  if (size <= sizeof (struct IssueTicketMessage))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-static void
-handle_issue_ticket_message (void *cls,
-                             const struct IssueTicketMessage *im)
-{
-  struct TicketIssueHandle *ih;
-  struct IdpClient *idp = cls;
-  size_t attrs_len;
-
-  ih = GNUNET_new (struct TicketIssueHandle);
-  attrs_len = ntohs (im->attr_len);
-  ih->attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char*)&im[1], 
attrs_len);
-  ih->r_id = ntohl (im->id);
-  ih->client = idp;
-  ih->identity = im->identity;
-  GNUNET_CRYPTO_ecdsa_key_get_public (&ih->identity,
-                                      &ih->ticket.identity);
-  ih->ticket.audience = im->rp;
-  ih->ticket.rnd =
-    GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG,
-                              UINT64_MAX);
-  GNUNET_CONTAINER_DLL_insert (idp->issue_op_head,
-                               idp->issue_op_tail,
-                               ih);
-  bootstrap_abe (&ih->identity, &issue_ticket_after_abe_bootstrap, ih, 
GNUNET_NO);
-  GNUNET_SERVICE_client_continue (idp->client);
-
-}
-
-/**********************************************************
- * Revocation
- **********************************************************/
-
-/**
- * Cleanup revoke handle
- *
- * @param rh the ticket revocation handle
- */
-static void
-cleanup_revoke_ticket_handle (struct TicketRevocationHandle *rh)
-{
-  if (NULL != rh->attrs)
-    GNUNET_RECLAIM_ATTRIBUTE_list_destroy (rh->attrs);
-  if (NULL != rh->rvk_attrs)
-    GNUNET_RECLAIM_ATTRIBUTE_list_destroy (rh->rvk_attrs);
-  if (NULL != rh->abe_key)
-    GNUNET_ABE_cpabe_delete_master_key (rh->abe_key);
-  if (NULL != rh->ns_qe)
-    GNUNET_NAMESTORE_cancel (rh->ns_qe);
-  if (NULL != rh->ns_it)
-    GNUNET_NAMESTORE_zone_iteration_stop (rh->ns_it);
-  GNUNET_free (rh);
-}
-
-
-/**
- * Send revocation result
- *
- * @param rh ticket revocation handle
- * @param success GNUNET_OK if successful result
- */
-static void
-send_revocation_finished (struct TicketRevocationHandle *rh,
-                          uint32_t success)
-{
-  struct GNUNET_MQ_Envelope *env;
-  struct RevokeTicketResultMessage *trm;
-
-  GNUNET_break(TKT_database->delete_ticket (TKT_database->cls,
-                                            &rh->ticket));
-
-  env = GNUNET_MQ_msg (trm,
-                       GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT);
-  trm->id = htonl (rh->r_id);
-  trm->success = htonl (success);
-  GNUNET_MQ_send (rh->client->mq,
-                  env);
-  GNUNET_CONTAINER_DLL_remove (rh->client->revoke_op_head,
-                               rh->client->revoke_op_tail,
-                               rh);
-}
-
-
-/**
- * Process ticket from database
- *
- * @param cls struct TicketIterationProcResult
- * @param ticket the ticket
- * @param attrs the attributes
- */
-static void
-ticket_reissue_proc (void *cls,
-                     const struct GNUNET_RECLAIM_Ticket *ticket,
-                     const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
-
-static void
-revocation_reissue_tickets (struct TicketRevocationHandle *rh);
-
-
-static void reissue_next (void *cls)
-{
-  struct TicketRevocationHandle *rh = cls;
-  revocation_reissue_tickets (rh);
-}
-
-
-static void
-reissue_ticket_cont (void *cls,
-                     int32_t success,
-                     const char *emsg)
-{
-  struct TicketRevocationHandle *rh = cls;
-
-  rh->ns_qe = NULL;
-  if (GNUNET_SYSERR == success)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n",
-                "Unknown Error\n");
-    send_revocation_finished (rh, GNUNET_SYSERR);
-    cleanup_revoke_ticket_handle (rh);
-    return;
-  }
-  rh->offset++;
-  GNUNET_SCHEDULER_add_now (&reissue_next, rh);
-}
-
-
-/**
- * Process ticket from database
- *
- * @param cls struct TicketIterationProcResult
- * @param ticket the ticket
- * @param attrs the attributes
- */
-static void
-ticket_reissue_proc (void *cls,
-                     const struct GNUNET_RECLAIM_Ticket *ticket,
-                     const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
-{
-  struct TicketRevocationHandle *rh = cls;
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le_rollover;
-  struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey;
-  struct GNUNET_GNSRECORD_Data code_record[1];
-  struct GNUNET_ABE_AbeKey *rp_key;
-  char *code_record_data;
-  char **attr_arr;
-  char *label;
-  char *policy;
-  int attrs_len;
-  uint32_t i;
-  int reissue_ticket;
-  size_t code_record_len;
-
-
-  if (NULL == ticket)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Iteration done\n");
-    return;
-  }
-
-  if (0 == memcmp (&ticket->audience,
-                   &rh->ticket.audience,
-                   sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Do not reissue for this identity.!\n");
-    label = GNUNET_STRINGS_data_to_string_alloc (&rh->ticket.rnd,
-                                                 sizeof (uint64_t));
-    //Delete record
-    rh->ns_qe = GNUNET_NAMESTORE_records_store (ns_handle,
-                                                &rh->identity,
-                                                label,
-                                                0,
-                                                NULL,
-                                                &reissue_ticket_cont,
-                                                rh);
-
-    GNUNET_free (label);
-    return;
-  }
-
-  /* 
-   * Check if any attribute of this ticket intersects with a rollover attribute
-   */
-  reissue_ticket = GNUNET_NO;
-  for (le = attrs->list_head; NULL != le; le = le->next)
-  {
-    for (le_rollover = rh->rvk_attrs->list_head;
-         NULL != le_rollover;
-         le_rollover = le_rollover->next)
-    {
-      if (0 == strcmp (le_rollover->claim->name,
-                       le->claim->name))
-      {
-        reissue_ticket = GNUNET_YES;
-        le->claim->version = le_rollover->claim->version;
-      }
-    }
-  }
-
-  if (GNUNET_NO == reissue_ticket)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Skipping ticket.\n");
-
-    rh->offset++;
-    GNUNET_SCHEDULER_add_now (&reissue_next, rh);
-
-
-    return;
-  }
-
-  //Create new ABE key for RP
-  attrs_len = 0;
-
-  /* If this is the RP we want to revoke attributes of, the do so */
-
-  for (le = attrs->list_head; NULL != le; le = le->next)
-    attrs_len++;
-  attr_arr = GNUNET_malloc ((attrs_len + 1)*sizeof (char*));
-  i = 0;
-  for (le = attrs->list_head; NULL != le; le = le->next) {
-    GNUNET_asprintf (&policy, "%s_%lu",
-                     le->claim->name,
-                     le->claim->version);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Recreating key with %s\n", policy);
-    attr_arr[i] = policy;
-    i++;
-  }
-  attr_arr[i] = NULL;
-  rp_key = GNUNET_ABE_cpabe_create_key (rh->abe_key,
-                                        attr_arr);
-
-  //TODO review this wireformat
-  code_record_len = serialize_abe_keyinfo2 (ticket,
-                                            attrs,
-                                            rp_key,
-                                            &ecdhe_privkey,
-                                            &code_record_data);
-  code_record[0].data = code_record_data;
-  code_record[0].data_size = code_record_len;
-  code_record[0].expiration_time = GNUNET_TIME_UNIT_DAYS.rel_value_us;
-  code_record[0].record_type = GNUNET_GNSRECORD_TYPE_ABE_KEY;
-  code_record[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
-
-  label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd,
-                                               sizeof (uint64_t));
-  //Publish record
-  rh->ns_qe = GNUNET_NAMESTORE_records_store (ns_handle,
-                                              &rh->identity,
-                                              label,
-                                              1,
-                                              code_record,
-                                              &reissue_ticket_cont,
-                                              rh);
-  //for (; i > 0; i--)
-  //  GNUNET_free (attr_arr[i-1]);
-  GNUNET_free (ecdhe_privkey);
-  GNUNET_free (label);
-  GNUNET_free (attr_arr);
-  GNUNET_free (code_record_data);
-  GNUNET_ABE_cpabe_delete_key (rp_key, GNUNET_YES);
-}
-
-
-/* Prototype for below function */
-static void
-attr_reenc_cont (void *cls,
-                 int32_t success,
-                 const char *emsg);
-
-static void
-revocation_reissue_tickets (struct TicketRevocationHandle *rh)
-{
-  int ret;
-  /* Done, issue new keys */
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Revocation Phase III: Reissuing Tickets\n");
-  if (GNUNET_SYSERR == (ret = TKT_database->iterate_tickets (TKT_database->cls,
-                                                             
&rh->ticket.identity,
-                                                             GNUNET_NO,
-                                                             rh->offset,
-                                                             
&ticket_reissue_proc,
-                                                             rh)))
-  {
-    GNUNET_break (0);
-  }
-  if (GNUNET_NO == ret)
-  {
-    send_revocation_finished (rh, GNUNET_OK);
-    cleanup_revoke_ticket_handle (rh);
-    return;
-  }
-}
-
-/**
- * Failed to check for attribute
- */
-static void
-check_attr_error (void *cls)
-{
-  struct TicketRevocationHandle *rh = cls;
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-              "Unable to check for existing attribute\n");
-  rh->ns_qe = NULL;
-  send_revocation_finished (rh, GNUNET_SYSERR);
-  cleanup_revoke_ticket_handle (rh);
-}
-
-
-/**
- * Revoke next attribte by reencryption with
- * new ABE master
- */
-static void
-reenc_next_attribute (void *cls);
-
-/**
- * Check for existing attribute and overwrite
- */
-static void
-check_attr_cb (void *cls,
-               const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
-               const char *label,
-               unsigned int rd_count,
-               const struct GNUNET_GNSRECORD_Data *rd_old)
-{
-  struct TicketRevocationHandle *rh = cls;
-  struct GNUNET_GNSRECORD_Data rd[1];
-  char* buf;
-  char* enc_buf;
-  size_t enc_size;
-  char* rd_buf;
-  size_t buf_size;
-  char* policy;
-  uint32_t attr_ver;
-
-  rh->ns_qe = NULL;
-  if (1 != rd_count) {
-    GNUNET_SCHEDULER_add_now (&reenc_next_attribute,
-                              rh);
-    return;
-  }
-
-  buf_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size 
(rh->attrs->list_head->claim);
-  buf = GNUNET_malloc (buf_size);
-  rh->attrs->list_head->claim->version++;
-  GNUNET_RECLAIM_ATTRIBUTE_serialize (rh->attrs->list_head->claim,
-                                      buf);
-  GNUNET_asprintf (&policy, "%s_%lu",
-                   rh->attrs->list_head->claim->name,
-                   rh->attrs->list_head->claim->version);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Encrypting with policy %s\n", policy);
-  /**
-   * Encrypt the attribute value and store in namestore
-   */
-  enc_size = GNUNET_ABE_cpabe_encrypt (buf,
-                                       buf_size,
-                                       policy, //Policy
-                                       rh->abe_key,
-                                       (void**)&enc_buf);
-  GNUNET_free (buf);
-  if (GNUNET_SYSERR == enc_size)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unable to re-encrypt with policy %s\n",
-                policy);
-    GNUNET_free (policy);
-    send_revocation_finished (rh, GNUNET_SYSERR);
-    cleanup_revoke_ticket_handle (rh);
-    return;
-  }
-  GNUNET_free (policy);
-
-  rd[0].data_size = enc_size + sizeof (uint32_t);
-  rd_buf = GNUNET_malloc (rd[0].data_size);
-  attr_ver = htonl (rh->attrs->list_head->claim->version);
-  GNUNET_memcpy (rd_buf,
-                 &attr_ver,
-                 sizeof (uint32_t));
-  GNUNET_memcpy (rd_buf+sizeof (uint32_t),
-                 enc_buf,
-                 enc_size);
-  rd[0].data = rd_buf;
-  rd[0].record_type = GNUNET_GNSRECORD_TYPE_ID_ATTR;
-  rd[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
-  rd[0].expiration_time = rd_old[0].expiration_time;
-  rh->ns_qe = GNUNET_NAMESTORE_records_store (ns_handle,
-                                              &rh->identity,
-                                              
rh->attrs->list_head->claim->name,
-                                              1,
-                                              rd,
-                                              &attr_reenc_cont,
-                                              rh);
-  GNUNET_free (enc_buf);
-  GNUNET_free (rd_buf);
-}
-
-
-/**
- * Revoke next attribte by reencryption with
- * new ABE master
- */
-static void
-reenc_next_attribute (void *cls)
-{
-  struct TicketRevocationHandle *rh = cls;
-  if (NULL == rh->attrs->list_head)
-  {
-    revocation_reissue_tickets (rh);
-    return;
-  }
-  /* First check if attribute still exists */
-  rh->ns_qe = GNUNET_NAMESTORE_records_lookup (ns_handle,
-                                               &rh->identity,
-                                               
rh->attrs->list_head->claim->name,
-                                               &check_attr_error,
-                                               rh,
-                                               &check_attr_cb,
-                                               rh);
-}
-
-
-/**
- * Namestore callback after revoked attribute
- * is stored
- */
-static void
-attr_reenc_cont (void *cls,
-                 int32_t success,
-                 const char *emsg)
-{
-  struct TicketRevocationHandle *rh = cls;
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
-
-  rh->ns_qe = NULL;
-  if (GNUNET_SYSERR == success)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Failed to reencrypt attribute %s\n",
-                emsg);
-    GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
-    return;
-  }
-  if (NULL == rh->attrs->list_head)
-  {
-    revocation_reissue_tickets (rh);
-    return;
-  }
-  le = rh->attrs->list_head;
-  GNUNET_CONTAINER_DLL_remove (rh->attrs->list_head,
-                               rh->attrs->list_tail,
-                               le);
-  GNUNET_assert (NULL != rh->rvk_attrs);
-  GNUNET_CONTAINER_DLL_insert (rh->rvk_attrs->list_head,
-                               rh->rvk_attrs->list_tail,
-                               le);
-
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Re-encrypting next attribute\n");
-  reenc_next_attribute (rh);
-}
-
-
-static void
-process_attributes_to_update (void *cls,
-                              const struct GNUNET_RECLAIM_Ticket *ticket,
-                              const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList 
*attrs)
-{
-  struct TicketRevocationHandle *rh = cls;
-
-  rh->attrs = GNUNET_RECLAIM_ATTRIBUTE_list_dup (attrs);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Revocation Phase I: Collecting attributes\n");
-  /* Reencrypt all attributes with new key */
-  if (NULL == rh->attrs->list_head)
-  {
-    /* No attributes to reencrypt */
-    send_revocation_finished (rh, GNUNET_OK);
-    cleanup_revoke_ticket_handle (rh);
-    return;
-  } else {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Revocation Phase II: Re-encrypting attributes\n");
-    reenc_next_attribute (rh);
-  }
-
-}
-
-
-
-static void
-get_ticket_after_abe_bootstrap (void *cls,
-                                struct GNUNET_ABE_AbeMasterKey *abe_key)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Finished ABE bootstrap\n");
-  struct TicketRevocationHandle *rh = cls;
-  rh->abe_key = abe_key;
-  TKT_database->get_ticket_attributes (TKT_database->cls,
-                                       &rh->ticket,
-                                       &process_attributes_to_update,
-                                       rh);
-}
-
-static int
-check_revoke_ticket_message(void *cls,
-                            const struct RevokeTicketMessage *im)
-{
-  uint16_t size;
-
-  size = ntohs (im->header.size);
-  if (size <= sizeof (struct RevokeTicketMessage))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-static void
-handle_revoke_ticket_message (void *cls,
-                              const struct RevokeTicketMessage *rm)
-{
-  struct TicketRevocationHandle *rh;
-  struct IdpClient *idp = cls;
-  struct GNUNET_RECLAIM_Ticket *ticket;
-
-  rh = GNUNET_new (struct TicketRevocationHandle);
-  ticket = (struct GNUNET_RECLAIM_Ticket*)&rm[1];
-  rh->rvk_attrs = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
-  rh->ticket = *ticket;
-  rh->r_id = ntohl (rm->id);
-  rh->client = idp;
-  rh->identity = rm->identity;
-  GNUNET_CRYPTO_ecdsa_key_get_public (&rh->identity,
-                                      &rh->ticket.identity);
-  GNUNET_CONTAINER_DLL_insert (idp->revoke_op_head,
-                               idp->revoke_op_tail,
-                               rh);
-  bootstrap_abe (&rh->identity, &get_ticket_after_abe_bootstrap, rh, 
GNUNET_NO);
-  GNUNET_SERVICE_client_continue (idp->client);
-
-}
-
-/**
- * Cleanup ticket consume handle
- * @param handle the handle to clean up
- */
-static void
-cleanup_consume_ticket_handle (struct ConsumeTicketHandle *handle)
-{
-  struct ParallelLookup *lu;  
-  struct ParallelLookup *tmp;
-  if (NULL != handle->lookup_request)
-    GNUNET_GNS_lookup_cancel (handle->lookup_request);
-  for (lu = handle->parallel_lookups_head;
-       NULL != lu;) {
-    GNUNET_GNS_lookup_cancel (lu->lookup_request);
-    GNUNET_free (lu->label);
-    tmp = lu->next;
-    GNUNET_CONTAINER_DLL_remove (handle->parallel_lookups_head,
-                                 handle->parallel_lookups_tail,
-                                 lu);
-    GNUNET_free (lu);
-    lu = tmp;
-  }
-
-  if (NULL != handle->key)
-    GNUNET_ABE_cpabe_delete_key (handle->key,
-                                 GNUNET_YES);
-  if (NULL != handle->attrs)
-    GNUNET_RECLAIM_ATTRIBUTE_list_destroy (handle->attrs);
-  GNUNET_free (handle);
-}
-
+  struct TicketRevocationOperation *rop;
+  struct IdpClient *idp = cls;
+  struct GNUNET_RECLAIM_Ticket *ticket;
 
+  rop = GNUNET_new (struct TicketRevocationOperation);
+  ticket = (struct GNUNET_RECLAIM_Ticket *)&rm[1];
+  rop->r_id = ntohl (rm->id);
+  rop->client = idp;
+  GNUNET_CONTAINER_DLL_insert (idp->revoke_op_head, idp->revoke_op_tail, rop);
+  rop->rh =
+      RECLAIM_TICKETS_revoke (ticket, &rm->identity, &revoke_result_cb, rop);
+  GNUNET_SERVICE_client_continue (idp->client);
+}
 
 static int
-check_consume_ticket_message(void *cls,
-                             const struct ConsumeTicketMessage *cm)
+check_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm)
 {
   uint16_t size;
 
   size = ntohs (cm->header.size);
-  if (size <= sizeof (struct ConsumeTicketMessage))
-  {
+  if (size <= sizeof (struct ConsumeTicketMessage)) {
     GNUNET_break (0);
     return GNUNET_SYSERR;
   }
@@ -1714,296 +604,85 @@ check_consume_ticket_message(void *cls,
 }
 
 static void
-process_parallel_lookup2 (void *cls, uint32_t rd_count,
-                          const struct GNUNET_GNSRECORD_Data *rd)
+consume_result_cb (void *cls,
+                   const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
+                   const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
+                   int32_t success, const char *emsg)
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Parallel lookup finished (count=%u)\n", rd_count);
-  struct ParallelLookup *parallel_lookup = cls;
-  struct ConsumeTicketHandle *handle = parallel_lookup->handle;
+  struct ConsumeTicketOperation *cop = cls;
   struct ConsumeTicketResultMessage *crm;
   struct GNUNET_MQ_Envelope *env;
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *attr_le;
-  struct GNUNET_TIME_Absolute decrypt_duration;
-  char *data;
   char *data_tmp;
-  ssize_t attr_len;
   size_t attrs_len;
-
-  GNUNET_CONTAINER_DLL_remove (handle->parallel_lookups_head,
-                               handle->parallel_lookups_tail,
-                               parallel_lookup);
-  GNUNET_free (parallel_lookup->label);
-
-  GNUNET_STATISTICS_update (stats,
-                            "attribute_lookup_time_total",
-                            GNUNET_TIME_absolute_get_duration 
(parallel_lookup->lookup_start_time).rel_value_us,
-                            GNUNET_YES);
-  GNUNET_STATISTICS_update (stats,
-                            "attribute_lookups_count",
-                            1,
-                            GNUNET_YES);
-
-
-  GNUNET_free (parallel_lookup);
-  if (1 != rd_count)
-    GNUNET_break(0);//TODO
-  if (rd->record_type == GNUNET_GNSRECORD_TYPE_ID_ATTR)
-  {
-    decrypt_duration = GNUNET_TIME_absolute_get ();
-    attr_len = GNUNET_ABE_cpabe_decrypt (rd->data + sizeof (uint32_t),
-                                         rd->data_size - sizeof (uint32_t),
-                                         handle->key,
-                                         (void**)&data);
-    if (GNUNET_SYSERR != attr_len) 
-    {
-      GNUNET_STATISTICS_update (stats,
-                                "abe_decrypt_time_total",
-                                GNUNET_TIME_absolute_get_duration 
(decrypt_duration).rel_value_us,
-                                GNUNET_YES);
-      GNUNET_STATISTICS_update (stats,
-                                "abe_decrypt_count",
-                                1,
-                                GNUNET_YES);
-
-      attr_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
-      attr_le->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize (data,
-                                                             attr_len);
-      attr_le->claim->version = ntohl(*(uint32_t*)rd->data);
-      GNUNET_CONTAINER_DLL_insert (handle->attrs->list_head,
-                                   handle->attrs->list_tail,
-                                   attr_le);
-      GNUNET_free (data);
-    }
+  if (GNUNET_OK != success) {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg);
   }
-  if (NULL != handle->parallel_lookups_head)
-    return; //Wait for more
-  /* Else we are done */
-
-  /* Store ticket in DB */
-  if (GNUNET_OK != TKT_database->store_ticket (TKT_database->cls,
-                                               &handle->ticket,
-                                               handle->attrs))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unable to store ticket after consume\n");
-    GNUNET_break (0);
-  }
-
-  GNUNET_SCHEDULER_cancel (handle->kill_task);
-  attrs_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (handle->attrs);
-  env = GNUNET_MQ_msg_extra (crm,
-                             attrs_len,
+  attrs_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (attrs);
+  env = GNUNET_MQ_msg_extra (crm, attrs_len,
                              
GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT);
-  crm->id = htonl (handle->r_id);
+  crm->id = htonl (cop->r_id);
   crm->attrs_len = htons (attrs_len);
-  crm->identity = handle->ticket.identity;
-  data_tmp = (char *) &crm[1];
-  GNUNET_RECLAIM_ATTRIBUTE_list_serialize (handle->attrs,
-                                           data_tmp);
-  GNUNET_MQ_send (handle->client->mq, env);
-  GNUNET_CONTAINER_DLL_remove (handle->client->consume_op_head,
-                               handle->client->consume_op_tail,
-                               handle);
-  cleanup_consume_ticket_handle (handle);
-}
-
-void
-abort_parallel_lookups2 (void *cls)
-{
-  struct ConsumeTicketHandle *handle = cls;
-  struct ParallelLookup *lu;
-  struct ParallelLookup *tmp;
-  struct AttributeResultMessage *arm;
-  struct GNUNET_MQ_Envelope *env;
-
-  handle->kill_task = NULL;
-  for (lu = handle->parallel_lookups_head;
-       NULL != lu;) {
-    GNUNET_GNS_lookup_cancel (lu->lookup_request);
-    GNUNET_free (lu->label);
-    tmp = lu->next;
-    GNUNET_CONTAINER_DLL_remove (handle->parallel_lookups_head,
-                                 handle->parallel_lookups_tail,
-                                 lu);
-    GNUNET_free (lu);
-    lu = tmp;
-  }
-  env = GNUNET_MQ_msg (arm,
-                       GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
-  arm->id = htonl (handle->r_id);
-  arm->attr_len = htons (0);
-  GNUNET_MQ_send (handle->client->mq, env);
-
+  crm->identity = *identity;
+  crm->result = htonl (success);
+  data_tmp = (char *)&crm[1];
+  GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs, data_tmp);
+  GNUNET_MQ_send (cop->client->mq, env);
+  GNUNET_CONTAINER_DLL_remove (cop->client->consume_op_head,
+                               cop->client->consume_op_tail, cop);
+  GNUNET_free (cop);
 }
 
-
 static void
-process_consume_abe_key (void *cls, uint32_t rd_count,
-                         const struct GNUNET_GNSRECORD_Data *rd)
+handle_consume_ticket_message (void *cls, const struct ConsumeTicketMessage 
*cm)
 {
-  struct ConsumeTicketHandle *handle = cls;
-  struct GNUNET_HashCode new_key_hash;
-  struct GNUNET_CRYPTO_SymmetricSessionKey enc_key;
-  struct GNUNET_CRYPTO_SymmetricInitializationVector enc_iv;
-  struct GNUNET_CRYPTO_EcdhePublicKey *ecdh_key;
-  struct ParallelLookup *parallel_lookup;
-  size_t size;
-  char *buf;
-  char *scope;
-
-  handle->lookup_request = NULL;
-  if (1 != rd_count)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Number of keys %d != 1.",
-                rd_count);
-    cleanup_consume_ticket_handle (handle);
-    GNUNET_CONTAINER_DLL_remove (handle->client->consume_op_head,
-                                 handle->client->consume_op_tail,
-                                 handle);
-    GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
-    return;
-  }
-
-  //Decrypt
-  ecdh_key = (struct GNUNET_CRYPTO_EcdhePublicKey *)rd->data;
-
-  buf = GNUNET_malloc (rd->data_size - sizeof (struct 
GNUNET_CRYPTO_EcdhePublicKey));
-
-  //Calculate symmetric key from ecdh parameters
-  GNUNET_assert (GNUNET_OK == 
-                 GNUNET_CRYPTO_ecdsa_ecdh (&handle->identity,
-                                           ecdh_key,
-                                           &new_key_hash));
-  create_sym_key_from_ecdh (&new_key_hash,
-                            &enc_key,
-                            &enc_iv);
-  size = GNUNET_CRYPTO_symmetric_decrypt (rd->data + sizeof (struct 
GNUNET_CRYPTO_EcdhePublicKey),
-                                          rd->data_size - sizeof (struct 
GNUNET_CRYPTO_EcdhePublicKey),
-                                          &enc_key,
-                                          &enc_iv,
-                                          buf);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Decrypted bytes: %zd Expected bytes: %zd\n",
-              size, rd->data_size - sizeof (struct 
GNUNET_CRYPTO_EcdhePublicKey));
-  GNUNET_STATISTICS_update (stats,
-                            "abe_key_lookup_time_total",
-                            GNUNET_TIME_absolute_get_duration 
(handle->lookup_start_time).rel_value_us,
-                            GNUNET_YES);
-  GNUNET_STATISTICS_update (stats,
-                            "abe_key_lookups_count",
-                            1,
-                            GNUNET_YES);
-  scopes = GNUNET_strdup (buf);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Scopes %s\n", scopes);
-  handle->key = GNUNET_ABE_cpabe_deserialize_key ((void*)(buf + strlen 
(scopes) + 1),
-                                                  rd->data_size - sizeof 
(struct GNUNET_CRYPTO_EcdhePublicKey)
-                                                  - strlen (scopes) - 1);
-
-  for (scope = strtok (scopes, ","); NULL != scope; scope = strtok (NULL, ","))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Looking up %s\n", scope);
-    parallel_lookup = GNUNET_new (struct ParallelLookup);
-    parallel_lookup->handle = handle;
-    parallel_lookup->label = GNUNET_strdup (scope);
-    parallel_lookup->lookup_start_time = GNUNET_TIME_absolute_get();
-    parallel_lookup->lookup_request
-      = GNUNET_GNS_lookup (gns_handle,
-                           scope,
-                           &handle->ticket.identity,
-                           GNUNET_GNSRECORD_TYPE_ID_ATTR,
-                           GNUNET_GNS_LO_DEFAULT,
-                           &process_parallel_lookup2,
-                           parallel_lookup);
-    GNUNET_CONTAINER_DLL_insert (handle->parallel_lookups_head,
-                                 handle->parallel_lookups_tail,
-                                 parallel_lookup);
-  }
-  GNUNET_free (scopes);
-  GNUNET_free (buf);
-  handle->kill_task = GNUNET_SCHEDULER_add_delayed 
(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES,3),
-                                                    &abort_parallel_lookups2,
-                                                    handle);
-}
-
-
-static void
-handle_consume_ticket_message (void *cls,
-                               const struct ConsumeTicketMessage *cm)
-{
-  struct ConsumeTicketHandle *ch;
+  struct ConsumeTicketOperation *cop;
+  struct GNUNET_RECLAIM_Ticket *ticket;
   struct IdpClient *idp = cls;
-  char* rnd_label;
-
-  ch = GNUNET_new (struct ConsumeTicketHandle);
-  ch->r_id = ntohl (cm->id);
-  ch->client = idp;
-  ch->identity = cm->identity;
-  ch->attrs = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
-  GNUNET_CRYPTO_ecdsa_key_get_public (&ch->identity,
-                                      &ch->identity_pub);
-  ch->ticket = *((struct GNUNET_RECLAIM_Ticket*)&cm[1]);
-  rnd_label = GNUNET_STRINGS_data_to_string_alloc (&ch->ticket.rnd,
-                                                   sizeof (uint64_t));
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Looking for ABE key under %s\n", rnd_label);
-  ch->lookup_start_time = GNUNET_TIME_absolute_get ();
-  ch->lookup_request
-    = GNUNET_GNS_lookup (gns_handle,
-                         rnd_label,
-                         &ch->ticket.identity,
-                         GNUNET_GNSRECORD_TYPE_ABE_KEY,
-                         GNUNET_GNS_LO_DEFAULT,
-                         &process_consume_abe_key,
-                         ch);
-  GNUNET_CONTAINER_DLL_insert (idp->consume_op_head,
-                               idp->consume_op_tail,
-                               ch);
-  GNUNET_free (rnd_label);
+
+  cop = GNUNET_new (struct ConsumeTicketOperation);
+  cop->r_id = ntohl (cm->id);
+  cop->client = idp;
+  ticket = (struct GNUNET_RECLAIM_Ticket *)&cm[1];
+  cop->ch =
+      RECLAIM_TICKETS_consume (&cm->identity, ticket, &consume_result_cb, cop);
+  GNUNET_CONTAINER_DLL_insert (idp->consume_op_head, idp->consume_op_tail, 
cop);
   GNUNET_SERVICE_client_continue (idp->client);
 }
 
+/*****************************************
+ * Attribute store
+ *****************************************/
+
 /**
  * Cleanup attribute store handle
  *
  * @param handle handle to clean up
  */
 static void
-cleanup_as_handle (struct AttributeStoreHandle *handle)
+cleanup_as_handle (struct AttributeStoreHandle *ash)
 {
-  if (NULL != handle->ns_qe)
-    GNUNET_NAMESTORE_cancel (handle->ns_qe);
-  if (NULL != handle->claim)
-    GNUNET_free (handle->claim);
-  if (NULL != handle->abe_key)
-    GNUNET_ABE_cpabe_delete_master_key (handle->abe_key);
-  GNUNET_free (handle);
+  if (NULL != ash->ns_qe)
+    GNUNET_NAMESTORE_cancel (ash->ns_qe);
+  if (NULL != ash->claim)
+    GNUNET_free (ash->claim);
+  GNUNET_free (ash);
 }
 
 static void
-attr_store_cont (void *cls,
-                 int32_t success,
-                 const char *emsg)
+attr_store_cont (void *cls, int32_t success, const char *emsg)
 {
-  struct AttributeStoreHandle *as_handle = cls;
+  struct AttributeStoreHandle *ash = cls;
   struct GNUNET_MQ_Envelope *env;
   struct AttributeStoreResultMessage *acr_msg;
 
-  as_handle->ns_qe = NULL;
-  GNUNET_CONTAINER_DLL_remove (as_handle->client->store_op_head,
-                               as_handle->client->store_op_tail,
-                               as_handle);
+  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 attribute %s\n",
+  if (GNUNET_SYSERR == success) {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to store attribute %s\n",
                 emsg);
-    cleanup_as_handle (as_handle);
+    cleanup_as_handle (ash);
     GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
     return;
   }
@@ -2012,152 +691,93 @@ attr_store_cont (void *cls,
               "Sending ATTRIBUTE_STORE_RESPONSE message\n");
   env = GNUNET_MQ_msg (acr_msg,
                        GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE_RESPONSE);
-  acr_msg->id = htonl (as_handle->r_id);
+  acr_msg->id = htonl (ash->r_id);
   acr_msg->op_result = htonl (GNUNET_OK);
-  GNUNET_MQ_send (as_handle->client->mq,
-                  env);
-  cleanup_as_handle (as_handle);
+  GNUNET_MQ_send (ash->client->mq, env);
+  cleanup_as_handle (ash);
 }
 
+/**
+ * Adds a new attribute
+ *
+ * @param cls the AttributeStoreHandle
+ */
 static void
 attr_store_task (void *cls)
 {
-  struct AttributeStoreHandle *as_handle = cls;
+  struct AttributeStoreHandle *ash = cls;
   struct GNUNET_GNSRECORD_Data rd[1];
-  char* buf;
-  char* policy;
-  char* enc_buf;
-  char* rd_buf;
-  size_t enc_size;
+  char *buf;
+  char *label;
   size_t buf_size;
-  uint32_t attr_ver;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Storing attribute\n");
-  buf_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (as_handle->claim);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Storing attribute\n");
+  buf_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (ash->claim);
   buf = GNUNET_malloc (buf_size);
-
-  GNUNET_RECLAIM_ATTRIBUTE_serialize (as_handle->claim,
-                                      buf);
-
-  GNUNET_asprintf (&policy,
-                   "%s_%lu",
-                   as_handle->claim->name,
-                   as_handle->claim->version);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Encrypting with policy %s\n", policy);
-  /**
-   * Encrypt the attribute value and store in namestore
-   */
-  enc_size = GNUNET_ABE_cpabe_encrypt (buf,
-                                       buf_size,
-                                       policy, //Policy
-                                       as_handle->abe_key,
-                                       (void**)&enc_buf);
-  if (GNUNET_SYSERR == enc_size)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Failed to encrypt with policy %s\n",
-                policy);
-    GNUNET_CONTAINER_DLL_remove (as_handle->client->store_op_head,
-                                 as_handle->client->store_op_tail,
-                                 as_handle);
-
-    cleanup_as_handle (as_handle);
-    GNUNET_free (buf);
-    GNUNET_free (policy);
-    GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
-    return;
-  }
-  GNUNET_free (buf);
-  GNUNET_free (policy);
-  rd[0].data_size = enc_size + sizeof (uint32_t);
-  rd_buf = GNUNET_malloc (rd[0].data_size);
-  attr_ver = htonl (as_handle->claim->version);
-  GNUNET_memcpy (rd_buf,
-                 &attr_ver,
-                 sizeof (uint32_t));
-  GNUNET_memcpy (rd_buf+sizeof (uint32_t),
-                 enc_buf,
-                 enc_size);
-  rd[0].data = rd_buf;
-  rd[0].record_type = GNUNET_GNSRECORD_TYPE_ID_ATTR;
+  // Give the ash a new id
+  ash->claim->id =
+      GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
+  GNUNET_RECLAIM_ATTRIBUTE_serialize (ash->claim, buf);
+  label =
+      GNUNET_STRINGS_data_to_string_alloc (&ash->claim->id, sizeof (uint64_t));
+  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].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
-  rd[0].expiration_time = as_handle->exp.rel_value_us;
-  as_handle->ns_qe = GNUNET_NAMESTORE_records_store (ns_handle,
-                                                     &as_handle->identity,
-                                                     as_handle->claim->name,
-                                                     1,
-                                                     rd,
-                                                     &attr_store_cont,
-                                                     as_handle);
-  GNUNET_free (enc_buf);
-  GNUNET_free (rd_buf);
-}
-
-
-static void
-store_after_abe_bootstrap (void *cls,
-                           struct GNUNET_ABE_AbeMasterKey *abe_key)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Finished ABE bootstrap\n");
-  struct AttributeStoreHandle *ash = cls;
-  ash->abe_key = abe_key;
-  GNUNET_SCHEDULER_add_now (&attr_store_task, ash);
+  rd[0].expiration_time = ash->exp.rel_value_us;
+  ash->ns_qe = GNUNET_NAMESTORE_records_store (nsh, &ash->identity, label, 1,
+                                               rd, &attr_store_cont, ash);
+  GNUNET_free (buf);
 }
 
 static int
-check_attribute_store_message(void *cls,
-                              const struct AttributeStoreMessage *sam)
+check_attribute_store_message (void *cls,
+                               const struct AttributeStoreMessage *sam)
 {
   uint16_t size;
 
   size = ntohs (sam->header.size);
-  if (size <= sizeof (struct AttributeStoreMessage))
-  {
+  if (size <= sizeof (struct AttributeStoreMessage)) {
     GNUNET_break (0);
     return GNUNET_SYSERR;
   }
   return GNUNET_OK;
 }
 
-
 static void
 handle_attribute_store_message (void *cls,
                                 const struct AttributeStoreMessage *sam)
 {
-  struct AttributeStoreHandle *as_handle;
+  struct AttributeStoreHandle *ash;
   struct IdpClient *idp = cls;
   size_t data_len;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received ATTRIBUTE_STORE message\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_STORE message\n");
 
   data_len = ntohs (sam->attr_len);
 
-  as_handle = GNUNET_new (struct AttributeStoreHandle);
-  as_handle->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize ((char*)&sam[1],
-                                                           data_len);
+  ash = GNUNET_new (struct AttributeStoreHandle);
+  ash->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize ((char *)&sam[1], 
data_len);
 
-  as_handle->r_id = ntohl (sam->id);
-  as_handle->identity = sam->identity;
-  as_handle->exp.rel_value_us = GNUNET_ntohll (sam->exp);
-  GNUNET_CRYPTO_ecdsa_key_get_public (&sam->identity,
-                                      &as_handle->identity_pkey);
+  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);
-  as_handle->client = idp;
-  GNUNET_CONTAINER_DLL_insert (idp->store_op_head,
-                               idp->store_op_tail,
-                               as_handle);
-  bootstrap_abe (&as_handle->identity, &store_after_abe_bootstrap, as_handle, 
GNUNET_NO);
+  ash->client = idp;
+  GNUNET_CONTAINER_DLL_insert (idp->store_op_head, idp->store_op_tail, ash);
+  GNUNET_SCHEDULER_add_now (&attr_store_task, ash);
 }
 
+/*************************************************
+ * Attrubute iteration
+ *************************************************/
+
 static void
 cleanup_attribute_iter_handle (struct AttributeIterator *ai)
 {
-  if (NULL != ai->abe_key)
-    GNUNET_ABE_cpabe_delete_master_key (ai->abe_key);
   GNUNET_free (ai);
 }
 
@@ -2165,12 +785,9 @@ static void
 attr_iter_error (void *cls)
 {
   struct AttributeIterator *ai = cls;
-  //TODO
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-              "Failed to iterate over attributes\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attributes\n");
   GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head,
-                               ai->client->attr_iter_tail,
-                               ai);
+                               ai->client->attr_iter_tail, ai);
   cleanup_attribute_iter_handle (ai);
   GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
 }
@@ -2182,118 +799,45 @@ attr_iter_finished (void *cls)
   struct GNUNET_MQ_Envelope *env;
   struct AttributeResultMessage *arm;
 
-  env = GNUNET_MQ_msg (arm,
-                       GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
+  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);
+                               ai->client->attr_iter_tail, ai);
   cleanup_attribute_iter_handle (ai);
 }
 
 static void
-attr_iter_cb (void *cls,
-              const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
-              const char *label,
-              unsigned int rd_count,
+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 AttributeIterator *ai = cls;
   struct AttributeResultMessage *arm;
-  struct GNUNET_ABE_AbeKey *key;
   struct GNUNET_MQ_Envelope *env;
-  ssize_t msg_extra_len;
-  char* attr_ser;
-  char* attrs[2];
-  char* data_tmp;
-  char* policy;
-  uint32_t attr_ver;
-
-  if (rd_count != 1)
-  {
-    GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it,
-                                         1);
-    return;
-  }
+  char *data_tmp;
 
-  if (GNUNET_GNSRECORD_TYPE_ID_ATTR != rd->record_type)
-  {
-    GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it,
-                                         1);
+  if (rd_count != 1) {
+    GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
     return;
   }
-  attr_ver = ntohl(*((uint32_t*)rd->data));
-  GNUNET_asprintf (&policy, "%s_%lu",
-                   label, attr_ver);
-  attrs[0] = policy;
-  attrs[1] = 0;
-  key = GNUNET_ABE_cpabe_create_key (ai->abe_key,
-                                     attrs);
-  msg_extra_len = GNUNET_ABE_cpabe_decrypt (rd->data+sizeof (uint32_t),
-                                            rd->data_size-sizeof (uint32_t),
-                                            key,
-                                            (void**)&attr_ser);
-  if (GNUNET_SYSERR == msg_extra_len)
-  {
-    GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it,
-                                         1);
+
+  if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR != rd->record_type) {
+    GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
     return;
   }
-
-  GNUNET_ABE_cpabe_delete_key (key,
-                               GNUNET_YES);
-  //GNUNET_free (policy);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Found attribute: %s\n", label);
-  env = GNUNET_MQ_msg_extra (arm,
-                             msg_extra_len,
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n", label);
+  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 (msg_extra_len);
-  GNUNET_CRYPTO_ecdsa_key_get_public (zone,
-                                      &arm->identity);
-  data_tmp = (char *) &arm[1];
-  GNUNET_memcpy (data_tmp,
-                 attr_ser,
-                 msg_extra_len);
+  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);
-  GNUNET_free (attr_ser);
-  GNUNET_ABE_cpabe_delete_master_key (ai->abe_key);
-  ai->abe_key = NULL;
 }
 
-
-void
-iterate_after_abe_bootstrap (void *cls,
-                             struct GNUNET_ABE_AbeMasterKey *abe_key)
-{
-  struct AttributeIterator *ai = cls;
-  ai->abe_key = abe_key;
-  ai->ns_it = GNUNET_NAMESTORE_zone_iteration_start (ns_handle,
-                                                     &ai->identity,
-                                                     &attr_iter_error,
-                                                     ai,
-                                                     &attr_iter_cb,
-                                                     ai,
-                                                     &attr_iter_finished,
-                                                     ai);
-}
-
-
-static void
-iterate_next_after_abe_bootstrap (void *cls,
-                                  struct GNUNET_ABE_AbeMasterKey *abe_key)
-{
-  struct AttributeIterator *ai = cls;
-  ai->abe_key = abe_key;
-  GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it,
-                                       1);
-}
-
-
-
 static void
 handle_iteration_start (void *cls,
                         const struct AttributeIterationStartMessage *ais_msg)
@@ -2308,14 +852,13 @@ handle_iteration_start (void *cls,
   ai->client = idp;
   ai->identity = ais_msg->identity;
 
-  GNUNET_CONTAINER_DLL_insert (idp->attr_iter_head,
-                               idp->attr_iter_tail,
-                               ai);
-  bootstrap_abe (&ai->identity, &iterate_after_abe_bootstrap, ai, GNUNET_NO);
+  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);
 }
 
-
 static void
 handle_iteration_stop (void *cls,
                        const struct AttributeIterationStopMessage *ais_msg)
@@ -2324,27 +867,22 @@ handle_iteration_stop (void *cls,
   struct AttributeIterator *ai;
   uint32_t rid;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received `%s' message\n",
+  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)
-  {
+  if (NULL == ai) {
     GNUNET_break (0);
     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->attr_iter_head, idp->attr_iter_tail, ai);
   GNUNET_free (ai);
   GNUNET_SERVICE_client_continue (idp->client);
 }
 
-
 static void
 handle_iteration_next (void *cls,
                        const struct AttributeIterationNextMessage *ais_msg)
@@ -2359,152 +897,45 @@ handle_iteration_next (void *cls,
   for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
     if (ai->request_id == rid)
       break;
-  if (NULL == ai)
-  {
+  if (NULL == ai) {
     GNUNET_break (0);
     GNUNET_SERVICE_client_drop (idp->client);
     return;
   }
-  bootstrap_abe (&ai->identity,
-                 &iterate_next_after_abe_bootstrap,
-                 ai,
-                 GNUNET_NO);
+  GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
   GNUNET_SERVICE_client_continue (idp->client);
 }
 
-/**
- * Ticket iteration processor result
- */
-enum ZoneIterationResult
-{
-  /**
-   * Iteration start.
-   */
-  IT_START = 0,
-
-  /**
-   * Found tickets,
-   * Continue to iterate with next iteration_next call
-   */
-  IT_SUCCESS_MORE_AVAILABLE = 1,
-
-  /**
-   * Iteration complete
-   */
-  IT_SUCCESS_NOT_MORE_RESULTS_AVAILABLE = 2
-};
-
-
-/**
- * Context for ticket iteration
- */
-struct TicketIterationProcResult
-{
-  /**
-   * The ticket iteration handle
-   */
-  struct TicketIteration *ti;
-
-  /**
-   * Iteration result: iteration done?
-   * #IT_SUCCESS_MORE_AVAILABLE:  if there may be more results overall but
-   * we got one for now and have sent it to the client
-   * #IT_SUCCESS_NOT_MORE_RESULTS_AVAILABLE: if there are no further results,
-   * #IT_START: if we are still trying to find a result.
-   */
-  int res_iteration_finished;
-
-};
-
-static void
-cleanup_ticket_iter_handle (struct TicketIteration *ti)
-{
-  GNUNET_free (ti);
-}
-
-/**
- * Process ticket from database
- *
- * @param cls struct TicketIterationProcResult
- * @param ticket the ticket
- * @param attrs the attributes
- */
-static void
-ticket_iterate_proc (void *cls,
-                     const struct GNUNET_RECLAIM_Ticket *ticket,
-                     const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
-{
-  struct TicketIterationProcResult *proc = cls;
-
-  if (NULL == ticket)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Iteration done\n");
-    proc->res_iteration_finished = IT_SUCCESS_NOT_MORE_RESULTS_AVAILABLE;
-    return;
-  }
-  proc->res_iteration_finished = IT_SUCCESS_MORE_AVAILABLE;
-  send_ticket_result (proc->ti->client,
-                      proc->ti->r_id,
-                      ticket,
-                      attrs);
-
-}
+/******************************************************
+ * Ticket iteration
+ ******************************************************/
 
-/**
- * Perform ticket iteration step
- *
- * @param ti ticket iterator to process
- */
 static void
-run_ticket_iteration_round (struct TicketIteration *ti)
+ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket)
 {
-  struct TicketIterationProcResult proc;
+  struct TicketIteration *ti = cls;
   struct GNUNET_MQ_Envelope *env;
   struct TicketResultMessage *trm;
-  int ret;
-
-  memset (&proc, 0, sizeof (proc));
-  proc.ti = ti;
-  proc.res_iteration_finished = IT_START;
-  while (IT_START == proc.res_iteration_finished)
-  {
-    if (GNUNET_SYSERR ==
-        (ret = TKT_database->iterate_tickets (TKT_database->cls,
-                                              &ti->identity,
-                                              ti->is_audience,
-                                              ti->offset,
-                                              &ticket_iterate_proc,
-                                              &proc)))
-    {
-      GNUNET_break (0);
-      break;
-    }
-    if (GNUNET_NO == ret)
-      proc.res_iteration_finished = IT_SUCCESS_NOT_MORE_RESULTS_AVAILABLE;
-    ti->offset++;
-  }
-  if (IT_SUCCESS_MORE_AVAILABLE == proc.res_iteration_finished)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "More results available\n");
-    return; /* more later */
+
+  if (NULL == ticket) {
+    /* send empty response to indicate end of list */
+    env = GNUNET_MQ_msg (trm, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
+    GNUNET_CONTAINER_DLL_remove (ti->client->ticket_iter_head,
+                                 ti->client->ticket_iter_tail, ti);
+  } else {
+    env = GNUNET_MQ_msg_extra (trm, sizeof (struct GNUNET_RECLAIM_Ticket),
+                               GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
+    memcpy (&trm[1], ticket, sizeof (struct GNUNET_RECLAIM_Ticket));
   }
-  /* send empty response to indicate end of list */
-  env = GNUNET_MQ_msg (trm,
-                       GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
   trm->id = htonl (ti->r_id);
-  GNUNET_MQ_send (ti->client->mq,
-                  env);
-  GNUNET_CONTAINER_DLL_remove (ti->client->ticket_iter_head,
-                               ti->client->ticket_iter_tail,
-                               ti);
-  cleanup_ticket_iter_handle (ti);
+  GNUNET_MQ_send (ti->client->mq, env);
+  if (NULL == ticket)
+    GNUNET_free (ti);
 }
 
 static void
-handle_ticket_iteration_start (void *cls,
-                               const struct TicketIterationStartMessage 
*tis_msg)
+handle_ticket_iteration_start (
+    void *cls, const struct TicketIterationStartMessage *tis_msg)
 {
   struct IdpClient *client = cls;
   struct TicketIteration *ti;
@@ -2513,19 +944,15 @@ handle_ticket_iteration_start (void *cls,
               "Received TICKET_ITERATION_START message\n");
   ti = GNUNET_new (struct TicketIteration);
   ti->r_id = ntohl (tis_msg->id);
-  ti->offset = 0;
   ti->client = client;
-  ti->identity = tis_msg->identity;
-  ti->is_audience = ntohl (tis_msg->is_audience);
 
   GNUNET_CONTAINER_DLL_insert (client->ticket_iter_head,
-                               client->ticket_iter_tail,
-                               ti);
-  run_ticket_iteration_round (ti);
+                               client->ticket_iter_tail, ti);
+  ti->iter =
+      RECLAIM_TICKETS_iteration_start (&tis_msg->identity, &ticket_iter_cb, 
ti);
   GNUNET_SERVICE_client_continue (client->client);
 }
 
-
 static void
 handle_ticket_iteration_stop (void *cls,
                               const struct TicketIterationStopMessage *tis_msg)
@@ -2534,27 +961,24 @@ handle_ticket_iteration_stop (void *cls,
   struct TicketIteration *ti;
   uint32_t rid;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received `%s' message\n",
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n",
               "TICKET_ITERATION_STOP");
   rid = ntohl (tis_msg->id);
   for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next)
     if (ti->r_id == rid)
       break;
-  if (NULL == ti)
-  {
+  if (NULL == ti) {
     GNUNET_break (0);
     GNUNET_SERVICE_client_drop (client->client);
     return;
   }
+  RECLAIM_TICKETS_iteration_stop (ti->iter);
   GNUNET_CONTAINER_DLL_remove (client->ticket_iter_head,
-                               client->ticket_iter_tail,
-                               ti);
-  cleanup_ticket_iter_handle (ti);
+                               client->ticket_iter_tail, ti);
+  GNUNET_free (ti);
   GNUNET_SERVICE_client_continue (client->client);
 }
 
-
 static void
 handle_ticket_iteration_next (void *cls,
                               const struct TicketIterationNextMessage *tis_msg)
@@ -2569,89 +993,63 @@ handle_ticket_iteration_next (void *cls,
   for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next)
     if (ti->r_id == rid)
       break;
-  if (NULL == ti)
-  {
+  if (NULL == ti) {
     GNUNET_break (0);
     GNUNET_SERVICE_client_drop (client->client);
     return;
   }
-  run_ticket_iteration_round (ti);
+  RECLAIM_TICKETS_iteration_next (ti->iter);
   GNUNET_SERVICE_client_continue (client->client);
 }
 
-
-
-
 /**
  * Main function that will be run
  *
  * @param cls closure
- * @param c the configuration used 
+ * @param c the configuration used
  * @param server the service handle
  */
 static void
-run (void *cls,
-     const struct GNUNET_CONFIGURATION_Handle *c,
+run (void *cls, const struct GNUNET_CONFIGURATION_Handle *c,
      struct GNUNET_SERVICE_Handle *server)
 {
   char *database;
   cfg = c;
 
-  stats = GNUNET_STATISTICS_create ("reclaim", cfg);
-
-  //Connect to identity and namestore services
-  ns_handle = GNUNET_NAMESTORE_connect (cfg);
-  if (NULL == ns_handle)
-  {
-    GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "error connecting to 
namestore");
-  }
-
-  gns_handle = GNUNET_GNS_connect (cfg);
-  if (NULL == gns_handle)
-  {
-    GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "error connecting to gns");
+  if (GNUNET_OK != RECLAIM_TICKETS_init (cfg)) {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Unable to initialized TICKETS subsystem.\n");
+    GNUNET_SCHEDULER_shutdown ();
+    return;
   }
-  credential_handle = GNUNET_CREDENTIAL_connect (cfg);
-  if (NULL == credential_handle)
-  {
-    GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "error connecting to 
credential");
+  // Connect to identity and namestore services
+  nsh = GNUNET_NAMESTORE_connect (cfg);
+  if (NULL == nsh) {
+    GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
+                         "error connecting to namestore");
   }
-  identity_handle = GNUNET_IDENTITY_connect (cfg,
-                                             NULL,
-                                             NULL);
+
+  identity_handle = GNUNET_IDENTITY_connect (cfg, NULL, NULL);
   /* Loading DB plugin */
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_string (cfg,
-                                             "reclaim",
-                                             "database",
-                                             &database))
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "No database backend configured\n");
-  GNUNET_asprintf (&db_lib_name,
-                   "libgnunet_plugin_reclaim_%s",
-                   database);
-  TKT_database = GNUNET_PLUGIN_load (db_lib_name,
-                                     (void *) cfg);
+  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (
+                       cfg, "reclaim", "database", &database))
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No database backend configured\n");
+  GNUNET_asprintf (&db_lib_name, "libgnunet_plugin_reclaim_%s", database);
+  TKT_database = GNUNET_PLUGIN_load (db_lib_name, (void *)cfg);
   GNUNET_free (database);
-  if (NULL == TKT_database)
-  {
+  if (NULL == TKT_database) {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Could not load database backend `%s'\n",
-                db_lib_name);
+                "Could not load database backend `%s'\n", db_lib_name);
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
 
-  if (GNUNET_OK ==
-      GNUNET_CONFIGURATION_get_value_time (cfg,
-                                           "reclaim",
-                                           "TOKEN_EXPIRATION_INTERVAL",
-                                           &token_expiration_interval))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Time window for zone iteration: %s\n",
-                GNUNET_STRINGS_relative_time_to_string 
(token_expiration_interval,
-                                                        GNUNET_YES));
+  if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_time (
+                       cfg, "reclaim", "TOKEN_EXPIRATION_INTERVAL",
+                       &token_expiration_interval)) {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Time window for zone iteration: 
%s\n",
+                GNUNET_STRINGS_relative_time_to_string (
+                    token_expiration_interval, GNUNET_YES));
   } else {
     token_expiration_interval = DEFAULT_TOKEN_EXPIRATION_INTERVAL;
   }
@@ -2667,71 +1065,55 @@ run (void *cls,
  * @param app_ctx @a client
  */
 static void
-client_disconnect_cb (void *cls,
-                      struct GNUNET_SERVICE_Client *client,
+client_disconnect_cb (void *cls, struct GNUNET_SERVICE_Client *client,
                       void *app_ctx)
 {
   struct IdpClient *idp = app_ctx;
   struct AttributeIterator *ai;
   struct TicketIteration *ti;
-  struct TicketRevocationHandle *rh;
-  struct TicketIssueHandle *iss;
-  struct ConsumeTicketHandle *ct;
+  struct TicketRevocationOperation *rop;
+  struct TicketIssueOperation *iss;
+  struct ConsumeTicketOperation *ct;
   struct AttributeStoreHandle *as;
 
-  //TODO other operations
+  // TODO other operations
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Client %p disconnected\n",
-              client);
-
-  while (NULL != (iss = idp->issue_op_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (idp->issue_op_head,
-                                 idp->issue_op_tail,
-                                 iss);
-    cleanup_ticket_issue_handle (iss);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client);
+
+  while (NULL != (iss = idp->issue_op_head)) {
+    GNUNET_CONTAINER_DLL_remove (idp->issue_op_head, idp->issue_op_tail, iss);
+    GNUNET_free (iss);
   }
-  while (NULL != (ct = idp->consume_op_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (idp->consume_op_head,
-                                 idp->consume_op_tail,
+  while (NULL != (ct = idp->consume_op_head)) {
+    GNUNET_CONTAINER_DLL_remove (idp->consume_op_head, idp->consume_op_tail,
                                  ct);
-    cleanup_consume_ticket_handle (ct);
+    if (NULL != ct->ch)
+      RECLAIM_TICKETS_consume_cancel (ct->ch);
+    GNUNET_free (ct);
   }
-  while (NULL != (as = idp->store_op_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (idp->store_op_head,
-                                 idp->store_op_tail,
-                                 as);
+  while (NULL != (as = idp->store_op_head)) {
+    GNUNET_CONTAINER_DLL_remove (idp->store_op_head, idp->store_op_tail, as);
     cleanup_as_handle (as);
   }
 
-  while (NULL != (ai = idp->attr_iter_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head,
-                                 idp->attr_iter_tail,
-                                 ai);
+  while (NULL != (ai = idp->attr_iter_head)) {
+    GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, idp->attr_iter_tail, ai);
     cleanup_attribute_iter_handle (ai);
   }
-  while (NULL != (rh = idp->revoke_op_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (idp->revoke_op_head,
-                                 idp->revoke_op_tail,
-                                 rh);
-    cleanup_revoke_ticket_handle (rh);
+  while (NULL != (rop = idp->revoke_op_head)) {
+    GNUNET_CONTAINER_DLL_remove (idp->revoke_op_head, idp->revoke_op_tail, 
rop);
+    if (NULL != rop->rh)
+      RECLAIM_TICKETS_revoke_cancel (rop->rh);
+    GNUNET_free (rop);
   }
-  while (NULL != (ti = idp->ticket_iter_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (idp->ticket_iter_head,
-                                 idp->ticket_iter_tail,
+  while (NULL != (ti = idp->ticket_iter_head)) {
+    GNUNET_CONTAINER_DLL_remove (idp->ticket_iter_head, idp->ticket_iter_tail,
                                  ti);
-    cleanup_ticket_iter_handle (ti);
+    GNUNET_free (ti);
   }
   GNUNET_free (idp);
 }
 
-
 /**
  * Add a client to our list of active clients.
  *
@@ -2741,71 +1123,52 @@ client_disconnect_cb (void *cls,
  * @return internal namestore client structure for this client
  */
 static void *
-client_connect_cb (void *cls,
-                   struct GNUNET_SERVICE_Client *client,
+client_connect_cb (void *cls, struct GNUNET_SERVICE_Client *client,
                    struct GNUNET_MQ_Handle *mq)
 {
   struct IdpClient *idp;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Client %p connected\n",
-              client);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", client);
   idp = GNUNET_new (struct IdpClient);
   idp->client = client;
   idp->mq = mq;
   return idp;
 }
 
-
-
 /**
  * Define "main" method using service macro.
  */
-GNUNET_SERVICE_MAIN
-("reclaim",
- GNUNET_SERVICE_OPTION_NONE,
- &run,
- &client_connect_cb,
- &client_disconnect_cb,
- NULL,
- GNUNET_MQ_hd_var_size (attribute_store_message,
-                        GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE,
-                        struct AttributeStoreMessage,
-                        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,
-                          NULL),
- GNUNET_MQ_hd_fixed_size (iteration_stop, 
-                          GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP,
-                          struct AttributeIterationStopMessage,
-                          NULL),
- GNUNET_MQ_hd_var_size (issue_ticket_message,
-                        GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET,
-                        struct IssueTicketMessage,
-                        NULL),
- GNUNET_MQ_hd_var_size (consume_ticket_message,
-                        GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET,
-                        struct ConsumeTicketMessage,
-                        NULL),
- GNUNET_MQ_hd_fixed_size (ticket_iteration_start, 
-                          GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START,
-                          struct TicketIterationStartMessage,
-                          NULL),
- GNUNET_MQ_hd_fixed_size (ticket_iteration_next, 
-                          GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT,
-                          struct TicketIterationNextMessage,
-                          NULL),
- GNUNET_MQ_hd_fixed_size (ticket_iteration_stop, 
-                          GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP,
-                          struct TicketIterationStopMessage,
-                          NULL),
- GNUNET_MQ_hd_var_size (revoke_ticket_message,
-                        GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET,
-                        struct RevokeTicketMessage,
-                        NULL),
- GNUNET_MQ_handler_end());
+GNUNET_SERVICE_MAIN (
+    "reclaim", GNUNET_SERVICE_OPTION_NONE, &run, &client_connect_cb,
+    &client_disconnect_cb, NULL,
+    GNUNET_MQ_hd_var_size (attribute_store_message,
+                           GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE,
+                           struct AttributeStoreMessage, 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, NULL),
+    GNUNET_MQ_hd_fixed_size (
+        iteration_stop, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP,
+        struct AttributeIterationStopMessage, NULL),
+    GNUNET_MQ_hd_var_size (issue_ticket_message,
+                           GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET,
+                           struct IssueTicketMessage, NULL),
+    GNUNET_MQ_hd_var_size (consume_ticket_message,
+                           GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET,
+                           struct ConsumeTicketMessage, NULL),
+    GNUNET_MQ_hd_fixed_size (ticket_iteration_start,
+                             
GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START,
+                             struct TicketIterationStartMessage, NULL),
+    GNUNET_MQ_hd_fixed_size (ticket_iteration_next,
+                             GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT,
+                             struct TicketIterationNextMessage, NULL),
+    GNUNET_MQ_hd_fixed_size (ticket_iteration_stop,
+                             GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP,
+                             struct TicketIterationStopMessage, NULL),
+    GNUNET_MQ_hd_var_size (revoke_ticket_message,
+                           GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET,
+                           struct RevokeTicketMessage, NULL),
+    GNUNET_MQ_handler_end ());
 /* end of gnunet-service-reclaim.c */
diff --git a/src/reclaim/gnunet-service-reclaim_tickets.c 
b/src/reclaim/gnunet-service-reclaim_tickets.c
new file mode 100644
index 000000000..549ea8c34
--- /dev/null
+++ b/src/reclaim/gnunet-service-reclaim_tickets.c
@@ -0,0 +1,1041 @@
+/*
+   This file is part of GNUnet.
+   Copyright (C) 2012-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
+   */
+
+/**
+ * @author Martin Schanzenbach
+ * @file src/reclaim/gnunet-service-reclaim_tickets.c
+ * @brief reclaim tickets
+ *
+ */
+#include <inttypes.h>
+
+#include "gnunet-service-reclaim_tickets.h"
+
+struct ParallelLookup;
+
+struct RECLAIM_TICKETS_ConsumeHandle
+{
+  /**
+   * Ticket
+   */
+  struct GNUNET_RECLAIM_Ticket ticket;
+
+  /**
+   * LookupRequest
+   */
+  struct GNUNET_GNS_LookupRequest *lookup_request;
+
+  /**
+   * Audience Key
+   */
+  struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
+
+  /**
+   * Audience Key
+   */
+  struct GNUNET_CRYPTO_EcdsaPublicKey identity_pub;
+
+  /**
+   * Lookup DLL
+   */
+  struct ParallelLookup *parallel_lookups_head;
+
+  /**
+   * Lookup DLL
+   */
+  struct ParallelLookup *parallel_lookups_tail;
+
+  /**
+   * Kill task
+   */
+  struct GNUNET_SCHEDULER_Task *kill_task;
+
+  /**
+   * Attributes
+   */
+  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
+
+  /**
+   * Lookup time
+   */
+  struct GNUNET_TIME_Absolute lookup_start_time;
+
+  /**
+   * Callback
+   */
+  RECLAIM_TICKETS_ConsumeCallback cb;
+
+  /**
+   * Callbacl closure
+   */
+  void *cb_cls;
+};
+
+/**
+ * Handle for a parallel GNS lookup job
+ */
+struct ParallelLookup
+{
+  /* DLL */
+  struct ParallelLookup *next;
+
+  /* DLL */
+  struct ParallelLookup *prev;
+
+  /* The GNS request */
+  struct GNUNET_GNS_LookupRequest *lookup_request;
+
+  /* The handle the return to */
+  struct RECLAIM_TICKETS_ConsumeHandle *handle;
+
+  /**
+   * Lookup time
+   */
+  struct GNUNET_TIME_Absolute lookup_start_time;
+
+  /* The label to look up */
+  char *label;
+};
+
+
+/**
+ * A reference to a ticket stored in GNS
+ */
+struct TicketReference
+{
+  /**
+   * DLL
+   */
+  struct TicketReference *next;
+
+  /**
+   * DLL
+   */
+  struct TicketReference *prev;
+
+  /**
+   * Attributes
+   */
+  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
+
+  /**
+   * Tickets
+   */
+  struct GNUNET_RECLAIM_Ticket ticket;
+};
+
+
+/**
+ * Ticket issue request handle
+ */
+struct TicketIssueHandle
+{
+  /**
+   * Attributes to issue
+   */
+  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
+
+  /**
+   * Issuer Key
+   */
+  struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
+
+  /**
+   * Ticket to issue
+   */
+  struct GNUNET_RECLAIM_Ticket ticket;
+
+  /**
+   * QueueEntry
+   */
+  struct GNUNET_NAMESTORE_QueueEntry *ns_qe;
+
+  /**
+   * Callback
+   */
+  RECLAIM_TICKETS_TicketResult cb;
+
+  /**
+   * Callback cls
+   */
+  void *cb_cls;
+};
+
+/**
+ * Ticket iterator
+ */
+struct RECLAIM_TICKETS_Iterator
+{
+  /**
+   * Namestore queue entry
+   */
+  struct GNUNET_NAMESTORE_ZoneIterator *ns_it;
+
+  /**
+   * Iter callback
+   */
+  RECLAIM_TICKETS_TicketIter cb;
+
+  /**
+   * Iter cls
+   */
+  void *cb_cls;
+};
+
+
+struct RevokedAttributeEntry
+{
+  /**
+   * DLL
+   */
+  struct RevokedAttributeEntry *next;
+
+  /**
+   * DLL
+   */
+  struct RevokedAttributeEntry *prev;
+
+  /**
+   * Old ID of the attribute
+   */
+  uint64_t old_id;
+
+  /**
+   * New ID of the attribute
+   */
+  uint64_t new_id;
+};
+
+
+struct TicketRecordsEntry
+{
+  /**
+   * DLL
+   */
+  struct TicketRecordsEntry *next;
+
+  /**
+   * DLL
+   */
+  struct TicketRecordsEntry *prev;
+
+  /**
+   * Record count
+   */
+  unsigned int rd_count;
+
+  /**
+   * Data
+   */
+  char *data;
+
+  /**
+   * Data size
+   */
+  size_t data_size;
+
+  /**
+   * Label
+   */
+  char *label;
+};
+
+/**
+ * Ticket revocation request handle
+ */
+struct RECLAIM_TICKETS_RevokeHandle
+{
+  /**
+   * Issuer Key
+   */
+  struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
+
+  /**
+   * Callback
+   */
+  RECLAIM_TICKETS_RevokeCallback cb;
+
+  /**
+   * Callback cls
+   */
+  void *cb_cls;
+
+  /**
+   * Ticket to issue
+   */
+  struct GNUNET_RECLAIM_Ticket ticket;
+
+  /**
+   * QueueEntry
+   */
+  struct GNUNET_NAMESTORE_QueueEntry *ns_qe;
+
+  /**
+   * Namestore iterator
+   */
+  struct GNUNET_NAMESTORE_ZoneIterator *ns_it;
+
+  /**
+   * Revoked attributes
+   */
+  struct RevokedAttributeEntry *attrs_head;
+
+  /**
+   * Revoked attributes
+   */
+  struct RevokedAttributeEntry *attrs_tail;
+
+  /**
+   * Current attribute to move
+   */
+  struct RevokedAttributeEntry *move_attr;
+
+  /**
+   * Number of attributes in ticket
+   */
+  unsigned int ticket_attrs;
+
+  /**
+   * Tickets to update
+   */
+  struct TicketRecordsEntry *tickets_to_update_head;
+
+  /**
+   * Tickets to update
+   */
+  struct TicketRecordsEntry *tickets_to_update_tail;
+};
+
+
+/* Namestore handle */
+static struct GNUNET_NAMESTORE_Handle *nsh;
+
+/* GNS handle */
+static struct GNUNET_GNS_Handle *gns;
+
+/* Handle to the statistics service */
+static struct GNUNET_STATISTICS_Handle *stats;
+
+static void
+move_attrs (struct RECLAIM_TICKETS_RevokeHandle *rh);
+
+static void
+move_attrs_cont (void *cls)
+{
+  move_attrs ((struct RECLAIM_TICKETS_RevokeHandle *)cls);
+}
+
+/**
+ * Cleanup revoke handle
+ *
+ * @param rh the ticket revocation handle
+ */
+static void
+cleanup_rvk (struct RECLAIM_TICKETS_RevokeHandle *rh)
+{
+  struct RevokedAttributeEntry *ae;
+  struct TicketRecordsEntry *le;
+  if (NULL != rh->ns_qe)
+    GNUNET_NAMESTORE_cancel (rh->ns_qe);
+  if (NULL != rh->ns_it)
+    GNUNET_NAMESTORE_zone_iteration_stop (rh->ns_it);
+  while (NULL != (ae = rh->attrs_head)) {
+    GNUNET_CONTAINER_DLL_remove (rh->attrs_head, rh->attrs_tail, ae);
+    GNUNET_free (ae);
+  }
+  while (NULL != (le = rh->tickets_to_update_head)) {
+    GNUNET_CONTAINER_DLL_remove (rh->tickets_to_update_head,
+                                 rh->tickets_to_update_head, le);
+    if (NULL != le->data)
+      GNUNET_free (le->data);
+    if (NULL != le->label)
+      GNUNET_free (le->label);
+    GNUNET_free (le);
+  }
+  GNUNET_free (rh);
+}
+
+static void
+del_attr_finished (void *cls, int32_t success, const char *emsg)
+{
+  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
+  rvk->ns_qe = NULL;
+  if (GNUNET_SYSERR == success) {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error removing attribute: %s\n",
+                emsg);
+    rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
+    cleanup_rvk (rvk);
+    return;
+  }
+  rvk->move_attr = rvk->move_attr->next;
+  GNUNET_SCHEDULER_add_now (&move_attrs_cont, rvk);
+}
+
+static void
+move_attr_finished (void *cls, int32_t success, const char *emsg)
+{
+  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
+  char *label;
+  rvk->ns_qe = NULL;
+  if (GNUNET_SYSERR == success) {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error moving attribute: %s\n", emsg);
+    rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
+    cleanup_rvk (rvk);
+    return;
+  }
+  label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->old_id,
+                                               sizeof (uint64_t));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing attribute %s\n", label);
+  rvk->ns_qe = GNUNET_NAMESTORE_records_store (nsh, &rvk->identity, label, 0,
+                                               NULL, &del_attr_finished, rvk);
+}
+
+
+static void
+rvk_move_attr_cb (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
+                  const char *label, unsigned int rd_count,
+                  const struct GNUNET_GNSRECORD_Data *rd)
+{
+  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
+  struct RevokedAttributeEntry *le;
+  char *new_label;
+  rvk->ns_qe = NULL;
+  if (0 == rd_count) {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "The attribute %s no longer exists!\n", label);
+    le = rvk->move_attr;
+    rvk->move_attr = le->next;
+    GNUNET_CONTAINER_DLL_remove (rvk->attrs_head, rvk->attrs_tail, le);
+    GNUNET_free (le);
+    GNUNET_SCHEDULER_add_now (&move_attrs_cont, rvk);
+    return;
+  }
+  /** find a new place for this attribute **/
+  rvk->move_attr->new_id =
+      GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
+  new_label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id,
+                                                   sizeof (uint64_t));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label);
+  rvk->ns_qe = GNUNET_NAMESTORE_records_store (nsh, &rvk->identity, new_label,
+                                               1, rd, &move_attr_finished, 
rvk);
+  GNUNET_free (new_label);
+}
+
+
+static void
+rvk_ticket_update (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
+                   const char *label, unsigned int rd_count,
+                   const struct GNUNET_GNSRECORD_Data *rd)
+{
+  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
+  struct TicketRecordsEntry *le;
+  struct RevokedAttributeEntry *ae;
+  int has_changed = GNUNET_NO;
+
+  /** 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)
+      continue;
+    for (ae = rvk->attrs_head; NULL != ae; ae = ae->next) {
+      if (0 != memcmp (rd[i].data, &ae->old_id, sizeof (uint64_t)))
+        continue;
+      has_changed = GNUNET_YES;
+      break;
+    }
+    if (GNUNET_YES == has_changed)
+      break;
+  }
+  if (GNUNET_YES == has_changed) {
+    le = GNUNET_new (struct TicketRecordsEntry);
+    le->data_size = GNUNET_GNSRECORD_records_get_size (rd_count, rd);
+    le->data = GNUNET_malloc (le->data_size);
+    le->rd_count = rd_count;
+    le->label = GNUNET_strdup (label);
+    GNUNET_GNSRECORD_records_serialize (rd_count, rd, le->data_size, le->data);
+    GNUNET_CONTAINER_DLL_insert (rvk->tickets_to_update_head,
+                                 rvk->tickets_to_update_tail, le);
+  }
+  GNUNET_NAMESTORE_zone_iterator_next (rvk->ns_it, 1);
+}
+
+
+static void
+process_tickets (void *cls);
+
+
+static void
+ticket_processed (void *cls, int32_t success, const char *emsg)
+{
+  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
+  rvk->ns_qe = NULL;
+  GNUNET_SCHEDULER_add_now (&process_tickets, rvk);
+}
+
+static void
+process_tickets (void *cls)
+{
+  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
+  struct TicketRecordsEntry *le;
+  struct RevokedAttributeEntry *ae;
+  if (NULL == rvk->tickets_to_update_head) {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Finished updatding tickets, success\n");
+    rvk->cb (rvk->cb_cls, GNUNET_OK);
+    cleanup_rvk (rvk);
+    return;
+  }
+  le = rvk->tickets_to_update_head;
+  GNUNET_CONTAINER_DLL_remove (rvk->tickets_to_update_head,
+                               rvk->tickets_to_update_tail, le);
+  struct GNUNET_GNSRECORD_Data rd[le->rd_count];
+  GNUNET_GNSRECORD_records_deserialize (le->data_size, le->data, le->rd_count,
+                                        rd);
+  for (int i = 0; i < le->rd_count; i++) {
+    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_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)))
+        continue;
+      rd[i].data = &ae->new_id;
+    }
+  }
+  rvk->ns_qe = GNUNET_NAMESTORE_records_store (
+      nsh, &rvk->identity, le->label, le->rd_count, rd, &ticket_processed, 
rvk);
+  GNUNET_free (le->label);
+  GNUNET_free (le->data);
+  GNUNET_free (le);
+}
+
+static void
+rvk_ticket_update_finished (void *cls)
+{
+  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
+  rvk->ns_it = NULL;
+  GNUNET_SCHEDULER_add_now (&process_tickets, rvk);
+}
+
+
+static void
+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);
+}
+
+
+static void
+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);
+}
+
+
+static void
+move_attrs (struct RECLAIM_TICKETS_RevokeHandle *rvk)
+{
+  char *label;
+
+  if (NULL == rvk->move_attr) {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished moving attributes\n");
+    rvk->ns_it = GNUNET_NAMESTORE_zone_iteration_start (
+        nsh, &rvk->identity, &rvk_ns_iter_err, rvk, &rvk_ticket_update, rvk,
+        &rvk_ticket_update_finished, rvk);
+    return;
+  }
+  label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->old_id,
+                                               sizeof (uint64_t));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Moving attribute %s\n", label);
+
+  rvk->ns_qe = GNUNET_NAMESTORE_records_lookup (
+      nsh, &rvk->identity, label, &rvk_ns_err, rvk, &rvk_move_attr_cb, rvk);
+  GNUNET_free (label);
+}
+
+
+static void
+remove_ticket_cont (void *cls, int32_t success, const char *emsg)
+{
+  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
+  rvk->ns_qe = NULL;
+  if (GNUNET_SYSERR == success) {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", emsg);
+    rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
+    cleanup_rvk (rvk);
+    return;
+  }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleted ticket\n");
+  if (0 == rvk->ticket_attrs) {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "No attributes to move... strange\n");
+    rvk->cb (rvk->cb_cls, GNUNET_OK);
+    cleanup_rvk (rvk);
+    return;
+  }
+  rvk->move_attr = rvk->attrs_head;
+  move_attrs (rvk);
+}
+
+
+static void
+revoke_attrs_cb (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
+                 const char *label, unsigned int rd_count,
+                 const struct GNUNET_GNSRECORD_Data *rd)
+
+{
+  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
+  struct RevokedAttributeEntry *le;
+  rvk->ns_qe = NULL;
+  for (int i = 0; i < rd_count; i++) {
+    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type)
+      continue;
+    le = GNUNET_new (struct RevokedAttributeEntry);
+    le->old_id = *((uint64_t *)rd[i].data);
+    GNUNET_CONTAINER_DLL_insert (rvk->attrs_head, rvk->attrs_tail, le);
+    rvk->ticket_attrs++;
+  }
+
+  /** Now, remove ticket **/
+  rvk->ns_qe = GNUNET_NAMESTORE_records_store (nsh, &rvk->identity, label, 0,
+                                               NULL, &remove_ticket_cont, rvk);
+}
+
+
+static void
+rvk_attrs_err_cb (void *cls)
+{
+  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
+  rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
+  cleanup_rvk (rvk);
+}
+
+
+struct RECLAIM_TICKETS_RevokeHandle *
+RECLAIM_TICKETS_revoke (const struct GNUNET_RECLAIM_Ticket *ticket,
+                        const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
+                        RECLAIM_TICKETS_RevokeCallback cb, void *cb_cls)
+{
+  struct RECLAIM_TICKETS_RevokeHandle *rvk;
+  char *label;
+
+  rvk = GNUNET_new (struct RECLAIM_TICKETS_RevokeHandle);
+  rvk->cb = cb;
+  rvk->cb_cls = cb_cls;
+  rvk->identity = *identity;
+  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));
+
+  rvk->ns_qe = GNUNET_NAMESTORE_records_lookup (
+      nsh, identity, label, &rvk_attrs_err_cb, rvk, &revoke_attrs_cb, rvk);
+  return rvk;
+}
+
+
+void
+RECLAIM_TICKETS_revoke_cancel (struct RECLAIM_TICKETS_RevokeHandle *rh)
+{
+  cleanup_rvk (rh);
+}
+/*******************************
+ * Ticket consume
+ *******************************/
+
+/**
+ * Cleanup ticket consume handle
+ * @param cth the handle to clean up
+ */
+static void
+cleanup_cth (struct RECLAIM_TICKETS_ConsumeHandle *cth)
+{
+  struct ParallelLookup *lu;
+  struct ParallelLookup *tmp;
+  if (NULL != cth->lookup_request)
+    GNUNET_GNS_lookup_cancel (cth->lookup_request);
+  for (lu = cth->parallel_lookups_head; NULL != lu;) {
+    GNUNET_GNS_lookup_cancel (lu->lookup_request);
+    GNUNET_free (lu->label);
+    tmp = lu->next;
+    GNUNET_CONTAINER_DLL_remove (cth->parallel_lookups_head,
+                                 cth->parallel_lookups_tail, lu);
+    GNUNET_free (lu);
+    lu = tmp;
+  }
+
+  if (NULL != cth->attrs)
+    GNUNET_RECLAIM_ATTRIBUTE_list_destroy (cth->attrs);
+  GNUNET_free (cth);
+}
+
+
+static void
+process_parallel_lookup_result (void *cls, uint32_t rd_count,
+                                const struct GNUNET_GNSRECORD_Data *rd)
+{
+  struct ParallelLookup *parallel_lookup = cls;
+  struct RECLAIM_TICKETS_ConsumeHandle *cth = parallel_lookup->handle;
+  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *attr_le;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Parallel lookup finished (count=%u)\n",
+              rd_count);
+
+  GNUNET_CONTAINER_DLL_remove (cth->parallel_lookups_head,
+                               cth->parallel_lookups_tail, parallel_lookup);
+  GNUNET_free (parallel_lookup->label);
+
+  GNUNET_STATISTICS_update (
+      stats, "attribute_lookup_time_total",
+      GNUNET_TIME_absolute_get_duration (parallel_lookup->lookup_start_time)
+          .rel_value_us,
+      GNUNET_YES);
+  GNUNET_STATISTICS_update (stats, "attribute_lookups_count", 1, GNUNET_YES);
+
+
+  GNUNET_free (parallel_lookup);
+  if (1 != rd_count)
+    GNUNET_break (0); // TODO
+  if (rd->record_type == GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR) {
+    attr_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
+    attr_le->claim =
+        GNUNET_RECLAIM_ATTRIBUTE_deserialize (rd->data, rd->data_size);
+    GNUNET_CONTAINER_DLL_insert (cth->attrs->list_head, cth->attrs->list_tail,
+                                 attr_le);
+  }
+  if (NULL != cth->parallel_lookups_head)
+    return; // Wait for more
+  /* Else we are done */
+
+  GNUNET_SCHEDULER_cancel (cth->kill_task);
+  cth->cb (cth->cb_cls, &cth->ticket.identity, cth->attrs, GNUNET_OK, NULL);
+  cleanup_cth (cth);
+}
+
+
+static void
+abort_parallel_lookups (void *cls)
+{
+  struct RECLAIM_TICKETS_ConsumeHandle *cth = cls;
+  struct ParallelLookup *lu;
+  struct ParallelLookup *tmp;
+
+  cth->kill_task = NULL;
+  for (lu = cth->parallel_lookups_head; NULL != lu;) {
+    GNUNET_GNS_lookup_cancel (lu->lookup_request);
+    GNUNET_free (lu->label);
+    tmp = lu->next;
+    GNUNET_CONTAINER_DLL_remove (cth->parallel_lookups_head,
+                                 cth->parallel_lookups_tail, lu);
+    GNUNET_free (lu);
+    lu = tmp;
+  }
+  cth->cb (cth->cb_cls, NULL, NULL, GNUNET_SYSERR, "Aborted");
+}
+
+
+static void
+lookup_authz_cb (void *cls, uint32_t rd_count,
+                 const struct GNUNET_GNSRECORD_Data *rd)
+{
+  struct RECLAIM_TICKETS_ConsumeHandle *cth = cls;
+  struct ParallelLookup *parallel_lookup;
+  char *lbl;
+
+  cth->lookup_request = NULL;
+
+  GNUNET_STATISTICS_update (
+      stats, "reclaim_authz_lookup_time_total",
+      GNUNET_TIME_absolute_get_duration (cth->lookup_start_time).rel_value_us,
+      GNUNET_YES);
+  GNUNET_STATISTICS_update (stats, "reclaim_authz_lookups_count", 1,
+                            GNUNET_YES);
+
+  for (int i = 0; i < rd_count; i++) {
+    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);
+    parallel_lookup = GNUNET_new (struct ParallelLookup);
+    parallel_lookup->handle = cth;
+    parallel_lookup->label = lbl;
+    parallel_lookup->lookup_start_time = GNUNET_TIME_absolute_get ();
+    parallel_lookup->lookup_request = GNUNET_GNS_lookup (
+        gns, lbl, &cth->ticket.identity, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR,
+        GNUNET_GNS_LO_DEFAULT, &process_parallel_lookup_result,
+        parallel_lookup);
+    GNUNET_CONTAINER_DLL_insert (cth->parallel_lookups_head,
+                                 cth->parallel_lookups_tail, parallel_lookup);
+  }
+  cth->kill_task = GNUNET_SCHEDULER_add_delayed (
+      GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 3),
+      &abort_parallel_lookups, cth);
+}
+
+
+struct RECLAIM_TICKETS_ConsumeHandle *
+RECLAIM_TICKETS_consume (const struct GNUNET_CRYPTO_EcdsaPrivateKey *id,
+                         const struct GNUNET_RECLAIM_Ticket *ticket,
+                         RECLAIM_TICKETS_ConsumeCallback cb, void *cb_cls)
+{
+  struct RECLAIM_TICKETS_ConsumeHandle *cth;
+  char *label;
+  cth = GNUNET_new (struct RECLAIM_TICKETS_ConsumeHandle);
+
+  cth->identity = *id;
+  GNUNET_CRYPTO_ecdsa_key_get_public (&cth->identity, &cth->identity_pub);
+  cth->attrs = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
+  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_log (GNUNET_ERROR_TYPE_DEBUG, "Looking for AuthZ info under %s\n",
+              label);
+  cth->lookup_start_time = GNUNET_TIME_absolute_get ();
+  cth->lookup_request = GNUNET_GNS_lookup (
+      gns, label, &cth->ticket.identity, 
GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF,
+      GNUNET_GNS_LO_DEFAULT, &lookup_authz_cb, cth);
+  GNUNET_free (label);
+  return cth;
+}
+
+void
+RECLAIM_TICKETS_consume_cancel (struct RECLAIM_TICKETS_ConsumeHandle *cth)
+{
+  cleanup_cth (cth);
+  return;
+}
+
+
+/*******************************
+ * Ticket issue
+ *******************************/
+
+/**
+ * Cleanup ticket consume handle
+ * @param handle the handle to clean up
+ */
+static void
+cleanup_issue_handle (struct TicketIssueHandle *handle)
+{
+  if (NULL != handle->ns_qe)
+    GNUNET_NAMESTORE_cancel (handle->ns_qe);
+  GNUNET_free (handle);
+}
+
+
+static void
+store_ticket_issue_cont (void *cls, int32_t success, const char *emsg)
+{
+  struct TicketIssueHandle *handle = cls;
+
+  handle->ns_qe = NULL;
+  if (GNUNET_SYSERR == success) {
+    handle->cb (handle->cb_cls, &handle->ticket, GNUNET_SYSERR,
+                "Error storing AuthZ ticket in GNS");
+    return;
+  }
+  handle->cb (handle->cb_cls, &handle->ticket, GNUNET_OK, NULL);
+  cleanup_issue_handle (handle);
+}
+
+
+static void
+issue_ticket (struct TicketIssueHandle *ih)
+{
+  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
+  struct GNUNET_GNSRECORD_Data *attrs_record;
+  char *label;
+  size_t list_len = 1;
+  int i;
+
+  for (le = ih->attrs->list_head; NULL != le; le = le->next)
+    list_len++;
+
+  attrs_record =
+      GNUNET_malloc (list_len * sizeof (struct GNUNET_GNSRECORD_Data));
+  i = 0;
+  for (le = ih->attrs->list_head; NULL != le; le = le->next) {
+    attrs_record[i].data = &le->claim->id;
+    attrs_record[i].data_size = sizeof (le->claim->id);
+    attrs_record[i].expiration_time = GNUNET_TIME_UNIT_DAYS.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);
+  attrs_record[i].expiration_time = GNUNET_TIME_UNIT_DAYS.rel_value_us;
+  attrs_record[i].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET;
+  attrs_record[i].flags =
+      GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION | GNUNET_GNSRECORD_RF_PRIVATE;
+
+  label =
+      GNUNET_STRINGS_data_to_string_alloc (&ih->ticket.rnd, sizeof (uint64_t));
+  // Publish record
+  ih->ns_qe = GNUNET_NAMESTORE_records_store (nsh, &ih->identity, label,
+                                              list_len, attrs_record,
+                                              &store_ticket_issue_cont, ih);
+  GNUNET_free (attrs_record);
+  GNUNET_free (label);
+}
+
+
+void
+RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
+                       const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
+                       const struct GNUNET_CRYPTO_EcdsaPublicKey *audience,
+                       RECLAIM_TICKETS_TicketResult cb, void *cb_cls)
+{
+  struct TicketIssueHandle *tih;
+  tih = GNUNET_new (struct TicketIssueHandle);
+  tih->cb = cb;
+  tih->cb_cls = cb_cls;
+  tih->attrs = GNUNET_RECLAIM_ATTRIBUTE_list_dup (attrs);
+  tih->identity = *identity;
+  GNUNET_CRYPTO_ecdsa_key_get_public (identity, &tih->ticket.identity);
+  tih->ticket.rnd =
+      GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
+  tih->ticket.audience = *audience;
+  issue_ticket (tih);
+}
+
+/************************************
+ * Ticket iteration
+ ************************************/
+
+static void
+cleanup_iter (struct RECLAIM_TICKETS_Iterator *iter)
+{
+  if (NULL != iter->ns_it)
+    GNUNET_NAMESTORE_zone_iteration_stop (iter->ns_it);
+  GNUNET_free (iter);
+}
+
+
+static void
+collect_tickets_cb (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey 
*zone,
+                    const char *label, unsigned int rd_count,
+                    const struct GNUNET_GNSRECORD_Data *rd)
+{
+  struct RECLAIM_TICKETS_Iterator *iter = cls;
+
+  for (int i = 0; i < rd_count; i++) {
+    if (GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET != rd[i].record_type)
+      continue;
+    iter->cb (iter->cb_cls, (struct GNUNET_RECLAIM_Ticket *)rd[i].data);
+    return;
+  }
+  GNUNET_NAMESTORE_zone_iterator_next (iter->ns_it, 1);
+}
+
+
+static void
+collect_tickets_finished_cb (void *cls)
+{
+  struct RECLAIM_TICKETS_Iterator *iter = cls;
+  iter->ns_it = NULL;
+  iter->cb (iter->cb_cls, NULL);
+  cleanup_iter (iter);
+}
+
+
+static void
+collect_tickets_error_cb (void *cls)
+{
+  struct RECLAIM_TICKETS_Iterator *iter = cls;
+  iter->ns_it = NULL;
+  iter->cb (iter->cb_cls, NULL);
+  cleanup_iter (iter);
+}
+
+
+void
+RECLAIM_TICKETS_iteration_next (struct RECLAIM_TICKETS_Iterator *iter)
+{
+  GNUNET_NAMESTORE_zone_iterator_next (iter->ns_it, 1);
+}
+
+
+void
+RECLAIM_TICKETS_iteration_stop (struct RECLAIM_TICKETS_Iterator *iter)
+{
+  GNUNET_NAMESTORE_zone_iteration_stop (iter->ns_it);
+  cleanup_iter (iter);
+}
+
+
+struct RECLAIM_TICKETS_Iterator *
+RECLAIM_TICKETS_iteration_start (
+    const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
+    RECLAIM_TICKETS_TicketIter cb, void *cb_cls)
+{
+  struct RECLAIM_TICKETS_Iterator *iter;
+
+  iter = GNUNET_new (struct RECLAIM_TICKETS_Iterator);
+  iter->cb = cb;
+  iter->cb_cls = cb_cls;
+  iter->ns_it = GNUNET_NAMESTORE_zone_iteration_start (
+      nsh, identity, &collect_tickets_error_cb, iter, &collect_tickets_cb, 
iter,
+      &collect_tickets_finished_cb, iter);
+  return iter;
+}
+
+
+int
+RECLAIM_TICKETS_init (const struct GNUNET_CONFIGURATION_Handle *c)
+{
+  // Connect to identity and namestore services
+  nsh = GNUNET_NAMESTORE_connect (c);
+  if (NULL == nsh) {
+    GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
+                         "error connecting to namestore");
+    return GNUNET_SYSERR;
+  }
+  gns = GNUNET_GNS_connect (c);
+  if (NULL == gns) {
+    GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "error connecting to gns");
+    return GNUNET_SYSERR;
+  }
+  stats = GNUNET_STATISTICS_create ("reclaim", c);
+  return GNUNET_OK;
+}
+
+void
+RECLAIM_TICKETS_deinit (void)
+{
+  if (NULL != nsh)
+    GNUNET_NAMESTORE_disconnect (nsh);
+  nsh = NULL;
+  if (NULL != gns)
+    GNUNET_GNS_disconnect (gns);
+  gns = NULL;
+  if (NULL != stats) {
+    GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
+    stats = NULL;
+  }
+}
diff --git a/src/reclaim/gnunet-service-reclaim_tickets.h 
b/src/reclaim/gnunet-service-reclaim_tickets.h
new file mode 100644
index 000000000..d2b614c46
--- /dev/null
+++ b/src/reclaim/gnunet-service-reclaim_tickets.h
@@ -0,0 +1,125 @@
+/*
+   This file is part of GNUnet.
+   Copyright (C) 2012-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
+   */
+
+/**
+ * @author Martin Schanzenbach
+ * @file src/reclaim/gnunet-service-reclaim_tickets.h
+ * @brief reclaim tickets
+ *
+ */
+
+#ifndef GNUNET_SERVICE_RECLAIM_TICKETS_H
+#define GNUNET_SERVICE_RECLAIM_TICKETS_H
+
+#include "platform.h"
+
+#include "gnunet_util_lib.h"
+
+#include "gnunet_constants.h"
+#include "gnunet_gns_service.h"
+#include "gnunet_gnsrecord_lib.h"
+#include "gnunet_namestore_service.h"
+#include "gnunet_protocols.h"
+#include "gnunet_reclaim_attribute_lib.h"
+#include "gnunet_reclaim_plugin.h"
+#include "gnunet_signatures.h"
+#include "gnunet_statistics_service.h"
+#include "reclaim.h"
+
+struct RECLAIM_TICKETS_Iterator;
+struct RECLAIM_TICKETS_ConsumeHandle;
+struct RECLAIM_TICKETS_RevokeHandle;
+
+/**
+ * Continuation called with ticket.
+ *
+ * @param cls closure
+ * @param ticket the ticket
+ */
+typedef void (*RECLAIM_TICKETS_TicketIter) (
+    void *cls, struct GNUNET_RECLAIM_Ticket *ticket);
+
+
+/**
+ * Continuation called with ticket.
+ *
+ * @param cls closure
+ * @param ticket the ticket
+ * @param success #GNUNET_SYSERR on failure (including timeout/queue
+ * drop/failure to validate) #GNUNET_OK on success
+ * @param emsg NULL on success, otherwise an error message
+ */
+typedef void (*RECLAIM_TICKETS_TicketResult) (
+    void *cls, struct GNUNET_RECLAIM_Ticket *ticket, int32_t success,
+    const char *emsg);
+
+
+typedef void (*RECLAIM_TICKETS_ConsumeCallback) (
+    void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
+    const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *l, int32_t success,
+    const char *emsg);
+
+
+typedef void (*RECLAIM_TICKETS_RevokeCallback) (void *cls, int32_t success);
+
+struct RECLAIM_TICKETS_RevokeHandle *
+RECLAIM_TICKETS_revoke (const struct GNUNET_RECLAIM_Ticket *ticket,
+                        const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
+                        RECLAIM_TICKETS_RevokeCallback cb, void *cb_cls);
+
+
+void
+RECLAIM_TICKETS_revoke_cancel (struct RECLAIM_TICKETS_RevokeHandle *rh);
+
+
+struct RECLAIM_TICKETS_ConsumeHandle *
+RECLAIM_TICKETS_consume (const struct GNUNET_CRYPTO_EcdsaPrivateKey *id,
+                         const struct GNUNET_RECLAIM_Ticket *ticket,
+                         RECLAIM_TICKETS_ConsumeCallback cb, void *cb_cls);
+
+void
+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_CRYPTO_EcdsaPublicKey *audience,
+                       RECLAIM_TICKETS_TicketResult cb, void *cb_cls);
+
+void
+RECLAIM_TICKETS_iteration_next (struct RECLAIM_TICKETS_Iterator *iter);
+
+
+void
+RECLAIM_TICKETS_iteration_stop (struct RECLAIM_TICKETS_Iterator *iter);
+
+
+struct RECLAIM_TICKETS_Iterator *
+RECLAIM_TICKETS_iteration_start (
+    const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
+    RECLAIM_TICKETS_TicketIter cb, void *cb_cls);
+
+
+int
+RECLAIM_TICKETS_init (const struct GNUNET_CONFIGURATION_Handle *c);
+
+void
+RECLAIM_TICKETS_deinit (void);
+#endif
diff --git a/src/reclaim/plugin_gnsrecord_reclaim.c 
b/src/reclaim/plugin_gnsrecord_reclaim.c
index 9be0e7632..48cdd9811 100644
--- a/src/reclaim/plugin_gnsrecord_reclaim.c
+++ b/src/reclaim/plugin_gnsrecord_reclaim.c
@@ -11,7 +11,7 @@
      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/>.
 
@@ -24,11 +24,12 @@
  * @author Martin Schanzenbach
  */
 #include "platform.h"
+
 #include "gnunet_util_lib.h"
+
 #include "gnunet_gnsrecord_lib.h"
 #include "gnunet_gnsrecord_plugin.h"
 
-
 /**
  * Convert the 'value' of a record to a string.
  *
@@ -39,46 +40,20 @@
  * @return NULL on error, otherwise human-readable representation of the value
  */
 static char *
-value_to_string (void *cls,
-                 uint32_t type,
-                 const void *data,
-                 size_t data_size)
+value_to_string (void *cls, uint32_t type, const void *data, size_t data_size)
 {
-  const struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey;
-  const struct GNUNET_CRYPTO_EcdsaPublicKey *audience_pubkey;
-  const char *scopes;
-  char *ecdhe_str;
-  char *aud_str;
-  char *result;
-
-  switch (type)
-  {
-    case GNUNET_GNSRECORD_TYPE_ID_ATTR:
-      return GNUNET_STRINGS_data_to_string_alloc (data, data_size);
-    case GNUNET_GNSRECORD_TYPE_ID_TOKEN: //DEPRECATED
-    case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT:
-    case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT:
-      return GNUNET_strndup (data, data_size);
-    case GNUNET_GNSRECORD_TYPE_ABE_KEY:
-    case GNUNET_GNSRECORD_TYPE_ABE_MASTER:
-      return GNUNET_STRINGS_data_to_string_alloc (data, data_size); 
-    case GNUNET_GNSRECORD_TYPE_ID_TOKEN_METADATA: //DEPRECATED
-        ecdhe_privkey = data;
-        audience_pubkey = data+sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey);
-        scopes =  (char*) audience_pubkey+(sizeof (struct 
GNUNET_CRYPTO_EcdsaPublicKey));
-        ecdhe_str = GNUNET_STRINGS_data_to_string_alloc (ecdhe_privkey,
-                                                        sizeof (struct 
GNUNET_CRYPTO_EcdhePrivateKey));
-        aud_str = GNUNET_STRINGS_data_to_string_alloc (audience_pubkey,
-                                                       sizeof (struct 
GNUNET_CRYPTO_EcdsaPublicKey));
-        GNUNET_asprintf (&result,
-                         "%s;%s;%s",
-                         ecdhe_str, aud_str, scopes);
-        GNUNET_free (aud_str);
-        GNUNET_free (ecdhe_str);
-        return result;
-
-    default:
-      return NULL;
+  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_TICKET:
+  case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER:
+    return GNUNET_STRINGS_data_to_string_alloc (data, data_size);
+  default:
+    return NULL;
   }
 }
 
@@ -95,81 +70,25 @@ value_to_string (void *cls,
  * @return #GNUNET_OK on success
  */
 static int
-string_to_value (void *cls,
-                 uint32_t type,
-                 const char *s,
-                 void **data,
+string_to_value (void *cls, uint32_t type, const char *s, void **data,
                  size_t *data_size)
 {
-  char* ecdhe_str;
-  char* aud_keystr;
-  char* write_ptr;
-  char* tmp_tok;
-  char* str;
-
   if (NULL == s)
     return GNUNET_SYSERR;
-  switch (type)
-  {
-    case GNUNET_GNSRECORD_TYPE_ID_ATTR:
-      return GNUNET_STRINGS_string_to_data (s,
-                                            strlen (s),
-                                            *data,
-                                            *data_size);
-    case GNUNET_GNSRECORD_TYPE_ID_TOKEN:
-    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_ABE_KEY:
-    case GNUNET_GNSRECORD_TYPE_ABE_MASTER:
-      return GNUNET_STRINGS_string_to_data (s,
-                                            strlen (s),
-                                            *data,
-                                            *data_size);
-    case GNUNET_GNSRECORD_TYPE_ID_TOKEN_METADATA:
-      tmp_tok = GNUNET_strdup (s);
-      ecdhe_str = strtok (tmp_tok, ";");
-      if (NULL == ecdhe_str)
-      {
-        GNUNET_free (tmp_tok);
-        return GNUNET_SYSERR;
-      }
-      aud_keystr = strtok (NULL, ";");
-      if (NULL == aud_keystr)
-      {
-        GNUNET_free (tmp_tok);
-        return GNUNET_SYSERR;
-      }
-      str = strtok (NULL, ";");
-      if (NULL == str)
-      {
-        GNUNET_free (tmp_tok);
-        return GNUNET_SYSERR;
-      }
-      *data_size = strlen (str) + 1
-        +sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey)
-        +sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey);
-      *data = GNUNET_malloc (*data_size);
-
-      write_ptr = *data;
-      GNUNET_STRINGS_string_to_data (ecdhe_str,
-                                     strlen (ecdhe_str),
-                                     write_ptr,
-                                     sizeof (struct 
GNUNET_CRYPTO_EcdhePrivateKey));
-      write_ptr += sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey);
-      GNUNET_STRINGS_string_to_data (aud_keystr,
-                                     strlen (aud_keystr),
-                                     write_ptr,
-                                     sizeof (struct 
GNUNET_CRYPTO_EcdsaPublicKey));
-      write_ptr += sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey);
-      GNUNET_memcpy (write_ptr, str, strlen (str) + 1); //with 0-Terminator
-      GNUNET_free (tmp_tok);
-      return GNUNET_OK;
-
-    default:
-      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_MASTER:
+  case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET:
+    return GNUNET_STRINGS_string_to_data (s, strlen (s), *data, *data_size);
+  default:
+    return GNUNET_SYSERR;
   }
 }
 
@@ -182,15 +101,13 @@ static struct {
   const char *name;
   uint32_t number;
 } name_map[] = {
-  { "ID_ATTR", GNUNET_GNSRECORD_TYPE_ID_ATTR },
-  { "ID_TOKEN", GNUNET_GNSRECORD_TYPE_ID_TOKEN },
-  { "ABE_KEY", GNUNET_GNSRECORD_TYPE_ABE_KEY },
-  { "ABE_MASTER", GNUNET_GNSRECORD_TYPE_ABE_MASTER },
-  { "ID_TOKEN_METADATA", GNUNET_GNSRECORD_TYPE_ID_TOKEN_METADATA },
-  { "RECLAIM_OIDC_CLIENT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT },
-  { "RECLAIM_OIDC_REDIRECT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT },
-  { NULL, UINT32_MAX }
-};
+    {"RECLAIM_ATTR", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR},
+    {"RECLAIM_ATTR_REF", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_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},
+    {NULL, UINT32_MAX}};
 
 
 /**
@@ -201,14 +118,13 @@ static struct {
  * @return corresponding number, UINT32_MAX on error
  */
 static uint32_t
-typename_to_number (void *cls,
-                    const char *dns_typename)
+typename_to_number (void *cls, const char *dns_typename)
 {
   unsigned int i;
 
-  i=0;
-  while ( (NULL != name_map[i].name) &&
-          (0 != strcasecmp (dns_typename, name_map[i].name)) )
+  i = 0;
+  while ((NULL != name_map[i].name) &&
+         (0 != strcasecmp (dns_typename, name_map[i].name)))
     i++;
   return name_map[i].number;
 }
@@ -222,14 +138,12 @@ typename_to_number (void *cls,
  * @return corresponding typestring, NULL on error
  */
 static const char *
-number_to_typename (void *cls,
-                    uint32_t type)
+number_to_typename (void *cls, uint32_t type)
 {
   unsigned int i;
 
-  i=0;
-  while ( (NULL != name_map[i].name) &&
-          (type != name_map[i].number) )
+  i = 0;
+  while ((NULL != name_map[i].name) && (type != name_map[i].number))
     i++;
   return name_map[i].name;
 }
diff --git a/src/reclaim/plugin_reclaim_sqlite.c 
b/src/reclaim/plugin_reclaim_sqlite.c
deleted file mode 100644
index f6e1436cc..000000000
--- a/src/reclaim/plugin_reclaim_sqlite.c
+++ /dev/null
@@ -1,736 +0,0 @@
- /*
-  * This file is part of GNUnet
-  * Copyright (C) 2009-2017 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/plugin_reclaim_sqlite.c
- * @brief sqlite-based idp backend
- * @author Martin Schanzenbach
- */
-
-#include "platform.h"
-#include "gnunet_reclaim_service.h"
-#include "gnunet_reclaim_plugin.h"
-#include "gnunet_reclaim_attribute_lib.h"
-#include "gnunet_sq_lib.h"
-#include <sqlite3.h>
-
-/**
- * After how many ms "busy" should a DB operation fail for good?  A
- * low value makes sure that we are more responsive to requests
- * (especially PUTs).  A high value guarantees a higher success rate
- * (SELECTs in iterate can take several seconds despite LIMIT=1).
- *
- * The default value of 1s should ensure that users do not experience
- * huge latencies while at the same time allowing operations to
- * succeed with reasonable probability.
- */
-#define BUSY_TIMEOUT_MS 1000
-
-
-/**
- * Log an error message at log-level 'level' that indicates
- * a failure of the command 'cmd' on file 'filename'
- * with the message given by strerror(errno).
- */
-#define LOG_SQLITE(db, level, cmd) do { GNUNET_log_from (level, "reclaim", 
_("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, 
sqlite3_errmsg(db->dbh)); } while(0)
-
-#define LOG(kind,...) GNUNET_log_from (kind, "reclaim-sqlite", __VA_ARGS__)
-
-
-/**
- * Context for all functions in this plugin.
- */
-struct Plugin
-{
-
-  const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * Database filename.
-   */
-  char *fn;
-
-  /**
-   * Native SQLite database handle.
-   */
-  sqlite3 *dbh;
-
-  /**
-   * Precompiled SQL to store ticket.
-   */
-  sqlite3_stmt *store_ticket;
-
-  /**
-   * Precompiled SQL to delete existing ticket.
-   */
-  sqlite3_stmt *delete_ticket;
-
-  /**
-   * Precompiled SQL to iterate tickets.
-   */
-  sqlite3_stmt *iterate_tickets;
-
-  /**
-   * Precompiled SQL to get ticket attributes.
-   */
-  sqlite3_stmt *get_ticket_attrs;
-  
-  /**
-   * Precompiled SQL to iterate tickets by audience.
-   */
-  sqlite3_stmt *iterate_tickets_by_audience;
-};
-
-
-/**
- * @brief Prepare a SQL statement
- *
- * @param dbh handle to the database
- * @param zSql SQL statement, UTF-8 encoded
- * @param ppStmt set to the prepared statement
- * @return 0 on success
- */
-static int
-sq_prepare (sqlite3 *dbh,
-            const char *zSql,
-            sqlite3_stmt **ppStmt)
-{
-  char *dummy;
-  int result;
-
-  result =
-      sqlite3_prepare_v2 (dbh,
-                          zSql,
-                          strlen (zSql),
-                          ppStmt,
-                          (const char **) &dummy);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Prepared `%s' / %p: %d\n",
-       zSql,
-       *ppStmt,
-       result);
-  return result;
-}
-
-/**
- * Create our database indices.
- *
- * @param dbh handle to the database
- */
-static void
-create_indices (sqlite3 * dbh)
-{
-  /* create indices */
-  if ( (SQLITE_OK !=
-       sqlite3_exec (dbh,
-                      "CREATE INDEX IF NOT EXISTS identity_reverse ON 
identity001tickets (identity,audience)",
-                     NULL, NULL, NULL)) ||
-       (SQLITE_OK !=
-       sqlite3_exec (dbh,
-                      "CREATE INDEX IF NOT EXISTS it_iter ON 
identity001tickets (rnd)",
-                     NULL, NULL, NULL)) )
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-        "Failed to create indices: %s\n",
-         sqlite3_errmsg (dbh));
-}
-
-
-
-#if 0
-#define CHECK(a) GNUNET_break(a)
-#define ENULL NULL
-#else
-#define ENULL &e
-#define ENULL_DEFINED 1
-#define CHECK(a) if (! (a)) { GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "%s\n", e); 
sqlite3_free(e); }
-#endif
-
-
-/**
- * Initialize the database connections and associated
- * data structures (create tables and indices
- * as needed as well).
- *
- * @param plugin the plugin context (state for this module)
- * @return #GNUNET_OK on success
- */
-static int
-database_setup (struct Plugin *plugin)
-{
-  sqlite3_stmt *stmt;
-  char *afsdir;
-#if ENULL_DEFINED
-  char *e;
-#endif
-
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_filename (plugin->cfg,
-                                               "reclaim-sqlite",
-                                               "FILENAME",
-                                               &afsdir))
-  {
-    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                              "reclaim-sqlite",
-                               "FILENAME");
-    return GNUNET_SYSERR;
-  }
-  if (GNUNET_OK !=
-      GNUNET_DISK_file_test (afsdir))
-  {
-    if (GNUNET_OK !=
-        GNUNET_DISK_directory_create_for_file (afsdir))
-    {
-      GNUNET_break (0);
-      GNUNET_free (afsdir);
-      return GNUNET_SYSERR;
-    }
-  }
-  /* afsdir should be UTF-8-encoded. If it isn't, it's a bug */
-  plugin->fn = afsdir;
-
-  /* Open database and precompile statements */
-  if (sqlite3_open (plugin->fn, &plugin->dbh) != SQLITE_OK)
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-        _("Unable to initialize SQLite: %s.\n"),
-        sqlite3_errmsg (plugin->dbh));
-    return GNUNET_SYSERR;
-  }
-  CHECK (SQLITE_OK ==
-         sqlite3_exec (plugin->dbh,
-                       "PRAGMA temp_store=MEMORY", NULL, NULL,
-                       ENULL));
-  CHECK (SQLITE_OK ==
-         sqlite3_exec (plugin->dbh,
-                       "PRAGMA synchronous=NORMAL", NULL, NULL,
-                       ENULL));
-  CHECK (SQLITE_OK ==
-         sqlite3_exec (plugin->dbh,
-                       "PRAGMA legacy_file_format=OFF", NULL, NULL,
-                       ENULL));
-  CHECK (SQLITE_OK ==
-         sqlite3_exec (plugin->dbh,
-                       "PRAGMA auto_vacuum=INCREMENTAL", NULL,
-                       NULL, ENULL));
-  CHECK (SQLITE_OK ==
-         sqlite3_exec (plugin->dbh,
-                       "PRAGMA encoding=\"UTF-8\"", NULL,
-                       NULL, ENULL));
-  CHECK (SQLITE_OK ==
-         sqlite3_exec (plugin->dbh,
-                       "PRAGMA locking_mode=EXCLUSIVE", NULL, NULL,
-                       ENULL));
-  CHECK (SQLITE_OK ==
-         sqlite3_exec (plugin->dbh,
-                       "PRAGMA page_size=4092", NULL, NULL,
-                       ENULL));
-
-  CHECK (SQLITE_OK ==
-         sqlite3_busy_timeout (plugin->dbh,
-                               BUSY_TIMEOUT_MS));
-
-
-  /* Create table */
-  CHECK (SQLITE_OK ==
-         sq_prepare (plugin->dbh,
-                     "SELECT 1 FROM sqlite_master WHERE tbl_name = 
'identity001tickets'",
-                     &stmt));
-  if ((sqlite3_step (stmt) == SQLITE_DONE) &&
-      (sqlite3_exec
-       (plugin->dbh,
-        "CREATE TABLE identity001tickets ("
-        " identity BLOB NOT NULL DEFAULT '',"
-        " audience BLOB NOT NULL DEFAULT '',"
-             " rnd INT8 NOT NULL DEFAULT '',"
-        " attributes BLOB NOT NULL DEFAULT ''"
-       ")",
-       NULL, NULL, NULL) != SQLITE_OK))
-  {
-    LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR,
-                "sqlite3_exec");
-    sqlite3_finalize (stmt);
-    return GNUNET_SYSERR;
-  }
-  sqlite3_finalize (stmt);
-
-  create_indices (plugin->dbh);
-
-  if ( (SQLITE_OK !=
-        sq_prepare (plugin->dbh,
-                    "INSERT INTO identity001tickets (identity, audience, rnd, 
attributes)"
-                    " VALUES (?, ?, ?, ?)",
-                    &plugin->store_ticket)) ||
-       (SQLITE_OK !=
-        sq_prepare (plugin->dbh,
-                    "DELETE FROM identity001tickets WHERE identity=? AND 
rnd=?",
-                    &plugin->delete_ticket)) ||
-       (SQLITE_OK !=
-        sq_prepare (plugin->dbh,
-                    "SELECT identity,audience,rnd,attributes"
-                    " FROM identity001tickets WHERE identity=? AND rnd=?",
-                    &plugin->get_ticket_attrs)) ||
-       (SQLITE_OK !=
-        sq_prepare (plugin->dbh,
-                    "SELECT identity,audience,rnd,attributes"
-                    " FROM identity001tickets WHERE identity=?"
-                    " ORDER BY rnd LIMIT 1 OFFSET ?",
-                    &plugin->iterate_tickets)) ||
-       (SQLITE_OK !=
-        sq_prepare (plugin->dbh,
-                    "SELECT identity,audience,rnd,attributes"
-                    " FROM identity001tickets WHERE audience=?"
-                    " ORDER BY rnd LIMIT 1 OFFSET ?",
-                    &plugin->iterate_tickets_by_audience)) ) 
-  {
-    LOG_SQLITE (plugin,
-                GNUNET_ERROR_TYPE_ERROR,
-                "precompiling");
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Shutdown database connection and associate data
- * structures.
- * @param plugin the plugin context (state for this module)
- */
-static void
-database_shutdown (struct Plugin *plugin)
-{
-  int result;
-  sqlite3_stmt *stmt;
-
-  if (NULL != plugin->store_ticket)
-    sqlite3_finalize (plugin->store_ticket);
-  if (NULL != plugin->delete_ticket)
-    sqlite3_finalize (plugin->delete_ticket);
-  if (NULL != plugin->iterate_tickets)
-    sqlite3_finalize (plugin->iterate_tickets);
-  if (NULL != plugin->iterate_tickets_by_audience)
-    sqlite3_finalize (plugin->iterate_tickets_by_audience);
-  if (NULL != plugin->get_ticket_attrs)
-    sqlite3_finalize (plugin->get_ticket_attrs);
-  result = sqlite3_close (plugin->dbh);
-  if (result == SQLITE_BUSY)
-  {
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-        _("Tried to close sqlite without finalizing all prepared 
statements.\n"));
-    stmt = sqlite3_next_stmt (plugin->dbh,
-                              NULL);
-    while (NULL != stmt)
-    {
-      GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
-                       "sqlite",
-                       "Closing statement %p\n",
-                       stmt);
-      result = sqlite3_finalize (stmt);
-      if (result != SQLITE_OK)
-        GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
-                         "sqlite",
-                         "Failed to close statement %p: %d\n",
-                         stmt,
-                         result);
-      stmt = sqlite3_next_stmt (plugin->dbh,
-                                NULL);
-    }
-    result = sqlite3_close (plugin->dbh);
-  }
-  if (SQLITE_OK != result)
-    LOG_SQLITE (plugin,
-                GNUNET_ERROR_TYPE_ERROR,
-                "sqlite3_close");
-
-  GNUNET_free_non_null (plugin->fn);
-}
-
-
-/**
- * Store a ticket in the database.
- *
- * @param cls closure (internal context for the plugin)
- * @param ticket the ticket to persist
- * @param attrs the attributes associated with the ticket
- * @return #GNUNET_OK on success, else #GNUNET_SYSERR
- */
-static int
-reclaim_sqlite_store_ticket (void *cls,
-                                       const struct GNUNET_RECLAIM_Ticket 
*ticket,
-                                       const struct 
GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
-{
-  struct Plugin *plugin = cls;
-  size_t attrs_len;
-  char *attrs_ser;
-  int n;
-
-  { 
-    /* First delete duplicates */
-    struct GNUNET_SQ_QueryParam dparams[] = {
-      GNUNET_SQ_query_param_auto_from_type (&ticket->identity),
-      GNUNET_SQ_query_param_uint64 (&ticket->rnd),
-      GNUNET_SQ_query_param_end
-    };
-    if (GNUNET_OK !=
-        GNUNET_SQ_bind (plugin->delete_ticket,
-                        dparams))
-    {
-      LOG_SQLITE (plugin,
-                  GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
-                  "sqlite3_bind_XXXX");
-      GNUNET_SQ_reset (plugin->dbh,
-                       plugin->delete_ticket);
-      return GNUNET_SYSERR;
-    }
-    n = sqlite3_step (plugin->delete_ticket);
-    GNUNET_SQ_reset (plugin->dbh,
-                     plugin->delete_ticket);
-    
-    attrs_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (attrs);
-    attrs_ser = GNUNET_malloc (attrs_len);
-    GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs,
-                              attrs_ser);
-    struct GNUNET_SQ_QueryParam sparams[] = {
-      GNUNET_SQ_query_param_auto_from_type (&ticket->identity),
-      GNUNET_SQ_query_param_auto_from_type (&ticket->audience),
-      GNUNET_SQ_query_param_uint64 (&ticket->rnd),
-      GNUNET_SQ_query_param_fixed_size (attrs_ser, attrs_len),
-      GNUNET_SQ_query_param_end
-    };
-
-    if (GNUNET_OK !=
-        GNUNET_SQ_bind (plugin->store_ticket,
-                        sparams))
-    {
-      LOG_SQLITE (plugin,
-                  GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
-                  "sqlite3_bind_XXXX");
-      GNUNET_SQ_reset (plugin->dbh,
-                       plugin->store_ticket);
-      return GNUNET_SYSERR;
-    }
-    n = sqlite3_step (plugin->store_ticket);
-    GNUNET_SQ_reset (plugin->dbh,
-                     plugin->store_ticket);
-    GNUNET_free (attrs_ser);
-  }
-  switch (n)
-  {
-    case SQLITE_DONE:
-      GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
-                       "sqlite",
-                       "Ticket stored\n");
-      return GNUNET_OK;
-    case SQLITE_BUSY:
-      LOG_SQLITE (plugin,
-                  GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
-                  "sqlite3_step");
-      return GNUNET_NO;
-    default:
-      LOG_SQLITE (plugin,
-                  GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
-                  "sqlite3_step");
-      return GNUNET_SYSERR;
-  }
-}
-
-
-/**
- * Store a ticket in the database.
- *
- * @param cls closure (internal context for the plugin)
- * @param ticket the ticket to delete
- * @return #GNUNET_OK on success, else #GNUNET_SYSERR
- */
-static int
-reclaim_sqlite_delete_ticket (void *cls,
-                                        const struct GNUNET_RECLAIM_Ticket 
*ticket)
-{
-  struct Plugin *plugin = cls;
-  int n;
-
-  {  
-    struct GNUNET_SQ_QueryParam sparams[] = {
-      GNUNET_SQ_query_param_auto_from_type (&ticket->identity),
-      GNUNET_SQ_query_param_uint64 (&ticket->rnd),
-      GNUNET_SQ_query_param_end
-    };
-
-    if (GNUNET_OK !=
-        GNUNET_SQ_bind (plugin->delete_ticket,
-                        sparams))
-    {
-      LOG_SQLITE (plugin,
-                  GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
-                  "sqlite3_bind_XXXX");
-      GNUNET_SQ_reset (plugin->dbh,
-                       plugin->store_ticket);
-      return GNUNET_SYSERR;
-    }
-    n = sqlite3_step (plugin->delete_ticket);
-    GNUNET_SQ_reset (plugin->dbh,
-                     plugin->delete_ticket);
-  }
-  switch (n)
-  {
-    case SQLITE_DONE:
-      GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
-                       "sqlite",
-                       "Ticket deleted\n");
-      return GNUNET_OK;
-    case SQLITE_BUSY:
-      LOG_SQLITE (plugin,
-                  GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
-                  "sqlite3_step");
-      return GNUNET_NO;
-    default:
-      LOG_SQLITE (plugin,
-                  GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
-                  "sqlite3_step");
-      return GNUNET_SYSERR;
-  }
-}
-
-
-/**
- * The given 'sqlite' statement has been prepared to be run.
- * It will return a record which should be given to the iterator.
- * Runs the statement and parses the returned record.
- *
- * @param plugin plugin context
- * @param stmt to run (and then clean up)
- * @param iter iterator to call with the result
- * @param iter_cls closure for @a iter
- * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, 
#GNUNET_SYSERR on error
- */
-static int
-get_ticket_and_call_iterator (struct Plugin *plugin,
-                              sqlite3_stmt *stmt,
-                              GNUNET_RECLAIM_TicketIterator iter,
-                              void *iter_cls)
-{
-  struct GNUNET_RECLAIM_Ticket ticket;
-  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
-  int ret;
-  int sret;
-  size_t attrs_len;
-  char *attrs_ser;
-
-  ret = GNUNET_NO;
-  if (SQLITE_ROW == (sret = sqlite3_step (stmt)))
-  {
-    struct GNUNET_SQ_ResultSpec rs[] = {
-      GNUNET_SQ_result_spec_auto_from_type (&ticket.identity),
-      GNUNET_SQ_result_spec_auto_from_type (&ticket.audience),
-      GNUNET_SQ_result_spec_uint64 (&ticket.rnd),
-      GNUNET_SQ_result_spec_variable_size ((void**)&attrs_ser,
-                                           &attrs_len),
-      GNUNET_SQ_result_spec_end
-
-    };
-    ret = GNUNET_SQ_extract_result (stmt,
-                                    rs);
-    if (GNUNET_OK != ret)
-    {
-      GNUNET_break (0);
-      ret = GNUNET_SYSERR;
-    }
-    else
-    {
-      attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (attrs_ser,
-                                          attrs_len);
-      if (NULL != iter)
-        iter (iter_cls,
-              &ticket,
-              attrs);
-      GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs);
-      ret = GNUNET_YES;
-    }
-    GNUNET_SQ_cleanup_result (rs);
-  }
-  else
-  {
-    if (SQLITE_DONE != sret)
-      LOG_SQLITE (plugin,
-                  GNUNET_ERROR_TYPE_ERROR,
-                  "sqlite_step");
-  }
-  GNUNET_SQ_reset (plugin->dbh,
-                   stmt);
-  return ret;
-}
-
-
-/**
- * Lookup tickets in the datastore.
- *
- * @param cls closure (internal context for the plugin)
- * @param ticket the ticket to retrieve attributes for
- * @param iter function to call with the result
- * @param iter_cls closure for @a iter
- * @return #GNUNET_OK on success, else #GNUNET_SYSERR
- */
-static int
-reclaim_sqlite_ticket_get_attrs (void *cls,
-                                           const struct GNUNET_RECLAIM_Ticket 
*ticket,
-                                           GNUNET_RECLAIM_TicketIterator iter,
-                                           void *iter_cls)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_SQ_QueryParam params[] = {
-    GNUNET_SQ_query_param_auto_from_type (&ticket->identity),
-    GNUNET_SQ_query_param_uint64 (&ticket->rnd),
-    GNUNET_SQ_query_param_end
-  };
-
-  if (GNUNET_OK !=
-      GNUNET_SQ_bind (plugin->get_ticket_attrs,
-                      params))
-  {
-    LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
-                "sqlite3_bind_XXXX");
-    GNUNET_SQ_reset (plugin->dbh,
-                     plugin->get_ticket_attrs);
-    return GNUNET_SYSERR;
-  }
-  return get_ticket_and_call_iterator (plugin,
-                                       plugin->get_ticket_attrs,
-                                       iter,
-                                       iter_cls);
-}
-
-
-/**
- * Iterate over the results for a particular key and zone in the
- * datastore.  Will return at most one result to the iterator.
- *
- * @param cls closure (internal context for the plugin)
- * @param identity the issuing identity or audience (depending on audience 
switch)
- * @param audience GNUNET_YES if identity is audience
- * @param offset offset in the list of all matching records
- * @param iter function to call with the result
- * @param iter_cls closure for @a iter
- * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, 
#GNUNET_SYSERR on error
- */
-static int
-reclaim_sqlite_iterate_tickets (void *cls,
-                                          const struct 
GNUNET_CRYPTO_EcdsaPublicKey *identity,
-                                          int audience,
-                                          uint64_t offset,
-                                          GNUNET_RECLAIM_TicketIterator iter,
-                                          void *iter_cls)
-{
-  struct Plugin *plugin = cls;
-  sqlite3_stmt *stmt;
-  int err;
-
-  if (NULL == identity)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  struct GNUNET_SQ_QueryParam params[] = {
-    GNUNET_SQ_query_param_auto_from_type (identity),
-    GNUNET_SQ_query_param_uint64 (&offset),
-    GNUNET_SQ_query_param_end
-  };
-  if (GNUNET_YES == audience)
-  {
-    stmt = plugin->iterate_tickets_by_audience;
-    err = GNUNET_SQ_bind (stmt,
-                          params);
-  }
-  else
-  {
-    stmt = plugin->iterate_tickets;
-    err = GNUNET_SQ_bind (stmt,
-                          params);
-  }
-  if (GNUNET_OK != err)
-  {
-    LOG_SQLITE (plugin,
-                GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
-                "sqlite3_bind_XXXX");
-    GNUNET_SQ_reset (plugin->dbh,
-                     stmt);
-    return GNUNET_SYSERR;
-  }
-  return get_ticket_and_call_iterator (plugin,
-                                       stmt,
-                                       iter,
-                                       iter_cls);
-}
-
-
-/**
- * Entry point for the plugin.
- *
- * @param cls the "struct GNUNET_RECLAIM_PluginEnvironment*"
- * @return NULL on error, otherwise the plugin context
- */
-void *
-libgnunet_plugin_reclaim_sqlite_init (void *cls)
-{
-  static struct Plugin plugin;
-  const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
-  struct GNUNET_RECLAIM_PluginFunctions *api;
-
-  if (NULL != plugin.cfg)
-    return NULL;                /* can only initialize once! */
-  memset (&plugin, 0, sizeof (struct Plugin));
-  plugin.cfg = cfg;
-  if (GNUNET_OK != database_setup (&plugin))
-  {
-    database_shutdown (&plugin);
-    return NULL;
-  }
-  api = GNUNET_new (struct GNUNET_RECLAIM_PluginFunctions);
-  api->cls = &plugin;
-  api->store_ticket = &reclaim_sqlite_store_ticket;
-  api->delete_ticket = &reclaim_sqlite_delete_ticket;
-  api->iterate_tickets = &reclaim_sqlite_iterate_tickets;
-  api->get_ticket_attributes = &reclaim_sqlite_ticket_get_attrs;
-  LOG (GNUNET_ERROR_TYPE_INFO,
-       _("Sqlite database running\n"));
-  return api;
-}
-
-
-/**
- * Exit point from the plugin.
- *
- * @param cls the plugin context (as returned by "init")
- * @return always NULL
- */
-void *
-libgnunet_plugin_reclaim_sqlite_done (void *cls)
-{
-  struct GNUNET_RECLAIM_PluginFunctions *api = cls;
-  struct Plugin *plugin = api->cls;
-
-  database_shutdown (plugin);
-  plugin->cfg = NULL;
-  GNUNET_free (api);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "sqlite plugin is finished\n");
-  return NULL;
-}
-
-/* end of plugin_reclaim_sqlite.c */
diff --git a/src/reclaim/reclaim.conf b/src/reclaim/reclaim.conf
index 5073199ca..605a63d5e 100644
--- a/src/reclaim/reclaim.conf
+++ b/src/reclaim/reclaim.conf
@@ -10,7 +10,6 @@ UNIXPATH = 
$GNUNET_USER_RUNTIME_DIR/gnunet-service-reclaim.sock
 UNIX_MATCH_UID = NO
 UNIX_MATCH_GID = YES
 TOKEN_EXPIRATION_INTERVAL = 30 m
-DATABASE = sqlite
 
 [reclaim-rest-plugin]
 #ADDRESS = https://identity.gnu:8000#/login
@@ -18,6 +17,3 @@ ADDRESS = https://ui.reclaim/#/login
 PSW = secret
 JWT_SECRET = secret
 EXPIRATION_TIME = 1d
-
-[reclaim-sqlite]
-FILENAME = $GNUNET_DATA_HOME/reclaim/sqlite.db
diff --git a/src/reclaim/reclaim.h b/src/reclaim/reclaim.h
index 38f32426a..c29902ab1 100644
--- a/src/reclaim/reclaim.h
+++ b/src/reclaim/reclaim.h
@@ -11,7 +11,7 @@
      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/>.
 
@@ -76,7 +76,7 @@ struct AttributeStoreResultMessage
    * Message header
    */
   struct GNUNET_MessageHeader header;
-  
+
   /**
    * Unique identifier for this request (for key collisions).
    */
@@ -201,12 +201,8 @@ struct TicketIterationStartMessage
   /**
    * Identity.
    */
-  struct GNUNET_CRYPTO_EcdsaPublicKey identity;
+  struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
 
-  /**
-   * Identity is audience or issuer
-   */
-  uint32_t is_audience GNUNET_PACKED;
 };
 
 
@@ -385,6 +381,11 @@ struct ConsumeTicketResultMessage
    */
   uint32_t id GNUNET_PACKED;
 
+  /**
+   * Result
+   */
+  uint32_t result GNUNET_PACKED;
+
   /**
    * Length of serialized attribute data
    */
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c
index cfa0cbbfb..0edae76c2 100644
--- a/src/reclaim/reclaim_api.c
+++ b/src/reclaim/reclaim_api.c
@@ -11,7 +11,7 @@
      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/>.
 
@@ -24,15 +24,17 @@
  * @author Martin Schanzenbach
  */
 #include "platform.h"
+
 #include "gnunet_util_lib.h"
+
 #include "gnunet_constants.h"
-#include "gnunet_protocols.h"
 #include "gnunet_mq_lib.h"
-#include "gnunet_reclaim_service.h"
+#include "gnunet_protocols.h"
 #include "gnunet_reclaim_attribute_lib.h"
+#include "gnunet_reclaim_service.h"
 #include "reclaim.h"
 
-#define LOG(kind,...) GNUNET_log_from (kind, "reclaim-api",__VA_ARGS__)
+#define LOG(kind, ...) GNUNET_log_from (kind, "reclaim-api", __VA_ARGS__)
 
 
 /**
@@ -96,9 +98,9 @@ struct GNUNET_RECLAIM_Operation
    * Closure for @e cont or @e cb.
    */
   void *cls;
-
 };
 
+
 /**
  * Handle for a ticket iterator operation
  */
@@ -126,7 +128,7 @@ struct GNUNET_RECLAIM_TicketIterator
   GNUNET_SCHEDULER_TaskCallback finish_cb;
 
   /**
-   * Closure for @e error_cb.
+   * Closure for @e finish_cb.
    */
   void *finish_cb_cls;
 
@@ -160,7 +162,6 @@ struct GNUNET_RECLAIM_TicketIterator
    * The operation id this zone iteration operation has
    */
   uint32_t r_id;
-
 };
 
 
@@ -181,7 +182,7 @@ struct GNUNET_RECLAIM_AttributeIterator
   struct GNUNET_RECLAIM_AttributeIterator *prev;
 
   /**
-   * Main handle to access the idp.
+   * Main handle to access the service.
    */
   struct GNUNET_RECLAIM_Handle *h;
 
@@ -191,7 +192,7 @@ struct GNUNET_RECLAIM_AttributeIterator
   GNUNET_SCHEDULER_TaskCallback finish_cb;
 
   /**
-   * Closure for @e error_cb.
+   * Closure for @e finish_cb.
    */
   void *finish_cb_cls;
 
@@ -230,12 +231,11 @@ struct GNUNET_RECLAIM_AttributeIterator
    * The operation id this zone iteration operation has
    */
   uint32_t r_id;
-
 };
 
 
 /**
- * Handle for the service.
+ * Handle to the service.
  */
 struct GNUNET_RECLAIM_Handle
 {
@@ -284,7 +284,6 @@ struct GNUNET_RECLAIM_Handle
    */
   struct GNUNET_RECLAIM_TicketIterator *ticket_it_tail;
 
-
   /**
    * Currently pending transmission request, or NULL for none.
    */
@@ -293,7 +292,7 @@ struct GNUNET_RECLAIM_Handle
   /**
    * Task doing exponential back-off trying to reconnect.
    */
-  struct GNUNET_SCHEDULER_Task * reconnect_task;
+  struct GNUNET_SCHEDULER_Task *reconnect_task;
 
   /**
    * Time for next connect retry.
@@ -314,9 +313,9 @@ struct GNUNET_RECLAIM_Handle
    * Are we polling for incoming messages right now?
    */
   int in_receive;
-
 };
 
+
 /**
  * Try again to connect to the service.
  *
@@ -325,6 +324,7 @@ struct GNUNET_RECLAIM_Handle
 static void
 reconnect (struct GNUNET_RECLAIM_Handle *h);
 
+
 /**
  * Reconnect
  *
@@ -350,14 +350,13 @@ force_reconnect (struct GNUNET_RECLAIM_Handle *handle)
 {
   GNUNET_MQ_destroy (handle->mq);
   handle->mq = NULL;
-  handle->reconnect_backoff
-    = GNUNET_TIME_STD_BACKOFF (handle->reconnect_backoff);
-  handle->reconnect_task
-    = GNUNET_SCHEDULER_add_delayed (handle->reconnect_backoff,
-                                    &reconnect_task,
-                                    handle);
+  handle->reconnect_backoff =
+      GNUNET_TIME_STD_BACKOFF (handle->reconnect_backoff);
+  handle->reconnect_task = GNUNET_SCHEDULER_add_delayed (
+      handle->reconnect_backoff, &reconnect_task, handle);
 }
 
+
 /**
  * Free @a it.
  *
@@ -368,22 +367,25 @@ free_it (struct GNUNET_RECLAIM_AttributeIterator *it)
 {
   struct GNUNET_RECLAIM_Handle *h = it->h;
 
-  GNUNET_CONTAINER_DLL_remove (h->it_head,
-                               h->it_tail,
-                               it);
+  GNUNET_CONTAINER_DLL_remove (h->it_head, h->it_tail, it);
   if (NULL != it->env)
     GNUNET_MQ_discard (it->env);
   GNUNET_free (it);
 }
 
+/**
+ * Free @a op
+ *
+ * @param op the operation to free
+ */
 static void
-free_op (struct GNUNET_RECLAIM_Operation* op)
+free_op (struct GNUNET_RECLAIM_Operation *op)
 {
   if (NULL == op)
     return;
   if (NULL != op->env)
     GNUNET_MQ_discard (op->env);
-  GNUNET_free(op);
+  GNUNET_free (op);
 }
 
 
@@ -396,13 +398,13 @@ free_op (struct GNUNET_RECLAIM_Operation* op)
  * @param error error code
  */
 static void
-mq_error_handler (void *cls,
-                  enum GNUNET_MQ_Error error)
+mq_error_handler (void *cls, enum GNUNET_MQ_Error error)
 {
   struct GNUNET_RECLAIM_Handle *handle = cls;
   force_reconnect (handle);
 }
 
+
 /**
  * Handle an incoming message of type
  * #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE
@@ -412,7 +414,7 @@ mq_error_handler (void *cls,
  */
 static void
 handle_attribute_store_response (void *cls,
-                             const struct AttributeStoreResultMessage *msg)
+                                 const struct AttributeStoreResultMessage *msg)
 {
   struct GNUNET_RECLAIM_Handle *h = cls;
   struct GNUNET_RECLAIM_Operation *op;
@@ -428,23 +430,17 @@ handle_attribute_store_response (void *cls,
 
   res = ntohl (msg->op_result);
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Received ATTRIBUTE_STORE_RESPONSE with result %d\n",
-       res);
+       "Received ATTRIBUTE_STORE_RESPONSE with result %d\n", res);
 
   /* TODO: add actual error message to response... */
   if (GNUNET_SYSERR == res)
-    emsg = _("failed to store record\n");
+    emsg = _ ("failed to store record\n");
   else
     emsg = NULL;
   if (NULL != op->as_cb)
-    op->as_cb (op->cls,
-              res,
-              emsg);
-  GNUNET_CONTAINER_DLL_remove (h->op_head,
-                               h->op_tail,
-                               op);
+    op->as_cb (op->cls, res, emsg);
+  GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
   free_op (op);
-
 }
 
 
@@ -465,8 +461,7 @@ check_consume_ticket_result (void *cls,
 
   msg_len = ntohs (msg->header.size);
   attrs_len = ntohs (msg->attrs_len);
-  if (msg_len != sizeof (struct ConsumeTicketResultMessage) + attrs_len)
-  {
+  if (msg_len != sizeof (struct ConsumeTicketResultMessage) + attrs_len) {
     GNUNET_break (0);
     return GNUNET_SYSERR;
   }
@@ -491,8 +486,7 @@ handle_consume_ticket_result (void *cls,
   uint32_t r_id = ntohl (msg->id);
 
   attrs_len = ntohs (msg->attrs_len);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Processing attribute result.\n");
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing attribute result.\n");
 
 
   for (op = h->op_head; NULL != op; op = op->next)
@@ -504,33 +498,20 @@ handle_consume_ticket_result (void *cls,
   {
     struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
     struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
-    attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char*)&msg[1],
-                                        attrs_len);
-    if (NULL != op->ar_cb)
-    {
-      if (NULL == attrs)
-      {
-        op->ar_cb (op->cls,
-                   &msg->identity,
-                   NULL);
-      }
-      else
-      {
+    attrs =
+        GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char *)&msg[1], attrs_len);
+    if (NULL != op->ar_cb) {
+      if (NULL == attrs) {
+        op->ar_cb (op->cls, &msg->identity, NULL);
+      } else {
         for (le = attrs->list_head; NULL != le; le = le->next)
-          op->ar_cb (op->cls,
-                     &msg->identity,
-                     le->claim);
+          op->ar_cb (op->cls, &msg->identity, le->claim);
         GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs);
       }
     }
-    if (NULL != op)
-    {
-      op->ar_cb (op->cls,
-                 NULL,
-                 NULL);
-      GNUNET_CONTAINER_DLL_remove (h->op_head,
-                                   h->op_tail,
-                                   op);
+    if (NULL != op) {
+      op->ar_cb (op->cls, NULL, NULL);
+      GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
       free_op (op);
     }
     return;
@@ -548,16 +529,14 @@ handle_consume_ticket_result (void *cls,
  * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
  */
 static int
-check_attribute_result (void *cls,
-                        const struct AttributeResultMessage *msg)
+check_attribute_result (void *cls, const struct AttributeResultMessage *msg)
 {
   size_t msg_len;
   size_t attr_len;
 
   msg_len = ntohs (msg->header.size);
   attr_len = ntohs (msg->attr_len);
-  if (msg_len != sizeof (struct AttributeResultMessage) + attr_len)
-  {
+  if (msg_len != sizeof (struct AttributeResultMessage) + attr_len) {
     GNUNET_break (0);
     return GNUNET_SYSERR;
   }
@@ -573,8 +552,7 @@ check_attribute_result (void *cls,
  * @param msg the message we received
  */
 static void
-handle_attribute_result (void *cls,
-                         const struct AttributeResultMessage *msg)
+handle_attribute_result (void *cls, const struct AttributeResultMessage *msg)
 {
   static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy;
   struct GNUNET_RECLAIM_Handle *h = cls;
@@ -584,8 +562,7 @@ handle_attribute_result (void *cls,
   uint32_t r_id = ntohl (msg->id);
 
   attr_len = ntohs (msg->attr_len);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Processing attribute result.\n");
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing attribute result.\n");
 
 
   for (it = h->it_head; NULL != it; it = it->next)
@@ -597,54 +574,36 @@ handle_attribute_result (void *cls,
   if ((NULL == it) && (NULL == op))
     return;
 
-  if ( (0 == (memcmp (&msg->identity,
-                      &identity_dummy,
-                      sizeof (identity_dummy)))) )
-  {
-    if ((NULL == it) && (NULL == op))
-    {
+  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) {
       if (NULL != it->finish_cb)
         it->finish_cb (it->finish_cb_cls);
       free_it (it);
     }
-    if (NULL != op)
-    {
+    if (NULL != op) {
       if (NULL != op->ar_cb)
-        op->ar_cb (op->cls,
-                   NULL,
-                   NULL);
-      GNUNET_CONTAINER_DLL_remove (h->op_head,
-                                   h->op_tail,
-                                   op);
+        op->ar_cb (op->cls, NULL, NULL);
+      GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
       free_op (op);
-
     }
     return;
   }
 
   {
     struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr;
-    attr = GNUNET_RECLAIM_ATTRIBUTE_deserialize ((char*)&msg[1],
-                                                  attr_len);
-    if (NULL != it)
-    {
+    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);
-    } else if (NULL != op)
-    {
+        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);
-
+        op->ar_cb (op->cls, &msg->identity, attr);
     }
     GNUNET_free (attr);
     return;
@@ -661,14 +620,12 @@ handle_attribute_result (void *cls,
  * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
  */
 static int
-check_ticket_result (void *cls,
-                     const struct TicketResultMessage *msg)
+check_ticket_result (void *cls, const struct TicketResultMessage *msg)
 {
   size_t msg_len;
 
   msg_len = ntohs (msg->header.size);
-  if (msg_len < sizeof (struct TicketResultMessage))
-  {
+  if (msg_len < sizeof (struct TicketResultMessage)) {
     GNUNET_break (0);
     return GNUNET_SYSERR;
   }
@@ -676,7 +633,6 @@ check_ticket_result (void *cls,
 }
 
 
-
 /**
  * Handle an incoming message of type
  * #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT
@@ -685,8 +641,7 @@ check_ticket_result (void *cls,
  * @param msg the message we received
  */
 static void
-handle_ticket_result (void *cls,
-                      const struct TicketResultMessage *msg)
+handle_ticket_result (void *cls, const struct TicketResultMessage *msg)
 {
   struct GNUNET_RECLAIM_Handle *handle = cls;
   struct GNUNET_RECLAIM_Operation *op;
@@ -704,13 +659,9 @@ handle_ticket_result (void *cls,
   if ((NULL == op) && (NULL == it))
     return;
   msg_len = ntohs (msg->header.size);
-  if (NULL != op)
-  {
-    GNUNET_CONTAINER_DLL_remove (handle->op_head,
-                                 handle->op_tail,
-                                 op);
-    if (msg_len == sizeof (struct TicketResultMessage))
-    {
+  if (NULL != op) {
+    GNUNET_CONTAINER_DLL_remove (handle->op_head, handle->op_tail, op);
+    if (msg_len == sizeof (struct TicketResultMessage)) {
       if (NULL != op->tr_cb)
         op->tr_cb (op->cls, NULL);
     } else {
@@ -721,12 +672,10 @@ handle_ticket_result (void *cls,
     free_op (op);
     return;
   } else if (NULL != it) {
-    if (msg_len == sizeof (struct TicketResultMessage))
-    {
+    if (msg_len == sizeof (struct TicketResultMessage)) {
       if (NULL != it->tr_cb)
         GNUNET_CONTAINER_DLL_remove (handle->ticket_it_head,
-                                     handle->ticket_it_tail,
-                                     it);
+                                     handle->ticket_it_tail, it);
       it->finish_cb (it->finish_cb_cls);
       GNUNET_free (it);
     } else {
@@ -756,8 +705,7 @@ handle_revoke_ticket_result (void *cls,
   uint32_t r_id = ntohl (msg->id);
   int32_t success;
 
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Processing revocation result.\n");
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing revocation result.\n");
 
 
   for (op = h->op_head; NULL != op; op = op->next)
@@ -767,15 +715,10 @@ handle_revoke_ticket_result (void *cls,
     return;
   success = ntohl (msg->success);
   {
-    if (NULL != op->rvk_cb)
-    {
-      op->rvk_cb (op->cls,
-                  success,
-                  NULL);
+    if (NULL != op->rvk_cb) {
+      op->rvk_cb (op->cls, success, NULL);
     }
-    GNUNET_CONTAINER_DLL_remove (h->op_head,
-                                 h->op_tail,
-                                 op);
+    GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
     free_op (op);
     return;
   }
@@ -783,7 +726,6 @@ handle_revoke_ticket_result (void *cls,
 }
 
 
-
 /**
  * Try again to connect to the service.
  *
@@ -793,44 +735,34 @@ static void
 reconnect (struct GNUNET_RECLAIM_Handle *h)
 {
   struct GNUNET_MQ_MessageHandler handlers[] = {
-    GNUNET_MQ_hd_fixed_size (attribute_store_response,
-                             
GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE_RESPONSE,
-                             struct AttributeStoreResultMessage,
-                             h),
-    GNUNET_MQ_hd_var_size (attribute_result,
-                           GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT,
-                           struct AttributeResultMessage,
-                           h),
-    GNUNET_MQ_hd_var_size (ticket_result,
-                           GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT,
-                           struct TicketResultMessage,
-                           h),
-    GNUNET_MQ_hd_var_size (consume_ticket_result,
-                           GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT,
-                           struct ConsumeTicketResultMessage,
-                           h),
-    GNUNET_MQ_hd_fixed_size (revoke_ticket_result,
-                             GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT,
-                             struct RevokeTicketResultMessage,
-                             h),
-    GNUNET_MQ_handler_end ()
-  };
+      GNUNET_MQ_hd_fixed_size (
+          attribute_store_response,
+          GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE_RESPONSE,
+          struct AttributeStoreResultMessage, h),
+      GNUNET_MQ_hd_var_size (attribute_result,
+                             GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT,
+                             struct AttributeResultMessage, h),
+      GNUNET_MQ_hd_var_size (ticket_result,
+                             GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT,
+                             struct TicketResultMessage, h),
+      GNUNET_MQ_hd_var_size (consume_ticket_result,
+                             GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT,
+                             struct ConsumeTicketResultMessage, h),
+      GNUNET_MQ_hd_fixed_size (revoke_ticket_result,
+                               
GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT,
+                               struct RevokeTicketResultMessage, h),
+      GNUNET_MQ_handler_end ()};
   struct GNUNET_RECLAIM_Operation *op;
 
   GNUNET_assert (NULL == h->mq);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Connecting to reclaim service.\n");
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to reclaim service.\n");
 
-  h->mq = GNUNET_CLIENT_connect (h->cfg,
-                                 "reclaim",
-                                 handlers,
-                                 &mq_error_handler,
-                                 h);
+  h->mq =
+      GNUNET_CLIENT_connect (h->cfg, "reclaim", handlers, &mq_error_handler, 
h);
   if (NULL == h->mq)
     return;
   for (op = h->op_head; NULL != op; op = op->next)
-    GNUNET_MQ_send_copy (h->mq,
-                         op->env);
+    GNUNET_MQ_send_copy (h->mq, op->env);
 }
 
 
@@ -848,8 +780,7 @@ GNUNET_RECLAIM_connect (const struct 
GNUNET_CONFIGURATION_Handle *cfg)
   h = GNUNET_new (struct GNUNET_RECLAIM_Handle);
   h->cfg = cfg;
   reconnect (h);
-  if (NULL == h->mq)
-  {
+  if (NULL == h->mq) {
     GNUNET_free (h);
     return NULL;
   }
@@ -870,9 +801,7 @@ GNUNET_RECLAIM_cancel (struct GNUNET_RECLAIM_Operation *op)
 {
   struct GNUNET_RECLAIM_Handle *h = op->h;
 
-  GNUNET_CONTAINER_DLL_remove (h->op_head,
-                               h->op_tail,
-                               op);
+  GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
   free_op (op);
 }
 
@@ -886,13 +815,11 @@ void
 GNUNET_RECLAIM_disconnect (struct GNUNET_RECLAIM_Handle *h)
 {
   GNUNET_assert (NULL != h);
-  if (NULL != h->mq)
-  {
+  if (NULL != h->mq) {
     GNUNET_MQ_destroy (h->mq);
     h->mq = NULL;
   }
-  if (NULL != h->reconnect_task)
-  {
+  if (NULL != h->reconnect_task) {
     GNUNET_SCHEDULER_cancel (h->reconnect_task);
     h->reconnect_task = NULL;
   }
@@ -904,7 +831,7 @@ GNUNET_RECLAIM_disconnect (struct GNUNET_RECLAIM_Handle *h)
  * Store an attribute.  If the attribute is already present,
  * it is replaced with the new attribute.
  *
- * @param h handle to the reclaim
+ * @param h handle to the re:claimID service
  * @param pkey private key of the identity
  * @param attr the attribute value
  * @param exp_interval the relative expiration interval for the attribute
@@ -913,12 +840,12 @@ GNUNET_RECLAIM_disconnect (struct GNUNET_RECLAIM_Handle 
*h)
  * @return handle to abort the request
  */
 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_TIME_Relative 
*exp_interval,
-                                          
GNUNET_RECLAIM_ContinuationWithStatus cont,
-                                          void *cont_cls)
+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_TIME_Relative *exp_interval,
+    GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
 {
   struct GNUNET_RECLAIM_Operation *op;
   struct AttributeStoreMessage *sam;
@@ -929,26 +856,20 @@ GNUNET_RECLAIM_attribute_store (struct 
GNUNET_RECLAIM_Handle *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);
+  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
   attr_len = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (attr);
-  op->env = GNUNET_MQ_msg_extra (sam,
-                                 attr_len,
+  op->env = GNUNET_MQ_msg_extra (sam, attr_len,
                                  GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE);
   sam->identity = *pkey;
   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)
-    GNUNET_MQ_send_copy (h->mq,
-                         op->env);
+    GNUNET_MQ_send_copy (h->mq, op->env);
   return op;
-
 }
 
 
@@ -964,28 +885,25 @@ GNUNET_RECLAIM_attribute_store (struct 
GNUNET_RECLAIM_Handle *h,
  * On normal completion, @a finish_cb proc will be
  * invoked.
  *
- * @param h handle to the idp
- * @param identity identity to access
- * @param error_cb function to call on error (i.e. disconnect),
+ * @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 attribute; it
- *        will be called repeatedly with a value (if available)
- * @param proc_cls closure for @a proc
- * @param finish_cb function to call on completion
+ * @param error_cb_cls Closure for @a error_cb
+ * @param proc Function to call on each attribute
+ * @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
+ * @param finish_cb_cls Closure for @a finish_cb
+ * @return an iterator Handle to use for iteration
  */
 struct GNUNET_RECLAIM_AttributeIterator *
-GNUNET_RECLAIM_get_attributes_start (struct GNUNET_RECLAIM_Handle *h,
-                                               const struct 
GNUNET_CRYPTO_EcdsaPrivateKey *identity,
-                                               GNUNET_SCHEDULER_TaskCallback 
error_cb,
-                                               void *error_cb_cls,
-                                               GNUNET_RECLAIM_AttributeResult 
proc,
-                                               void *proc_cls,
-                                               GNUNET_SCHEDULER_TaskCallback 
finish_cb,
-                                               void *finish_cb_cls)
+GNUNET_RECLAIM_get_attributes_start (
+    struct GNUNET_RECLAIM_Handle *h,
+    const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
+    GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls,
+    GNUNET_RECLAIM_AttributeResult proc, void *proc_cls,
+    GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
 {
   struct GNUNET_RECLAIM_AttributeIterator *it;
   struct GNUNET_MQ_Envelope *env;
@@ -1003,9 +921,7 @@ GNUNET_RECLAIM_get_attributes_start (struct 
GNUNET_RECLAIM_Handle *h,
   it->proc_cls = proc_cls;
   it->r_id = rid;
   it->identity = *identity;
-  GNUNET_CONTAINER_DLL_insert_tail (h->it_head,
-                                    h->it_tail,
-                                    it);
+  GNUNET_CONTAINER_DLL_insert_tail (h->it_head, h->it_tail, it);
   env = GNUNET_MQ_msg (msg,
                        GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START);
   msg->id = htonl (rid);
@@ -1013,8 +929,7 @@ GNUNET_RECLAIM_get_attributes_start (struct 
GNUNET_RECLAIM_Handle *h,
   if (NULL == h->mq)
     it->env = env;
   else
-    GNUNET_MQ_send (h->mq,
-                    env);
+    GNUNET_MQ_send (h->mq, env);
   return it;
 }
 
@@ -1032,16 +947,15 @@ GNUNET_RECLAIM_get_attributes_next (struct 
GNUNET_RECLAIM_AttributeIterator *it)
   struct AttributeIterationNextMessage *msg;
   struct GNUNET_MQ_Envelope *env;
 
-  env = GNUNET_MQ_msg (msg,
-                       GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT);
+  env =
+      GNUNET_MQ_msg (msg, 
GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT);
   msg->id = htonl (it->r_id);
-  GNUNET_MQ_send (h->mq,
-                  env);
+  GNUNET_MQ_send (h->mq, env);
 }
 
 
 /**
- * Stops iteration and releases the idp handle for further calls.  Must
+ * 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.
  *
@@ -1054,38 +968,36 @@ GNUNET_RECLAIM_get_attributes_stop (struct 
GNUNET_RECLAIM_AttributeIterator *it)
   struct GNUNET_MQ_Envelope *env;
   struct AttributeIterationStopMessage *msg;
 
-  if (NULL != h->mq)
-  {
+  if (NULL != h->mq) {
     env = GNUNET_MQ_msg (msg,
                          GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP);
     msg->id = htonl (it->r_id);
-    GNUNET_MQ_send (h->mq,
-                    env);
+    GNUNET_MQ_send (h->mq, env);
   }
   free_it (it);
 }
 
 
-/** TODO
- * Issues a ticket to another identity. The identity may use
- * @GNUNET_RECLAIM_authorization_ticket_consume to consume the ticket
- * and retrieve the attributes specified in the AttributeList.
+/**
+ * Issues a ticket to another relying party. The identity may use
+ * @GNUNET_RECLAIM_ticket_consume to consume the ticket
+ * and retrieve the attributes specified in the attribute list.
  *
  * @param h the reclaim to use
- * @param iss the issuing identity
- * @param rp the subject of the ticket (the relying party)
+ * @param iss the issuing identity (= the user)
+ * @param rp the subject of the ticket (= the relying party)
  * @param attrs the attributes that the relying party is given access to
  * @param cb the callback
  * @param cb_cls the callback closure
  * @return handle to abort the operation
  */
 struct GNUNET_RECLAIM_Operation *
-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,
-                                       GNUNET_RECLAIM_TicketCallback cb,
-                                       void *cb_cls)
+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,
+    GNUNET_RECLAIM_TicketCallback cb, void *cb_cls)
 {
   struct GNUNET_RECLAIM_Operation *op;
   struct IssueTicketMessage *tim;
@@ -1096,44 +1008,41 @@ GNUNET_RECLAIM_ticket_issue (struct 
GNUNET_RECLAIM_Handle *h,
   op->tr_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);
+  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
   attr_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (attrs);
-  op->env = GNUNET_MQ_msg_extra (tim,
-                                 attr_len,
+  op->env = GNUNET_MQ_msg_extra (tim, attr_len,
                                  GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET);
   tim->identity = *iss;
   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)
-    GNUNET_MQ_send_copy (h->mq,
-                         op->env);
+    GNUNET_MQ_send_copy (h->mq, op->env);
   return op;
 }
 
+
 /**
  * Consumes an issued ticket. The ticket is persisted
  * and used to retrieve identity information from the issuer
  *
  * @param h the reclaim to use
- * @param identity the identity that is the subject of the issued ticket (the 
relying party)
+ * @param identity the identity that is the subject of the issued ticket (the
+ * relying party)
  * @param ticket the issued ticket to consume
  * @param cb the callback to call
  * @param cb_cls the callback closure
  * @return handle to abort the operation
  */
 struct GNUNET_RECLAIM_Operation *
-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_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)
 {
   struct GNUNET_RECLAIM_Operation *op;
   struct ConsumeTicketMessage *ctm;
@@ -1143,87 +1052,19 @@ GNUNET_RECLAIM_ticket_consume (struct 
GNUNET_RECLAIM_Handle *h,
   op->ar_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);
-  op->env = GNUNET_MQ_msg_extra (ctm,
-                                 sizeof (const struct GNUNET_RECLAIM_Ticket),
-                                 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET);
+  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
+  op->env =
+      GNUNET_MQ_msg_extra (ctm, sizeof (const struct GNUNET_RECLAIM_Ticket),
+                           GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET);
   ctm->identity = *identity;
   ctm->id = htonl (op->r_id);
 
-  GNUNET_memcpy ((char*)&ctm[1],
-                 ticket,
+  GNUNET_memcpy ((char *)&ctm[1], ticket,
                  sizeof (const struct GNUNET_RECLAIM_Ticket));
 
   if (NULL != h->mq)
-    GNUNET_MQ_send_copy (h->mq,
-                         op->env);
+    GNUNET_MQ_send_copy (h->mq, op->env);
   return op;
-
-}
-
-
-/**
- * Lists all tickets that have been issued to remote
- * identites (relying parties)
- *
- * @param h the reclaim to use
- * @param identity the issuing identity
- * @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 ticket; it
- *        will be called repeatedly with a value (if available)
- * @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_TicketIterator *
-GNUNET_RECLAIM_ticket_iteration_start (struct GNUNET_RECLAIM_Handle *h,
-                                                 const struct 
GNUNET_CRYPTO_EcdsaPrivateKey *identity,
-                                                 GNUNET_SCHEDULER_TaskCallback 
error_cb,
-                                                 void *error_cb_cls,
-                                                 GNUNET_RECLAIM_TicketCallback 
proc,
-                                                 void *proc_cls,
-                                                 GNUNET_SCHEDULER_TaskCallback 
finish_cb,
-                                                 void *finish_cb_cls)
-{
-  struct GNUNET_RECLAIM_TicketIterator *it;
-  struct GNUNET_CRYPTO_EcdsaPublicKey identity_pub;
-  struct GNUNET_MQ_Envelope *env;
-  struct TicketIterationStartMessage *msg;
-  uint32_t rid;
-
-  GNUNET_CRYPTO_ecdsa_key_get_public (identity,
-                                      &identity_pub);
-  rid = h->r_id_gen++;
-  it = GNUNET_new (struct GNUNET_RECLAIM_TicketIterator);
-  it->h = h;
-  it->error_cb = error_cb;
-  it->error_cb_cls = error_cb_cls;
-  it->finish_cb = finish_cb;
-  it->finish_cb_cls = finish_cb_cls;
-  it->tr_cb = proc;
-  it->cls = proc_cls;
-  it->r_id = rid;
-  GNUNET_CONTAINER_DLL_insert_tail (h->ticket_it_head,
-                                    h->ticket_it_tail,
-                                    it);
-  env = GNUNET_MQ_msg (msg,
-                       GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START);
-  msg->id = htonl (rid);
-  msg->identity = identity_pub;
-  msg->is_audience = htonl (GNUNET_NO);
-  if (NULL == h->mq)
-    it->env = env;
-  else
-    GNUNET_MQ_send (h->mq,
-                    env);
-  return it;
-
 }
 
 
@@ -1245,14 +1086,12 @@ GNUNET_RECLAIM_ticket_iteration_start (struct 
GNUNET_RECLAIM_Handle *h,
  * @return an iterator handle to use for iteration
  */
 struct GNUNET_RECLAIM_TicketIterator *
-GNUNET_RECLAIM_ticket_iteration_start_rp (struct GNUNET_RECLAIM_Handle *h,
-                                                    const struct 
GNUNET_CRYPTO_EcdsaPublicKey *identity,
-                                                    
GNUNET_SCHEDULER_TaskCallback error_cb,
-                                                    void *error_cb_cls,
-                                                    
GNUNET_RECLAIM_TicketCallback proc,
-                                                    void *proc_cls,
-                                                    
GNUNET_SCHEDULER_TaskCallback finish_cb,
-                                                    void *finish_cb_cls)
+GNUNET_RECLAIM_ticket_iteration_start (
+    struct GNUNET_RECLAIM_Handle *h,
+    const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
+    GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls,
+    GNUNET_RECLAIM_TicketCallback proc, void *proc_cls,
+    GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
 {
   struct GNUNET_RECLAIM_TicketIterator *it;
   struct GNUNET_MQ_Envelope *env;
@@ -1269,27 +1108,21 @@ GNUNET_RECLAIM_ticket_iteration_start_rp (struct 
GNUNET_RECLAIM_Handle *h,
   it->tr_cb = proc;
   it->cls = proc_cls;
   it->r_id = rid;
-  GNUNET_CONTAINER_DLL_insert_tail (h->ticket_it_head,
-                                    h->ticket_it_tail,
-                                    it);
-  env = GNUNET_MQ_msg (msg,
-                       GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START);
+  GNUNET_CONTAINER_DLL_insert_tail (h->ticket_it_head, h->ticket_it_tail, it);
+  env = GNUNET_MQ_msg (msg, 
GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START);
   msg->id = htonl (rid);
   msg->identity = *identity;
-  msg->is_audience = htonl (GNUNET_YES);
   if (NULL == h->mq)
     it->env = env;
   else
-    GNUNET_MQ_send (h->mq,
-                    env);
+    GNUNET_MQ_send (h->mq, env);
   return it;
-
-
 }
 
+
 /**
- * Calls the record processor specified in 
#GNUNET_RECLAIM_ticket_iteration_start
- * for the next record.
+ * Calls the ticket processor specified in
+ * #GNUNET_RECLAIM_ticket_iteration_start for the next record.
  *
  * @param it the iterator
  */
@@ -1300,16 +1133,14 @@ GNUNET_RECLAIM_ticket_iteration_next (struct 
GNUNET_RECLAIM_TicketIterator *it)
   struct TicketIterationNextMessage *msg;
   struct GNUNET_MQ_Envelope *env;
 
-  env = GNUNET_MQ_msg (msg,
-                       GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT);
+  env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT);
   msg->id = htonl (it->r_id);
-  GNUNET_MQ_send (h->mq,
-                  env);
+  GNUNET_MQ_send (h->mq, env);
 }
 
 
 /**
- * Stops iteration and releases the idp handle for further calls.  Must
+ * 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.
  *
@@ -1322,22 +1153,23 @@ GNUNET_RECLAIM_ticket_iteration_stop (struct 
GNUNET_RECLAIM_TicketIterator *it)
   struct GNUNET_MQ_Envelope *env;
   struct TicketIterationStopMessage *msg;
 
-  if (NULL != h->mq)
-  {
-    env = GNUNET_MQ_msg (msg,
-                         GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP);
+  if (NULL != h->mq) {
+    env =
+        GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP);
     msg->id = htonl (it->r_id);
-    GNUNET_MQ_send (h->mq,
-                    env);
+    GNUNET_MQ_send (h->mq, env);
   }
   GNUNET_free (it);
 }
 
+
 /**
  * Revoked an issued ticket. The relying party will be unable to retrieve
- * updated attributes.
+ * attributes. Other issued tickets remain unaffected.
+ * This includes tickets issued to other relying parties as well as to
+ * other tickets issued to the audience specified in this ticket.
  *
- * @param h the reclaim to use
+ * @param h the identity provider to use
  * @param identity the issuing identity
  * @param ticket the ticket to revoke
  * @param cb the callback
@@ -1345,11 +1177,11 @@ GNUNET_RECLAIM_ticket_iteration_stop (struct 
GNUNET_RECLAIM_TicketIterator *it)
  * @return handle to abort the operation
  */
 struct GNUNET_RECLAIM_Operation *
-GNUNET_RECLAIM_ticket_revoke (struct GNUNET_RECLAIM_Handle *h,
-                                        const struct 
GNUNET_CRYPTO_EcdsaPrivateKey *identity,
-                                        const struct GNUNET_RECLAIM_Ticket 
*ticket,
-                                        GNUNET_RECLAIM_ContinuationWithStatus 
cb,
-                                        void *cb_cls)
+GNUNET_RECLAIM_ticket_revoke (
+    struct GNUNET_RECLAIM_Handle *h,
+    const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
+    const struct GNUNET_RECLAIM_Ticket *ticket,
+    GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls)
 {
   struct GNUNET_RECLAIM_Operation *op;
   struct RevokeTicketMessage *msg;
@@ -1361,25 +1193,18 @@ GNUNET_RECLAIM_ticket_revoke (struct 
GNUNET_RECLAIM_Handle *h,
   op->rvk_cb = cb;
   op->cls = cb_cls;
   op->r_id = rid;
-  GNUNET_CONTAINER_DLL_insert_tail (h->op_head,
-                                    h->op_tail,
-                                    op);
-  op->env = GNUNET_MQ_msg_extra (msg,
-                             sizeof (struct GNUNET_RECLAIM_Ticket),
-                             GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET);
+  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
+  op->env = GNUNET_MQ_msg_extra (msg, sizeof (struct GNUNET_RECLAIM_Ticket),
+                                 GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET);
   msg->id = htonl (rid);
   msg->identity = *identity;
-  GNUNET_memcpy (&msg[1],
-                 ticket,
-                 sizeof (struct GNUNET_RECLAIM_Ticket));
+  GNUNET_memcpy (&msg[1], ticket, sizeof (struct GNUNET_RECLAIM_Ticket));
   if (NULL != h->mq) {
-    GNUNET_MQ_send (h->mq,
-                    op->env);
+    GNUNET_MQ_send (h->mq, op->env);
     op->env = NULL;
   }
   return op;
 }
 
 
-
 /* end of reclaim_api.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]