gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: NEWS: Refactoring components under src/


From: gnunet
Subject: [gnunet] branch master updated: NEWS: Refactoring components under src/ into lib/, plugin/, cli/ and service/
Date: Wed, 18 Oct 2023 13:39:27 +0200

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

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

The following commit(s) were added to refs/heads/master by this push:
     new 9ef4abad6 NEWS: Refactoring components under src/ into lib/, plugin/, 
cli/ and service/
9ef4abad6 is described below

commit 9ef4abad615bea12d13be542b8ae5fbeb2dfee32
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Wed Oct 18 13:37:38 2023 +0200

    NEWS: Refactoring components under src/ into lib/, plugin/, cli/ and 
service/
    
    This also includes a necessary API refactoring of crypto from IDENTITY
    to UTIL.
---
 configure.ac                                       |  18 +-
 po/POTFILES.in                                     | 192 +++---
 src/Makefile.am                                    |   8 +-
 src/abd/Makefile.am                                |  10 +-
 src/abd/abd.h                                      |  20 +-
 src/abd/abd_api.c                                  |   8 +-
 src/abd/abd_serialization.c                        |   8 +-
 src/abd/delegate_misc.c                            |  28 +-
 src/abd/gnunet-abd.c                               |  38 +-
 src/abd/gnunet-service-abd.c                       |  58 +-
 src/abd/plugin_gnsrecord_abd.c                     |   4 +-
 src/arm/Makefile.am                                |  14 +-
 src/auction/Makefile.am                            |  10 +-
 src/cadet/Makefile.am                              |  12 +-
 src/cli/Makefile.am                                |   2 +
 src/cli/util/.gitignore                            |  10 +
 src/cli/util/Makefile.am                           | 108 ++++
 src/{ => cli}/util/crypto-test-vectors.json        |   0
 src/{ => cli}/util/gnunet-base32.c                 |   0
 src/{ => cli}/util/gnunet-config-diff.c            |   0
 src/{ => cli}/util/gnunet-config.c                 |   0
 src/{ => cli}/util/gnunet-crypto-tvg.c             |   0
 src/{ => cli}/util/gnunet-ecc.c                    |   0
 src/{ => cli}/util/gnunet-qr.c                     |   0
 src/{ => cli}/util/gnunet-resolver.c               |   0
 src/{ => cli}/util/gnunet-scrypt.c                 |   0
 src/{ => cli}/util/gnunet-timeout.c                |   0
 src/{ => cli}/util/gnunet-uri.c                    |   0
 src/{ => cli}/util/test_crypto_vectors.sh          |   0
 src/consensus/Makefile.am                          |  14 +-
 src/conversation/Makefile.am                       |  42 +-
 src/conversation/conversation_api.c                |   8 +-
 src/conversation/conversation_api_call.c           |   6 +-
 src/conversation/gnunet-conversation.c             |   6 +-
 src/conversation/gnunet-service-conversation.c     |  30 +-
 src/conversation/test_conversation_api.c           |  12 +-
 src/conversation/test_conversation_api_reject.c    |  12 +-
 src/conversation/test_conversation_api_twocalls.c  |  12 +-
 src/core/Makefile.am                               |  16 +-
 src/curl/Makefile.am                               |   4 +-
 src/datacache/Makefile.am                          |  22 +-
 src/datastore/Makefile.am                          |  44 +-
 src/dht/Makefile.am                                |  30 +-
 src/dhtu/Makefile.am                               |  10 +-
 src/dns/Makefile.am                                |  16 +-
 src/exit/Makefile.am                               |   2 +-
 src/fs/Makefile.am                                 |  92 +--
 src/fs/gnunet-publish.c                            |   8 +-
 src/gns/Makefile.am                                |  48 +-
 src/gns/gns_api.c                                  |   8 +-
 src/gns/gns_tld_api.c                              |  14 +-
 src/gns/gnunet-bcd.c                               |   4 +-
 src/gns/gnunet-gns-import.c                        |   2 +-
 src/gns/gnunet-service-gns.c                       |  10 +-
 src/gns/gnunet-service-gns.h                       |   2 +-
 src/gns/gnunet-service-gns_interceptor.c           |   2 +-
 src/gns/gnunet-service-gns_resolver.c              |  16 +-
 src/gns/gnunet-service-gns_resolver.h              |   2 +-
 src/gns/plugin_gnsrecord_gns.c                     |  10 +-
 src/hello/gnunet-hello.c                           | 427 -------------
 src/hostlist/Makefile.am                           |  10 +-
 src/identity/Makefile.am                           |  10 +-
 src/identity/gnunet-identity.c                     |  38 +-
 src/identity/gnunet-service-identity.c             |  16 +-
 src/identity/identity.h                            |   4 +-
 src/identity/identity_api.c                        | 664 ++-------------------
 src/identity/identity_api_lookup.c                 |   4 +-
 src/identity/identity_api_suffix_lookup.c          |   4 +-
 src/identity/plugin_rest_identity.c                |  22 +-
 src/identity/test_identity.c                       |  18 +-
 src/include/gnunet_abd_service.h                   |  28 +-
 src/include/gnunet_conversation_service.h          |   2 +-
 src/include/gnunet_crypto_lib.h                    | 566 ++++++++++++++++++
 src/include/gnunet_gns_service.h                   |   4 +-
 src/include/gnunet_gnsrecord_lib.h                 |  28 +-
 src/include/gnunet_identity_service.h              | 575 +-----------------
 src/include/gnunet_messenger_service.h             |  12 +-
 src/include/gnunet_namestore_plugin.h              |  14 +-
 src/include/gnunet_namestore_service.h             |  28 +-
 src/include/gnunet_reclaim_service.h               |  32 +-
 src/include/gnunet_revocation_service.h            |   6 +-
 src/json/Makefile.am                               |   6 +-
 src/lib/Makefile.am                                |   5 +
 src/lib/block/Makefile.am                          |  31 +
 src/{ => lib}/block/bg_bf.c                        |   0
 src/{ => lib}/block/block.c                        |   0
 src/{ => lib}/block/meson.build                    |   0
 src/{ => lib}/gnsrecord/.gitignore                 |   0
 src/{ => lib}/gnsrecord/Makefile.am                |  35 +-
 src/{ => lib}/gnsrecord/gnsrecord.c                |   0
 src/{ => lib}/gnsrecord/gnsrecord_crypto.c         |  44 +-
 src/{ => lib}/gnsrecord/gnsrecord_crypto.h         |   0
 src/{ => lib}/gnsrecord/gnsrecord_misc.c           |  22 +-
 src/{ => lib}/gnsrecord/gnsrecord_serialization.c  |   0
 src/{ => lib}/gnsrecord/gnunet-gnsrecord-tvg.c     |  40 +-
 src/{ => lib}/gnsrecord/json_gnsrecord.c           |   0
 src/{ => lib}/gnsrecord/meson.build                |   0
 src/{ => lib}/gnsrecord/perf_gnsrecord_crypto.c    |   2 +-
 .../gnsrecord/test_gnsrecord_block_expiration.c    |   0
 src/{ => lib}/gnsrecord/test_gnsrecord_crypto.c    |  10 +-
 .../gnsrecord/test_gnsrecord_serialization.c       |   0
 .../gnsrecord/test_gnsrecord_testvectors.c         |  16 +-
 src/{ => lib}/hello/.gitignore                     |   0
 src/{ => lib}/hello/Makefile.am                    |  22 +-
 src/{ => lib}/hello/address.c                      |   0
 src/{ => lib}/hello/hello-ng.c                     |   0
 src/{ => lib}/hello/hello-uri.c                    |   0
 src/{ => lib}/hello/hello.c                        |   0
 src/{ => lib}/hello/meson.build                    |   0
 src/{ => lib}/hello/test_friend_hello.c            |   0
 src/{ => lib}/hello/test_hello-ng.c                |   0
 src/{ => lib}/hello/test_hello-uri.c               |   0
 src/{ => lib}/hello/test_hello.c                   |   0
 src/{ => lib}/util/.gitignore                      |  12 -
 src/{ => lib}/util/Makefile.am                     | 109 +---
 src/{ => lib}/util/bandwidth.c                     |   0
 src/{ => lib}/util/benchmark.c                     |   0
 src/{ => lib}/util/benchmark.h                     |   0
 src/{ => lib}/util/bio.c                           |   0
 src/{ => lib}/util/buffer.c                        |   0
 src/{ => lib}/util/child_management.c              |   0
 src/{ => lib}/util/child_management_test.sh        |   0
 src/{ => lib}/util/client.c                        |   0
 src/{ => lib}/util/common_allocation.c             |   0
 src/{ => lib}/util/common_endian.c                 |   0
 src/{ => lib}/util/common_logging.c                |   0
 src/{ => lib}/util/compress.c                      |   0
 src/{ => lib}/util/configuration.c                 |   0
 src/{ => lib}/util/configuration_helper.c          |   0
 src/{ => lib}/util/consttime_memcmp.c              |   0
 src/{ => lib}/util/container_bloomfilter.c         |   0
 src/{ => lib}/util/container_heap.c                |   0
 src/{ => lib}/util/container_multihashmap.c        |   0
 src/{ => lib}/util/container_multihashmap32.c      |   0
 src/{ => lib}/util/container_multipeermap.c        |   0
 src/{ => lib}/util/container_multishortmap.c       |   0
 src/{ => lib}/util/container_multiuuidmap.c        |   0
 src/{ => lib}/util/crypto_crc.c                    |   0
 src/{ => lib}/util/crypto_cs.c                     |   0
 src/{ => lib}/util/crypto_ecc.c                    |   0
 src/{ => lib}/util/crypto_ecc_dlog.c               |   0
 src/{ => lib}/util/crypto_ecc_gnsrecord.c          |   0
 src/{ => lib}/util/crypto_ecc_setup.c              |   0
 src/{ => lib}/util/crypto_edx25519.c               |   0
 src/{ => lib}/util/crypto_hash.c                   |   0
 src/{ => lib}/util/crypto_hash_file.c              |   0
 src/{ => lib}/util/crypto_hkdf.c                   |   0
 src/{ => lib}/util/crypto_kdf.c                    |   0
 src/{ => lib}/util/crypto_mpi.c                    |   0
 src/{ => lib}/util/crypto_paillier.c               |   0
 src/lib/util/crypto_pkey.c                         | 618 +++++++++++++++++++
 src/{ => lib}/util/crypto_pow.c                    |   0
 src/{ => lib}/util/crypto_random.c                 |   0
 src/{ => lib}/util/crypto_rsa.c                    |   0
 src/{ => lib}/util/crypto_symmetric.c              |   0
 src/{ => lib}/util/disk.c                          |   0
 src/{ => lib}/util/disk.h                          |   0
 src/{ => lib}/util/dnsparser.c                     |   0
 src/{ => lib}/util/dnsstub.c                       |   0
 src/{ => lib}/util/getopt.c                        |   0
 src/{ => lib}/util/getopt_helpers.c                |   0
 src/{ => lib}/util/gnunet_error_codes.c            |   0
 src/{ => lib}/util/helper.c                        |   0
 src/{ => lib}/util/load.c                          |   0
 src/{ => lib}/util/meson.build                     |   0
 src/{ => lib}/util/mq.c                            |   0
 src/{ => lib}/util/mst.c                           |   0
 src/{ => lib}/util/nc.c                            |   0
 src/{ => lib}/util/network.c                       |   0
 src/{ => lib}/util/nt.c                            |   0
 src/{ => lib}/util/op.c                            |   0
 src/{ => lib}/util/os_installation.c               |   0
 src/{ => lib}/util/os_network.c                    |   0
 src/{ => lib}/util/os_priority.c                   |   0
 src/{ => lib}/util/peer.c                          |   0
 src/{ => lib}/util/perf_crypto_asymmetric.c        |   0
 src/{ => lib}/util/perf_crypto_cs.c                |   0
 src/{ => lib}/util/perf_crypto_ecc_dlog.c          |   0
 src/{ => lib}/util/perf_crypto_hash.c              |   0
 src/{ => lib}/util/perf_crypto_paillier.c          |   0
 src/{ => lib}/util/perf_crypto_rsa.c               |   0
 src/{ => lib}/util/perf_crypto_symmetric.c         |   0
 src/{ => lib}/util/perf_malloc.c                   |   0
 src/{ => lib}/util/perf_mq.c                       |   0
 src/{ => lib}/util/perf_scheduler.c                |   0
 src/{ => lib}/util/plugin.c                        |   0
 src/{ => lib}/util/proc_compat.c                   |   0
 src/{ => lib}/util/program.c                       |   0
 src/{ => lib}/util/regex.c                         |   0
 .../resolver.conf.in => lib/util/resolver.conf}    |   4 +-
 src/{ => lib}/util/resolver.conf.in                |   0
 src/{ => lib}/util/resolver.h                      |   0
 src/{ => lib}/util/resolver_api.c                  |   0
 src/{ => lib}/util/scheduler.c                     |   0
 src/{ => lib}/util/service.c                       |   0
 src/{ => lib}/util/signal.c                        |   0
 src/{ => lib}/util/socks.c                         |   0
 src/{ => lib}/util/speedup.c                       |   0
 src/{ => lib}/util/speedup.h                       |   0
 src/{ => lib}/util/strings.c                       |   0
 src/{ => lib}/util/test_bio.c                      |   0
 src/{ => lib}/util/test_child_management.c         |   0
 src/{ => lib}/util/test_client.c                   |   0
 src/{ => lib}/util/test_client_data.conf           |   0
 src/{ => lib}/util/test_client_unix.conf           |   0
 src/{ => lib}/util/test_common_allocation.c        |   0
 src/{ => lib}/util/test_common_endian.c            |   0
 src/{ => lib}/util/test_common_logging.c           |   0
 src/{ => lib}/util/test_common_logging_dummy.c     |   0
 .../util/test_common_logging_runtime_loglevels.c   |   0
 src/{ => lib}/util/test_configuration.c            |   0
 src/{ => lib}/util/test_configuration_data.conf    |   0
 src/{ => lib}/util/test_container_bloomfilter.c    |   0
 src/{ => lib}/util/test_container_dll.c            |   0
 src/{ => lib}/util/test_container_heap.c           |   0
 src/{ => lib}/util/test_container_multihashmap.c   |   0
 src/{ => lib}/util/test_container_multihashmap32.c |   0
 src/{ => lib}/util/test_container_multipeermap.c   |   0
 src/{ => lib}/util/test_crypto_crc.c               |   0
 src/{ => lib}/util/test_crypto_cs.c                |   0
 src/{ => lib}/util/test_crypto_ecc_dlog.c          |   0
 src/{ => lib}/util/test_crypto_ecdh_ecdsa.c        |   0
 src/{ => lib}/util/test_crypto_ecdh_eddsa.c        |   0
 src/{ => lib}/util/test_crypto_ecdhe.c             |   0
 src/{ => lib}/util/test_crypto_ecdsa.c             |   0
 src/{ => lib}/util/test_crypto_eddsa.c             |   0
 src/{ => lib}/util/test_crypto_edx25519.c          |   0
 src/{ => lib}/util/test_crypto_hash.c              |   0
 src/{ => lib}/util/test_crypto_hash_context.c      |   0
 src/{ => lib}/util/test_crypto_hkdf.c              |   0
 src/{ => lib}/util/test_crypto_kdf.c               |   0
 src/{ => lib}/util/test_crypto_paillier.c          |   0
 src/{ => lib}/util/test_crypto_random.c            |   0
 src/{ => lib}/util/test_crypto_rsa.c               |   0
 src/{ => lib}/util/test_crypto_symmetric.c         |   0
 src/{ => lib}/util/test_disk.c                     |   0
 src/{ => lib}/util/test_getopt.c                   |   0
 src/{ => lib}/util/test_hexcoder.c                 |   0
 src/{ => lib}/util/test_mq.c                       |   0
 src/{ => lib}/util/test_os_network.c               |   0
 src/{ => lib}/util/test_os_start_process.c         |   0
 src/{ => lib}/util/test_peer.c                     |   0
 src/{ => lib}/util/test_plugin.c                   |   0
 src/{ => lib}/util/test_plugin_plug.c              |   0
 src/{ => lib}/util/test_program.c                  |   0
 src/{ => lib}/util/test_program_data.conf          |   0
 src/{ => lib}/util/test_regex.c                    |   0
 src/{ => lib}/util/test_scheduler.c                |   0
 src/{ => lib}/util/test_scheduler_delay.c          |   0
 src/{ => lib}/util/test_scheduler_hogging_cancel.c |   0
 .../util/test_scheduler_hogging_priority.c         |   0
 src/{ => lib}/util/test_service.c                  |   0
 src/{ => lib}/util/test_service_data.conf          |   0
 src/{ => lib}/util/test_socks.c                    |   0
 src/{ => lib}/util/test_speedup.c                  |   0
 src/{ => lib}/util/test_speedup_data.conf          |   0
 src/{ => lib}/util/test_strings.c                  |   0
 src/{ => lib}/util/test_strings_to_data.c          |   0
 src/{ => lib}/util/test_time.c                     |   0
 src/{ => lib}/util/test_tun.c                      |   0
 src/{ => lib}/util/test_uri.c                      |   0
 src/{ => lib}/util/time.c                          |   0
 src/{ => lib}/util/tun.c                           |   0
 src/{ => lib}/util/uri.c                           |   0
 src/{ => lib}/util/util.conf                       |   0
 src/{ => lib}/util/util.supp                       |   0
 src/messenger/Makefile.am                          |  12 +-
 src/messenger/gnunet-service-messenger.c           |   8 +-
 src/messenger/gnunet-service-messenger_ego_store.c |   8 +-
 src/messenger/gnunet-service-messenger_ego_store.h |   2 +-
 src/messenger/gnunet-service-messenger_handle.c    |   6 +-
 src/messenger/gnunet-service-messenger_member.c    |   8 +-
 src/messenger/gnunet-service-messenger_member.h    |   2 +-
 .../gnunet-service-messenger_member_session.c      |  16 +-
 .../gnunet-service-messenger_member_session.h      |   6 +-
 .../gnunet-service-messenger_member_store.h        |   2 +-
 .../gnunet-service-messenger_message_kind.c        |   4 +-
 .../gnunet-service-messenger_message_kind.h        |   2 +-
 .../gnunet-service-messenger_message_recv.c        |   2 +-
 src/messenger/gnunet-service-messenger_room.c      |   8 +-
 src/messenger/gnunet-service-messenger_room.h      |   2 +-
 src/messenger/messenger_api.c                      |  24 +-
 src/messenger/messenger_api_contact.c              |   4 +-
 src/messenger/messenger_api_contact.h              |   6 +-
 src/messenger/messenger_api_contact_store.c        |  12 +-
 src/messenger/messenger_api_contact_store.h        |   4 +-
 src/messenger/messenger_api_ego.h                  |   4 +-
 src/messenger/messenger_api_handle.c               |   6 +-
 src/messenger/messenger_api_handle.h               |   6 +-
 src/messenger/messenger_api_message.c              |  40 +-
 src/messenger/messenger_api_message.h              |   6 +-
 src/messenger/messenger_api_util.c                 |   4 +-
 src/messenger/messenger_api_util.h                 |   2 +-
 src/messenger/test_messenger.c                     |   2 +-
 src/messenger/test_messenger_anonymous.c           |   2 +-
 src/namecache/Makefile.am                          |  34 +-
 src/namecache/gnunet-namecache.c                   |   4 +-
 src/namecache/test_namecache_api_cache_block.c     |   6 +-
 src/namestore/Makefile.am                          | 164 ++---
 src/namestore/gnunet-namestore-fcfsd.c             |  12 +-
 src/namestore/gnunet-namestore-zonefile.c          |   6 +-
 src/namestore/gnunet-namestore.c                   |  52 +-
 src/namestore/gnunet-service-namestore.c           |  66 +-
 src/namestore/gnunet-zoneimport.c                  |   4 +-
 src/namestore/namestore_api.c                      |  58 +-
 src/namestore/namestore_api_monitor.c              |  16 +-
 src/namestore/perf_namestore_api_import.c          |   2 +-
 src/namestore/perf_namestore_api_zone_iteration.c  |   4 +-
 src/namestore/plugin_namestore_flat.c              |  30 +-
 src/namestore/plugin_namestore_postgres.c          |  20 +-
 src/namestore/plugin_namestore_sqlite.c            |  16 +-
 src/namestore/plugin_rest_namestore.c              |  14 +-
 src/namestore/test_namestore_api_edit_records.c    |  12 +-
 src/namestore/test_namestore_api_lookup_nick.c     |   8 +-
 src/namestore/test_namestore_api_monitoring.c      |   6 +-
 .../test_namestore_api_monitoring_existing.c       |   6 +-
 src/namestore/test_namestore_api_remove.c          |   6 +-
 ...test_namestore_api_remove_not_existing_record.c |   6 +-
 src/namestore/test_namestore_api_store.c           |   6 +-
 src/namestore/test_namestore_api_store_update.c    |   8 +-
 src/namestore/test_namestore_api_tx_rollback.c     |   8 +-
 src/namestore/test_namestore_api_zone_iteration.c  |   8 +-
 .../test_namestore_api_zone_iteration_nick.c       |   8 +-
 ...st_namestore_api_zone_iteration_specific_zone.c |   8 +-
 .../test_namestore_api_zone_iteration_stop.c       |   8 +-
 src/namestore/test_namestore_api_zone_to_name.c    |  10 +-
 src/namestore/test_plugin_namestore.c              |   6 +-
 src/nat-auto/Makefile.am                           |   8 +-
 src/nat/Makefile.am                                |  14 +-
 src/nse/Makefile.am                                |  14 +-
 src/peerstore/Makefile.am                          |  28 +-
 src/plugin/Makefile.am                             |   3 +
 src/{ => plugin}/block/Makefile.am                 |  34 +-
 src/{ => plugin}/block/plugin_block_template.c     |   0
 src/{ => plugin}/block/plugin_block_test.c         |   0
 src/plugin/gnsrecord/Makefile.am                   |  25 +
 src/{ => plugin}/gnsrecord/plugin_gnsrecord_dns.c  |   0
 src/pq/Makefile.am                                 |   4 +-
 src/pt/Makefile.am                                 |  14 +-
 src/pt/test_gns_vpn.c                              |   2 +-
 src/reclaim/Makefile.am                            |  40 +-
 src/reclaim/did.h                                  |   2 +-
 src/reclaim/did_core.c                             |  10 +-
 src/reclaim/did_helper.c                           |  18 +-
 src/reclaim/did_helper.h                           |  10 +-
 src/reclaim/did_misc.c                             |   8 +-
 src/reclaim/gnunet-did.c                           |   6 +-
 src/reclaim/gnunet-reclaim.c                       |  14 +-
 src/reclaim/gnunet-service-reclaim.c               |  86 +--
 src/reclaim/gnunet-service-reclaim_tickets.c       |  46 +-
 src/reclaim/gnunet-service-reclaim_tickets.h       |  12 +-
 src/reclaim/oidc_helper.c                          |  42 +-
 src/reclaim/oidc_helper.h                          |  14 +-
 src/reclaim/plugin_rest_openid_connect.c           |  50 +-
 src/reclaim/plugin_rest_reclaim.c                  |  44 +-
 src/reclaim/reclaim_api.c                          |  94 +--
 src/reclaim/test_did_helper.c                      |  10 +-
 src/regex/Makefile.am                              |  32 +-
 src/rest/Makefile.am                               |   8 +-
 src/revocation/Makefile.am                         |  18 +-
 src/revocation/gnunet-revocation-tvg.c             |  16 +-
 src/revocation/gnunet-revocation.c                 |  10 +-
 src/revocation/gnunet-service-revocation.c         |  16 +-
 src/revocation/plugin_block_revocation.c           |   8 +-
 src/revocation/revocation_api.c                    |  68 +--
 src/revocation/test_revocation.c                   |  12 +-
 src/revocation/test_revocation_testvectors.c       |  12 +-
 src/rps/Makefile.am                                |  16 +-
 src/scalarproduct/Makefile.am                      |  14 +-
 src/secretsharing/Makefile.am                      |   8 +-
 src/service/Makefile.am                            |   2 +
 src/service/util/.gitignore                        |   2 +
 src/service/util/Makefile.am                       |  47 ++
 src/{ => service}/util/gnunet-service-resolver.c   |   2 +-
 src/{ => service}/util/test_resolver_api.c         |   0
 src/{ => service}/util/test_resolver_api_data.conf |   0
 src/set/Makefile.am                                |  24 +-
 src/seti/Makefile.am                               |  16 +-
 src/setu/Makefile.am                               |  20 +-
 src/sq/Makefile.am                                 |   4 +-
 src/statistics/Makefile.am                         |  14 +-
 src/template/Makefile.am                           |   6 +-
 src/testing/Makefile.am                            |  22 +-
 src/topology/Makefile.am                           |   6 +-
 src/transport/Makefile.am                          |  76 +--
 src/vpn/Makefile.am                                |   8 +-
 src/zonemaster/Makefile.am                         |   4 +-
 src/zonemaster/gnunet-service-zonemaster.c         |  10 +-
 388 files changed, 3101 insertions(+), 3424 deletions(-)

diff --git a/configure.ac b/configure.ac
index 69b2e4694..da5b39712 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1231,7 +1231,11 @@ src/Makefile
 src/arm/Makefile
 src/arm/arm.conf
 src/auction/Makefile
-src/block/Makefile
+src/lib/block/Makefile
+src/lib/gnsrecord/Makefile
+src/plugin/Makefile
+src/plugin/block/Makefile
+src/plugin/gnsrecord/Makefile
 src/cadet/Makefile
 src/cadet/cadet.conf
 src/core/Makefile
@@ -1255,8 +1259,7 @@ src/fs/fs.conf
 src/gns/Makefile
 src/gns/gns.conf
 src/gns/nss/Makefile
-src/gnsrecord/Makefile
-src/hello/Makefile
+src/lib/hello/Makefile
 src/identity/Makefile
 src/identity/identity.conf
 src/include/Makefile
@@ -1301,8 +1304,13 @@ src/testing/Makefile
 src/topology/Makefile
 src/transport/Makefile
 src/transport/transport.conf
-src/util/Makefile
-src/util/resolver.conf
+src/lib/Makefile
+src/lib/util/Makefile
+src/lib/util/resolver.conf
+src/service/Makefile
+src/service/util/Makefile
+src/cli/Makefile
+src/cli/util/Makefile
 src/vpn/Makefile
 src/vpn/vpn.conf
 src/zonemaster/Makefile
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 6edabad11..7ae248c18 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -13,10 +13,6 @@ src/auction/gnunet-auction-create.c
 src/auction/gnunet-auction-info.c
 src/auction/gnunet-auction-join.c
 src/auction/gnunet-service-auction.c
-src/block/bg_bf.c
-src/block/block.c
-src/block/plugin_block_template.c
-src/block/plugin_block_test.c
 src/cadet/cadet_api.c
 src/cadet/cadet_api_drop_message.c
 src/cadet/cadet_api_get_channel.c
@@ -36,6 +32,16 @@ src/cadet/gnunet-service-cadet_hello.c
 src/cadet/gnunet-service-cadet_paths.c
 src/cadet/gnunet-service-cadet_peer.c
 src/cadet/gnunet-service-cadet_tunnels.c
+src/cli/util/gnunet-base32.c
+src/cli/util/gnunet-config-diff.c
+src/cli/util/gnunet-config.c
+src/cli/util/gnunet-crypto-tvg.c
+src/cli/util/gnunet-ecc.c
+src/cli/util/gnunet-qr.c
+src/cli/util/gnunet-resolver.c
+src/cli/util/gnunet-scrypt.c
+src/cli/util/gnunet-timeout.c
+src/cli/util/gnunet-uri.c
 src/consensus/consensus_api.c
 src/consensus/gnunet-service-consensus.c
 src/consensus/plugin_block_consensus.c
@@ -156,18 +162,6 @@ src/gns/nss/nss_gns_query.c
 src/gns/plugin_block_gns.c
 src/gns/plugin_gnsrecord_gns.c
 src/gns/plugin_rest_gns.c
-src/gnsrecord/gnsrecord.c
-src/gnsrecord/gnsrecord_crypto.c
-src/gnsrecord/gnsrecord_misc.c
-src/gnsrecord/gnsrecord_serialization.c
-src/gnsrecord/gnunet-gnsrecord-tvg.c
-src/gnsrecord/json_gnsrecord.c
-src/gnsrecord/plugin_gnsrecord_dns.c
-src/hello/address.c
-src/hello/gnunet-hello.c
-src/hello/hello-ng.c
-src/hello/hello-uri.c
-src/hello/hello.c
 src/hostlist/gnunet-daemon-hostlist.c
 src/hostlist/gnunet-daemon-hostlist_client.c
 src/hostlist/gnunet-daemon-hostlist_server.c
@@ -182,6 +176,88 @@ src/json/json_generator.c
 src/json/json_helper.c
 src/json/json_mhd.c
 src/json/json_pack.c
+src/lib/block/bg_bf.c
+src/lib/block/block.c
+src/lib/gnsrecord/gnsrecord.c
+src/lib/gnsrecord/gnsrecord_crypto.c
+src/lib/gnsrecord/gnsrecord_misc.c
+src/lib/gnsrecord/gnsrecord_serialization.c
+src/lib/gnsrecord/gnunet-gnsrecord-tvg.c
+src/lib/gnsrecord/json_gnsrecord.c
+src/lib/hello/address.c
+src/lib/hello/hello-ng.c
+src/lib/hello/hello-uri.c
+src/lib/hello/hello.c
+src/lib/util/bandwidth.c
+src/lib/util/benchmark.c
+src/lib/util/bio.c
+src/lib/util/buffer.c
+src/lib/util/child_management.c
+src/lib/util/client.c
+src/lib/util/common_allocation.c
+src/lib/util/common_endian.c
+src/lib/util/common_logging.c
+src/lib/util/compress.c
+src/lib/util/configuration.c
+src/lib/util/configuration_helper.c
+src/lib/util/consttime_memcmp.c
+src/lib/util/container_bloomfilter.c
+src/lib/util/container_heap.c
+src/lib/util/container_multihashmap.c
+src/lib/util/container_multihashmap32.c
+src/lib/util/container_multipeermap.c
+src/lib/util/container_multishortmap.c
+src/lib/util/container_multiuuidmap.c
+src/lib/util/crypto_crc.c
+src/lib/util/crypto_cs.c
+src/lib/util/crypto_ecc.c
+src/lib/util/crypto_ecc_dlog.c
+src/lib/util/crypto_ecc_gnsrecord.c
+src/lib/util/crypto_ecc_setup.c
+src/lib/util/crypto_edx25519.c
+src/lib/util/crypto_hash.c
+src/lib/util/crypto_hash_file.c
+src/lib/util/crypto_hkdf.c
+src/lib/util/crypto_kdf.c
+src/lib/util/crypto_mpi.c
+src/lib/util/crypto_paillier.c
+src/lib/util/crypto_pkey.c
+src/lib/util/crypto_pow.c
+src/lib/util/crypto_random.c
+src/lib/util/crypto_rsa.c
+src/lib/util/crypto_symmetric.c
+src/lib/util/disk.c
+src/lib/util/dnsparser.c
+src/lib/util/dnsstub.c
+src/lib/util/getopt.c
+src/lib/util/getopt_helpers.c
+src/lib/util/gnunet_error_codes.c
+src/lib/util/helper.c
+src/lib/util/load.c
+src/lib/util/mq.c
+src/lib/util/mst.c
+src/lib/util/nc.c
+src/lib/util/network.c
+src/lib/util/nt.c
+src/lib/util/op.c
+src/lib/util/os_installation.c
+src/lib/util/os_network.c
+src/lib/util/os_priority.c
+src/lib/util/peer.c
+src/lib/util/plugin.c
+src/lib/util/proc_compat.c
+src/lib/util/program.c
+src/lib/util/regex.c
+src/lib/util/resolver_api.c
+src/lib/util/scheduler.c
+src/lib/util/service.c
+src/lib/util/signal.c
+src/lib/util/socks.c
+src/lib/util/speedup.c
+src/lib/util/strings.c
+src/lib/util/time.c
+src/lib/util/tun.c
+src/lib/util/uri.c
 src/messenger/gnunet-messenger.c
 src/messenger/gnunet-service-messenger.c
 src/messenger/gnunet-service-messenger_basement.c
@@ -259,6 +335,9 @@ src/peerstore/peerstore_api.c
 src/peerstore/peerstore_common.c
 src/peerstore/plugin_peerstore_flat.c
 src/peerstore/plugin_peerstore_sqlite.c
+src/plugin/block/plugin_block_template.c
+src/plugin/block/plugin_block_test.c
+src/plugin/gnsrecord/plugin_gnsrecord_dns.c
 src/pq/pq.c
 src/pq/pq_connect.c
 src/pq/pq_eval.c
@@ -332,6 +411,7 @@ src/secretsharing/gnunet-secretsharing-profiler.c
 src/secretsharing/gnunet-service-secretsharing.c
 src/secretsharing/secretsharing_api.c
 src/secretsharing/secretsharing_common.c
+src/service/util/gnunet-service-resolver.c
 src/set/gnunet-service-set.c
 src/set/gnunet-service-set_intersection.c
 src/set/gnunet-service-set_union.c
@@ -410,86 +490,6 @@ src/transport/transport_api_cmd_send_simple_performance.c
 src/transport/transport_api_cmd_start_peer.c
 src/transport/transport_api_cmd_stop_peer.c
 src/transport/transport_api_traits.c
-src/util/bandwidth.c
-src/util/benchmark.c
-src/util/bio.c
-src/util/buffer.c
-src/util/child_management.c
-src/util/client.c
-src/util/common_allocation.c
-src/util/common_endian.c
-src/util/common_logging.c
-src/util/compress.c
-src/util/configuration.c
-src/util/configuration_helper.c
-src/util/consttime_memcmp.c
-src/util/container_bloomfilter.c
-src/util/container_heap.c
-src/util/container_multihashmap.c
-src/util/container_multihashmap32.c
-src/util/container_multipeermap.c
-src/util/container_multishortmap.c
-src/util/container_multiuuidmap.c
-src/util/crypto_crc.c
-src/util/crypto_cs.c
-src/util/crypto_ecc.c
-src/util/crypto_ecc_dlog.c
-src/util/crypto_ecc_gnsrecord.c
-src/util/crypto_ecc_setup.c
-src/util/crypto_edx25519.c
-src/util/crypto_hash.c
-src/util/crypto_hash_file.c
-src/util/crypto_hkdf.c
-src/util/crypto_kdf.c
-src/util/crypto_mpi.c
-src/util/crypto_paillier.c
-src/util/crypto_pow.c
-src/util/crypto_random.c
-src/util/crypto_rsa.c
-src/util/crypto_symmetric.c
-src/util/disk.c
-src/util/dnsparser.c
-src/util/dnsstub.c
-src/util/getopt.c
-src/util/getopt_helpers.c
-src/util/gnunet-base32.c
-src/util/gnunet-config-diff.c
-src/util/gnunet-config.c
-src/util/gnunet-crypto-tvg.c
-src/util/gnunet-ecc.c
-src/util/gnunet-qr.c
-src/util/gnunet-resolver.c
-src/util/gnunet-scrypt.c
-src/util/gnunet-service-resolver.c
-src/util/gnunet-timeout.c
-src/util/gnunet-uri.c
-src/util/gnunet_error_codes.c
-src/util/helper.c
-src/util/load.c
-src/util/mq.c
-src/util/mst.c
-src/util/nc.c
-src/util/network.c
-src/util/nt.c
-src/util/op.c
-src/util/os_installation.c
-src/util/os_network.c
-src/util/os_priority.c
-src/util/peer.c
-src/util/plugin.c
-src/util/proc_compat.c
-src/util/program.c
-src/util/regex.c
-src/util/resolver_api.c
-src/util/scheduler.c
-src/util/service.c
-src/util/signal.c
-src/util/socks.c
-src/util/speedup.c
-src/util/strings.c
-src/util/time.c
-src/util/tun.c
-src/util/uri.c
 src/vpn/gnunet-helper-vpn.c
 src/vpn/gnunet-service-vpn.c
 src/vpn/gnunet-vpn.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 2112bfca8..3746c6b19 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -33,9 +33,10 @@ REST_DIR = rest
 
 SUBDIRS = \
   include $(INTLEMU_SUBDIRS) \
-  util \
-  hello \
-  block \
+  lib \
+       plugin \
+       service \
+       cli \
   statistics \
   arm \
   $(TESTING) \
@@ -60,7 +61,6 @@ SUBDIRS = \
   regex \
   dns \
   identity \
-  gnsrecord \
   namecache \
   namestore \
   cadet \
diff --git a/src/abd/Makefile.am b/src/abd/Makefile.am
index 69809291a..6fa2dc848 100644
--- a/src/abd/Makefile.am
+++ b/src/abd/Makefile.am
@@ -41,8 +41,8 @@ gnunet_abd_SOURCES = \
  gnunet-abd.c
 gnunet_abd_LDADD = \
   libgnunetabd.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-       $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+       $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(top_builddir)/src/namestore/libgnunetnamestore.la \
   $(GN_LIBINTL)
@@ -52,7 +52,7 @@ libgnunet_plugin_gnsrecord_abd_la_SOURCES = \
   plugin_gnsrecord_abd.c
 libgnunet_plugin_gnsrecord_abd_la_LIBADD = \
        libgnunetabd.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(LTLIBINTL)
 libgnunet_plugin_gnsrecord_abd_la_LDFLAGS = \
@@ -64,7 +64,7 @@ gnunet_service_abd_SOURCES = \
  gnunet-service-abd.c
 gnunet_service_abd_LDADD = \
        libgnunetabd.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
        $(top_builddir)/src/gns/libgnunetgns.la \
        $(top_builddir)/src/namestore/libgnunetnamestore.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
@@ -79,7 +79,7 @@ libgnunetabd_la_SOURCES = \
  delegate_misc.c \
  delegate_misc.h
 libgnunetabd_la_LIBADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(top_builddir)/src/identity/libgnunetidentity.la \
  $(XLIB)
 libgnunetabd_la_LDFLAGS = \
diff --git a/src/abd/abd.h b/src/abd/abd.h
index 61210b3f7..26b8e222e 100644
--- a/src/abd/abd.h
+++ b/src/abd/abd.h
@@ -42,12 +42,12 @@ struct CollectMessage
   /**
    * Subject public key
    */
-  struct GNUNET_IDENTITY_PrivateKey subject_key;
+  struct GNUNET_CRYPTO_PrivateKey subject_key;
 
   /**
    * Trust anchor
    */
-  struct GNUNET_IDENTITY_PublicKey issuer_key;
+  struct GNUNET_CRYPTO_PublicKey issuer_key;
 
   /**
    * Length of the issuer attribute
@@ -81,12 +81,12 @@ struct VerifyMessage
   /**
    * Subject public key
    */
-  struct GNUNET_IDENTITY_PublicKey subject_key;
+  struct GNUNET_CRYPTO_PublicKey subject_key;
 
   /**
    * Trust anchor
    */
-  struct GNUNET_IDENTITY_PublicKey issuer_key;
+  struct GNUNET_CRYPTO_PublicKey issuer_key;
 
   /**
    * Number of delegates
@@ -170,7 +170,7 @@ struct DelegationRecordData
   /**
    * Subject key
    */
-  struct GNUNET_IDENTITY_PublicKey subject_key;
+  struct GNUNET_CRYPTO_PublicKey subject_key;
 
   /**
    * Subject attributes
@@ -184,12 +184,12 @@ struct ChainEntry
   /**
    * Issuer key
    */
-  struct GNUNET_IDENTITY_PublicKey issuer_key;
+  struct GNUNET_CRYPTO_PublicKey issuer_key;
 
   /**
    * Subject key
    */
-  struct GNUNET_IDENTITY_PublicKey subject_key;
+  struct GNUNET_CRYPTO_PublicKey subject_key;
 
   /**
    * Issuer attributes
@@ -208,7 +208,7 @@ struct DelegateEntry
   /**
    * The signature for this credential by the issuer
    */
-  struct GNUNET_IDENTITY_Signature signature;
+  struct GNUNET_CRYPTO_Signature signature;
 
   /**
    * Signature meta
@@ -218,12 +218,12 @@ struct DelegateEntry
   /**
    * Public key of the issuer
    */
-  struct GNUNET_IDENTITY_PublicKey issuer_key;
+  struct GNUNET_CRYPTO_PublicKey issuer_key;
 
   /**
    * Public key of the subject this credential was issued to
    */
-  struct GNUNET_IDENTITY_PublicKey subject_key;
+  struct GNUNET_CRYPTO_PublicKey subject_key;
 
   /**
    * Expiration time of this credential
diff --git a/src/abd/abd_api.c b/src/abd/abd_api.c
index 0b3b4f61f..3682f41ba 100644
--- a/src/abd/abd_api.c
+++ b/src/abd/abd_api.c
@@ -422,9 +422,9 @@ GNUNET_ABD_request_cancel (struct GNUNET_ABD_Request *lr)
 struct GNUNET_ABD_Request *
 GNUNET_ABD_collect (
   struct GNUNET_ABD_Handle *handle,
-  const struct GNUNET_IDENTITY_PublicKey *issuer_key,
+  const struct GNUNET_CRYPTO_PublicKey *issuer_key,
   const char *issuer_attribute,
-  const struct GNUNET_IDENTITY_PrivateKey *subject_key,
+  const struct GNUNET_CRYPTO_PrivateKey *subject_key,
   enum GNUNET_ABD_AlgoDirectionFlags direction,
   GNUNET_ABD_CredentialResultProcessor proc,
   void *proc_cls,
@@ -496,9 +496,9 @@ GNUNET_ABD_collect (
 struct GNUNET_ABD_Request *
 GNUNET_ABD_verify (
   struct GNUNET_ABD_Handle *handle,
-  const struct GNUNET_IDENTITY_PublicKey *issuer_key,
+  const struct GNUNET_CRYPTO_PublicKey *issuer_key,
   const char *issuer_attribute,
-  const struct GNUNET_IDENTITY_PublicKey *subject_key,
+  const struct GNUNET_CRYPTO_PublicKey *subject_key,
   uint32_t delegate_count,
   const struct GNUNET_ABD_Delegate *delegates,
   enum GNUNET_ABD_AlgoDirectionFlags direction,
diff --git a/src/abd/abd_serialization.c b/src/abd/abd_serialization.c
index 2ed24ff2f..14960e804 100644
--- a/src/abd/abd_serialization.c
+++ b/src/abd/abd_serialization.c
@@ -199,7 +199,7 @@ GNUNET_ABD_delegates_serialize (
     c_rec.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_DELEGATE);
     c_rec.purpose.size =
       htonl ((sizeof (struct DelegateEntry) + cd[i].issuer_attribute_len)
-             - sizeof (struct GNUNET_IDENTITY_Signature));
+             - sizeof (struct GNUNET_CRYPTO_Signature));
     c_rec.expiration = GNUNET_htonll (cd[i].expiration.abs_value_us);
     if (off + sizeof (c_rec) > dest_size)
       return -1;
@@ -445,12 +445,12 @@ GNUNET_ABD_delegate_serialize (struct GNUNET_ABD_Delegate 
*dele,
   }
   cdata->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_DELEGATE);
   cdata->purpose.size =
-    htonl (size - sizeof (struct GNUNET_IDENTITY_Signature));
+    htonl (size - sizeof (struct GNUNET_CRYPTO_Signature));
 
   GNUNET_memcpy (&cdata[1], tmp_str, attr_len);
 
   if (GNUNET_OK !=
-      GNUNET_IDENTITY_signature_verify_ (GNUNET_SIGNATURE_PURPOSE_DELEGATE,
+      GNUNET_CRYPTO_signature_verify_ (GNUNET_SIGNATURE_PURPOSE_DELEGATE,
                                   &cdata->purpose,
                                   &cdata->signature,
                                   &cdata->issuer_key))
@@ -473,7 +473,7 @@ GNUNET_ABD_delegate_deserialize (const char *data, size_t 
data_size)
     return NULL;
   cdata = (struct DelegateEntry *) data;
   if (GNUNET_OK !=
-      GNUNET_IDENTITY_signature_verify_ (GNUNET_SIGNATURE_PURPOSE_DELEGATE,
+      GNUNET_CRYPTO_signature_verify_ (GNUNET_SIGNATURE_PURPOSE_DELEGATE,
                                   &cdata->purpose,
                                   &cdata->signature,
                                   &cdata->issuer_key))
diff --git a/src/abd/delegate_misc.c b/src/abd/delegate_misc.c
index cc45cde04..446c0b8d2 100644
--- a/src/abd/delegate_misc.c
+++ b/src/abd/delegate_misc.c
@@ -42,10 +42,10 @@ GNUNET_ABD_delegate_to_string (
   char *issuer_pkey;
   char *signature;
 
-  subject_pkey = GNUNET_IDENTITY_public_key_to_string (&cred->subject_key);
-  issuer_pkey = GNUNET_IDENTITY_public_key_to_string (&cred->issuer_key);
+  subject_pkey = GNUNET_CRYPTO_public_key_to_string (&cred->subject_key);
+  issuer_pkey = GNUNET_CRYPTO_public_key_to_string (&cred->issuer_key);
   GNUNET_STRINGS_base64_encode ((char *) &cred->signature,
-                                sizeof (struct GNUNET_IDENTITY_Signature),
+                                sizeof (struct GNUNET_CRYPTO_Signature),
                                 &signature);
   if (0 == cred->subject_attribute_len)
   {
@@ -80,7 +80,7 @@ struct GNUNET_ABD_Delegate *
 GNUNET_ABD_delegate_from_string (const char *s)
 {
   struct GNUNET_ABD_Delegate *dele;
-  size_t enclen = (sizeof (struct GNUNET_IDENTITY_PublicKey)) * 8;
+  size_t enclen = (sizeof (struct GNUNET_CRYPTO_PublicKey)) * 8;
   if (enclen % 5 > 0)
     enclen += 5 - enclen % 5;
   enclen /= 5; /* 260/5 = 52 */
@@ -91,7 +91,7 @@ GNUNET_ABD_delegate_from_string (const char *s)
   char sub_attr[253 + 1] = "";
   char signature[256]; // TODO max payload size
 
-  struct GNUNET_IDENTITY_Signature *sig;
+  struct GNUNET_CRYPTO_Signature *sig;
   struct GNUNET_TIME_Absolute etime_abs;
 
   // If it's A.a <- B.b...
@@ -144,20 +144,20 @@ GNUNET_ABD_delegate_from_string (const char *s)
   tmp_str[attr_len - 1] = '\0';
 
   if (GNUNET_SYSERR ==
-      GNUNET_IDENTITY_public_key_from_string (subject_pkey,
+      GNUNET_CRYPTO_public_key_from_string (subject_pkey,
                                               &dele->subject_key))
   {
     GNUNET_free (dele);
     return NULL;
   }
   if (GNUNET_SYSERR ==
-      GNUNET_IDENTITY_public_key_from_string (issuer_pkey,
+      GNUNET_CRYPTO_public_key_from_string (issuer_pkey,
                                               &dele->issuer_key))
   {
     GNUNET_free (dele);
     return NULL;
   }
-  GNUNET_assert (sizeof (struct GNUNET_IDENTITY_Signature) ==
+  GNUNET_assert (sizeof (struct GNUNET_CRYPTO_Signature) ==
                  GNUNET_STRINGS_base64_decode (signature,
                                                strlen (signature),
                                                (void **) &sig));
@@ -196,8 +196,8 @@ GNUNET_ABD_delegate_from_string (const char *s)
 
 struct GNUNET_ABD_Delegate *
 GNUNET_ABD_delegate_issue (
-  const struct GNUNET_IDENTITY_PrivateKey *issuer,
-  struct GNUNET_IDENTITY_PublicKey *subject,
+  const struct GNUNET_CRYPTO_PrivateKey *issuer,
+  struct GNUNET_CRYPTO_PublicKey *subject,
   const char *iss_attr,
   const char *sub_attr,
   struct GNUNET_TIME_Absolute *expiration)
@@ -232,9 +232,9 @@ GNUNET_ABD_delegate_issue (
 
   del = GNUNET_malloc (size);
   del->purpose.size =
-    htonl (size - sizeof (struct GNUNET_IDENTITY_Signature));
+    htonl (size - sizeof (struct GNUNET_CRYPTO_Signature));
   del->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_DELEGATE);
-  GNUNET_IDENTITY_key_get_public (issuer, &del->issuer_key);
+  GNUNET_CRYPTO_key_get_public (issuer, &del->issuer_key);
   del->subject_key = *subject;
   del->expiration = GNUNET_htonll (expiration->abs_value_us);
   del->issuer_attribute_len = htonl (strlen (iss_attr) + 1);
@@ -249,12 +249,12 @@ GNUNET_ABD_delegate_issue (
 
   GNUNET_memcpy (&del[1], tmp_str, attr_len);
 
-  GNUNET_IDENTITY_sign_ (issuer, &del->purpose, &del->signature);
+  GNUNET_CRYPTO_sign_ (issuer, &del->purpose, &del->signature);
 
   dele = GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) + attr_len);
   dele->signature = del->signature;
   dele->expiration = *expiration;
-  GNUNET_IDENTITY_key_get_public (issuer, &dele->issuer_key);
+  GNUNET_CRYPTO_key_get_public (issuer, &dele->issuer_key);
 
   dele->subject_key = *subject;
 
diff --git a/src/abd/gnunet-abd.c b/src/abd/gnunet-abd.c
index 6f6521d98..1ed1adbe7 100644
--- a/src/abd/gnunet-abd.c
+++ b/src/abd/gnunet-abd.c
@@ -43,7 +43,7 @@ static struct GNUNET_NAMESTORE_Handle *ns;
 /**
  * Private key for the our zone.
  */
-static struct GNUNET_IDENTITY_PrivateKey zone_pkey;
+static struct GNUNET_CRYPTO_PrivateKey zone_pkey;
 
 /**
  * EgoLookup
@@ -98,12 +98,12 @@ static char *expiration;
 /**
  * Subject key
  */
-struct GNUNET_IDENTITY_PublicKey subject_pkey;
+struct GNUNET_CRYPTO_PublicKey subject_pkey;
 
 /**
  * Issuer key
  */
-struct GNUNET_IDENTITY_PublicKey issuer_pkey;
+struct GNUNET_CRYPTO_PublicKey issuer_pkey;
 
 
 /**
@@ -277,9 +277,9 @@ handle_intermediate_result (void *cls,
 
   printf ("%s Intermediate result: %s.%s <- %s.%s\n",
           prefix,
-          GNUNET_IDENTITY_public_key_to_string (&dd->issuer_key),
+          GNUNET_CRYPTO_public_key_to_string (&dd->issuer_key),
           dd->issuer_attribute,
-          GNUNET_IDENTITY_public_key_to_string (&dd->subject_key),
+          GNUNET_CRYPTO_public_key_to_string (&dd->subject_key),
           dd->subject_attribute);
 }
 
@@ -332,8 +332,8 @@ handle_verify_result (void *cls,
     printf ("Delegation Chain:\n");
     for (i = 0; i < d_count; i++)
     {
-      iss_key = GNUNET_IDENTITY_public_key_to_string (&dc[i].issuer_key);
-      sub_key = GNUNET_IDENTITY_public_key_to_string (&dc[i].subject_key);
+      iss_key = GNUNET_CRYPTO_public_key_to_string (&dc[i].issuer_key);
+      sub_key = GNUNET_CRYPTO_public_key_to_string (&dc[i].subject_key);
 
       if (0 != dc[i].subject_attribute_len)
       {
@@ -358,8 +358,8 @@ handle_verify_result (void *cls,
     printf ("\nDelegate(s):\n");
     for (i = 0; i < c_count; i++)
     {
-      iss_key = GNUNET_IDENTITY_public_key_to_string (&dele[i].issuer_key);
-      sub_key = GNUNET_IDENTITY_public_key_to_string (&dele[i].subject_key);
+      iss_key = GNUNET_CRYPTO_public_key_to_string (&dele[i].issuer_key);
+      sub_key = GNUNET_CRYPTO_public_key_to_string (&dele[i].subject_key);
       printf ("%s.%s <- %s\n", iss_key, dele[i].issuer_attribute, sub_key);
       GNUNET_free (iss_key);
       GNUNET_free (sub_key);
@@ -381,7 +381,7 @@ handle_verify_result (void *cls,
 static void
 identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
 {
-  const struct GNUNET_IDENTITY_PrivateKey *privkey;
+  const struct GNUNET_CRYPTO_PrivateKey *privkey;
 
   el = NULL;
   if (NULL == ego)
@@ -400,7 +400,7 @@ identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
   {
 
     if (GNUNET_OK !=
-        GNUNET_IDENTITY_public_key_from_string (issuer_key,
+        GNUNET_CRYPTO_public_key_from_string (issuer_key,
                                                     &issuer_pkey))
     {
       fprintf (stderr,
@@ -501,7 +501,7 @@ add_continuation (void *cls, int32_t success, const char 
*emsg)
 
 static void
 get_existing_record (void *cls,
-                     const struct GNUNET_IDENTITY_PrivateKey *zone_key,
+                     const struct GNUNET_CRYPTO_PrivateKey *zone_key,
                      const char *rec_name,
                      unsigned int rd_count,
                      const struct GNUNET_GNSRECORD_Data *rd)
@@ -545,7 +545,7 @@ store_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
 {
   const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
   struct GNUNET_ABD_Delegate *cred;
-  struct GNUNET_IDENTITY_PublicKey zone_pubkey;
+  struct GNUNET_CRYPTO_PublicKey zone_pubkey;
   char *subject_pubkey_str;
   char *zone_pubkey_str;
 
@@ -586,12 +586,12 @@ store_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
 
     // Get import subject public key string
     subject_pubkey_str =
-      GNUNET_IDENTITY_public_key_to_string (&cred->subject_key);
+      GNUNET_CRYPTO_public_key_to_string (&cred->subject_key);
 
     // Get zone public key string
     GNUNET_IDENTITY_ego_get_public_key (ego, &zone_pubkey);
     zone_pubkey_str =
-      GNUNET_IDENTITY_public_key_to_string (&zone_pubkey);
+      GNUNET_CRYPTO_public_key_to_string (&zone_pubkey);
 
     // Check if the subject key in the signed import matches the zone's key it 
is issued to
     if (strcmp (zone_pubkey_str, subject_pubkey_str) != 0)
@@ -668,7 +668,7 @@ store_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
 static void
 sign_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
 {
-  const struct GNUNET_IDENTITY_PrivateKey *privkey;
+  const struct GNUNET_CRYPTO_PrivateKey *privkey;
   struct GNUNET_ABD_Delegate *dele;
   struct GNUNET_TIME_Absolute etime_abs;
   char *res;
@@ -718,7 +718,7 @@ sign_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
     return;
   }
   if (GNUNET_OK !=
-      GNUNET_IDENTITY_public_key_from_string (subject_pubkey_str,
+      GNUNET_CRYPTO_public_key_from_string (subject_pubkey_str,
                                                   &subject_pkey))
   {
     fprintf (stderr,
@@ -883,7 +883,7 @@ run (void *cls,
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
-  if (GNUNET_OK != GNUNET_IDENTITY_public_key_from_string (subject,
+  if (GNUNET_OK != GNUNET_CRYPTO_public_key_from_string (subject,
                                                                &subject_pkey))
   {
     fprintf (stderr,
@@ -902,7 +902,7 @@ run (void *cls,
       return;
     }
     if (GNUNET_OK !=
-        GNUNET_IDENTITY_public_key_from_string (issuer_key,
+        GNUNET_CRYPTO_public_key_from_string (issuer_key,
                                                     &issuer_pkey))
     {
       fprintf (stderr,
diff --git a/src/abd/gnunet-service-abd.c b/src/abd/gnunet-service-abd.c
index 42b26eb9b..5cbc105f6 100644
--- a/src/abd/gnunet-service-abd.c
+++ b/src/abd/gnunet-service-abd.c
@@ -60,12 +60,12 @@ struct DelegationChainEntry
   /**
    * The issuer
    */
-  struct GNUNET_IDENTITY_PublicKey issuer_key;
+  struct GNUNET_CRYPTO_PublicKey issuer_key;
 
   /**
    * The subject
    */
-  struct GNUNET_IDENTITY_PublicKey subject_key;
+  struct GNUNET_CRYPTO_PublicKey subject_key;
 
   /**
    * The issued attribute
@@ -165,7 +165,7 @@ struct DelegationSetQueueEntry
   /**
    * Issuer key
    */
-  struct GNUNET_IDENTITY_PublicKey *issuer_key;
+  struct GNUNET_CRYPTO_PublicKey *issuer_key;
 
   /**
    * Queue entries of this set
@@ -266,7 +266,7 @@ struct VerifyRequestHandle
   /**
    * Issuer public key
    */
-  struct GNUNET_IDENTITY_PublicKey issuer_key;
+  struct GNUNET_CRYPTO_PublicKey issuer_key;
 
   /**
    * Issuer attribute
@@ -276,7 +276,7 @@ struct VerifyRequestHandle
   /**
    * Subject public key
    */
-  struct GNUNET_IDENTITY_PublicKey subject_key;
+  struct GNUNET_CRYPTO_PublicKey subject_key;
 
   /**
    * Delegate DLL
@@ -351,10 +351,10 @@ print_deleset (struct DelegationSetQueueEntry *dsentry, 
char *text)
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "%s %s.%s <- %s.%s\n",
               text,
-              GNUNET_IDENTITY_public_key_to_string (
+              GNUNET_CRYPTO_public_key_to_string (
                 &dsentry->delegation_chain_entry->issuer_key),
               dsentry->delegation_chain_entry->issuer_attribute,
-              GNUNET_IDENTITY_public_key_to_string (
+              GNUNET_CRYPTO_public_key_to_string (
                 &dsentry->delegation_chain_entry->subject_key),
               dsentry->delegation_chain_entry->subject_attribute);
 }
@@ -698,7 +698,7 @@ handle_bidirectional_match (struct DelegationSetQueueEntry 
*actual_entry,
   {
     if (0 != memcmp (&last_entry->delegation_chain_entry->subject_key,
                      &del_entry->delegate->issuer_key,
-                     sizeof (struct GNUNET_IDENTITY_PublicKey)))
+                     sizeof (struct GNUNET_CRYPTO_PublicKey)))
       continue;
     if (0 != strcmp (last_entry->delegation_chain_entry->subject_attribute,
                      del_entry->delegate->issuer_attribute))
@@ -832,10 +832,10 @@ forward_resolution (void *cls,
         {
           GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                       "Entry not relevant, discarding: %s.%s <- %s.%s\n",
-                      GNUNET_IDENTITY_public_key_to_string (
+                      GNUNET_CRYPTO_public_key_to_string (
                         &del->issuer_key),
                       del->issuer_attribute,
-                      GNUNET_IDENTITY_public_key_to_string (
+                      GNUNET_CRYPTO_public_key_to_string (
                         &del->subject_key),
                       del->subject_attribute);
           GNUNET_free (del);
@@ -849,10 +849,10 @@ forward_resolution (void *cls,
 
     // Start: Credential Chain Entry
     // issuer key is subject key, who needs to be contacted to resolve this 
(forward, therefore subject)
-    ds_entry->issuer_key = GNUNET_new (struct GNUNET_IDENTITY_PublicKey);
+    ds_entry->issuer_key = GNUNET_new (struct GNUNET_CRYPTO_PublicKey);
     GNUNET_memcpy (ds_entry->issuer_key,
                    &del->subject_key,
-                   sizeof (struct GNUNET_IDENTITY_PublicKey));
+                   sizeof (struct GNUNET_CRYPTO_PublicKey));
 
     ds_entry->delegation_chain_entry = GNUNET_new (struct 
DelegationChainEntry);
     ds_entry->delegation_chain_entry->subject_key = del->subject_key;
@@ -873,7 +873,7 @@ forward_resolution (void *cls,
     // if: issuer key we looking for
     if (0 == memcmp (&del->issuer_key,
                      &vrh->issuer_key,
-                     sizeof (struct GNUNET_IDENTITY_PublicKey)))
+                     sizeof (struct GNUNET_CRYPTO_PublicKey)))
     {
       // if: issuer attr we looking for
       if (0 == strcmp (del->issuer_attribute, vrh->issuer_attribute))
@@ -904,7 +904,7 @@ forward_resolution (void *cls,
           {
             if (0 == memcmp (&del_entry->delegate->issuer_key,
                              &vrh->delegation_chain_head->subject_key,
-                             sizeof (struct GNUNET_IDENTITY_PublicKey)))
+                             sizeof (struct GNUNET_CRYPTO_PublicKey)))
             {
               if (0 == strcmp (del_entry->delegate->issuer_attribute,
                                vrh->delegation_chain_head->subject_attribute))
@@ -932,7 +932,7 @@ forward_resolution (void *cls,
         // key of list entry matches actual key
         if (0 == memcmp (&del_entry->delegation_chain_entry->subject_key,
                          &ds_entry->delegation_chain_entry->issuer_key,
-                         sizeof (struct GNUNET_IDENTITY_PublicKey)))
+                         sizeof (struct GNUNET_CRYPTO_PublicKey)))
         {
           // compare entry subject attributes to this trailer (iss attr + old 
trailer)
           if (0 == strcmp (del_entry->unresolved_attribute_delegation,
@@ -962,7 +962,7 @@ forward_resolution (void *cls,
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Starting to look up trailer %s in zone %s\n",
                 ds_entry->attr_trailer,
-                GNUNET_IDENTITY_public_key_to_string (&del->issuer_key));
+                GNUNET_CRYPTO_public_key_to_string (&del->issuer_key));
 
     ds_entry->lookup_request =
       GNUNET_GNS_lookup (gns,
@@ -1072,10 +1072,10 @@ backward_resolution (void *cls,
       ds_entry->delegation_chain_entry =
         GNUNET_new (struct DelegationChainEntry);
       ds_entry->delegation_chain_entry->subject_key = set[j].subject_key;
-      ds_entry->issuer_key = GNUNET_new (struct GNUNET_IDENTITY_PublicKey);
+      ds_entry->issuer_key = GNUNET_new (struct GNUNET_CRYPTO_PublicKey);
       GNUNET_memcpy (ds_entry->issuer_key,
                      &set[j].subject_key,
-                     sizeof (struct GNUNET_IDENTITY_PublicKey));
+                     sizeof (struct GNUNET_CRYPTO_PublicKey));
       if (0 < set[j].subject_attribute_len)
         ds_entry->delegation_chain_entry->subject_attribute =
           GNUNET_strdup (set[j].subject_attribute);
@@ -1099,7 +1099,7 @@ backward_resolution (void *cls,
         // If key and attribute match credential: continue and backtrack
         if (0 != memcmp (&set[j].subject_key,
                          &del_pointer->delegate->issuer_key,
-                         sizeof (struct GNUNET_IDENTITY_PublicKey)))
+                         sizeof (struct GNUNET_CRYPTO_PublicKey)))
           continue;
         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                     "Checking if %s matches %s\n",
@@ -1181,7 +1181,7 @@ backward_resolution (void *cls,
           // key of list entry matches actual key
           if (0 == memcmp (&del_entry->delegation_chain_entry->issuer_key,
                            &ds_entry->delegation_chain_entry->subject_key,
-                           sizeof (struct GNUNET_IDENTITY_PublicKey)))
+                           sizeof (struct GNUNET_CRYPTO_PublicKey)))
           {
             // compare entry subject attributes to this trailer (iss attr + 
old trailer)
             if (0 == strcmp (del_entry->attr_trailer,
@@ -1270,7 +1270,7 @@ delegation_chain_bw_resolution_start (void *cls)
   {
     if (0 != memcmp (&del_entry->delegate->issuer_key,
                      &vrh->issuer_key,
-                     sizeof (struct GNUNET_IDENTITY_PublicKey)))
+                     sizeof (struct GNUNET_CRYPTO_PublicKey)))
       continue;
     if (0 !=
         strcmp (del_entry->delegate->issuer_attribute, vrh->issuer_attribute))
@@ -1292,10 +1292,10 @@ delegation_chain_bw_resolution_start (void *cls)
   ds_entry = GNUNET_new (struct DelegationSetQueueEntry);
   GNUNET_CONTAINER_DLL_insert (vrh->dsq_head, vrh->dsq_tail, ds_entry);
   ds_entry->from_bw = true;
-  ds_entry->issuer_key = GNUNET_new (struct GNUNET_IDENTITY_PublicKey);
+  ds_entry->issuer_key = GNUNET_new (struct GNUNET_CRYPTO_PublicKey);
   GNUNET_memcpy (ds_entry->issuer_key,
                  &vrh->issuer_key,
-                 sizeof (struct GNUNET_IDENTITY_PublicKey));
+                 sizeof (struct GNUNET_CRYPTO_PublicKey));
   ds_entry->issuer_attribute = GNUNET_strdup (vrh->issuer_attribute);
 
   ds_entry->delegation_chain_entry = GNUNET_new (struct DelegationChainEntry);
@@ -1352,7 +1352,7 @@ delegation_chain_fw_resolution_start (void *cls)
   {
     if (0 != memcmp (&del_entry->delegate->issuer_key,
                      &vrh->issuer_key,
-                     sizeof (struct GNUNET_IDENTITY_PublicKey)))
+                     sizeof (struct GNUNET_CRYPTO_PublicKey)))
       continue;
     if (0 !=
         strcmp (del_entry->delegate->issuer_attribute, vrh->issuer_attribute))
@@ -1374,17 +1374,17 @@ delegation_chain_fw_resolution_start (void *cls)
 
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Looking for %s.%s\n",
-                GNUNET_IDENTITY_public_key_to_string (
+                GNUNET_CRYPTO_public_key_to_string (
                   &del_entry->delegate->issuer_key),
                 del_entry->delegate->issuer_attribute);
 
     ds_entry = GNUNET_new (struct DelegationSetQueueEntry);
     GNUNET_CONTAINER_DLL_insert (vrh->dsq_head, vrh->dsq_tail, ds_entry);
     ds_entry->from_bw = false;
-    ds_entry->issuer_key = GNUNET_new (struct GNUNET_IDENTITY_PublicKey);
+    ds_entry->issuer_key = GNUNET_new (struct GNUNET_CRYPTO_PublicKey);
     GNUNET_memcpy (ds_entry->issuer_key,
                    &del_entry->delegate->subject_key,
-                   sizeof (struct GNUNET_IDENTITY_PublicKey));
+                   sizeof (struct GNUNET_CRYPTO_PublicKey));
 
     ds_entry->delegation_chain_entry = GNUNET_new (struct 
DelegationChainEntry);
     ds_entry->delegation_chain_entry->subject_key =
@@ -1588,7 +1588,7 @@ delegate_collection_finished (void *cls)
 
 static void
 handle_delegate_collection_cb (void *cls,
-                               const struct GNUNET_IDENTITY_PrivateKey *key,
+                               const struct GNUNET_CRYPTO_PrivateKey *key,
                                const char *label,
                                unsigned int rd_count,
                                const struct GNUNET_GNSRECORD_Data *rd)
@@ -1646,7 +1646,7 @@ handle_collect (void *cls, const struct CollectMessage 
*c_msg)
   vrh->client = client;
   vrh->request_id = c_msg->id;
   vrh->issuer_key = c_msg->issuer_key;
-  GNUNET_IDENTITY_key_get_public (&c_msg->subject_key, &vrh->subject_key);
+  GNUNET_CRYPTO_key_get_public (&c_msg->subject_key, &vrh->subject_key);
   vrh->issuer_attribute = GNUNET_strdup (issuer_attribute);
   vrh->resolution_algo = ntohs (c_msg->resolution_algo);
 
diff --git a/src/abd/plugin_gnsrecord_abd.c b/src/abd/plugin_gnsrecord_abd.c
index 7b2f4af5b..43abe578f 100644
--- a/src/abd/plugin_gnsrecord_abd.c
+++ b/src/abd/plugin_gnsrecord_abd.c
@@ -77,7 +77,7 @@ abd_value_to_string (void *cls,
       for (i = 0; i < ntohl (sets.set_count); i++)
       {
         subject_pkey =
-          GNUNET_IDENTITY_public_key_to_string (&set[i].subject_key);
+          GNUNET_CRYPTO_public_key_to_string (&set[i].subject_key);
 
         if (0 == set[i].subject_attribute_len)
         {
@@ -208,7 +208,7 @@ abd_string_to_value (void *cls,
 
         // sets the public key for the set entry
         if (GNUNET_SYSERR ==
-            GNUNET_IDENTITY_public_key_from_string (subject_pkey,
+            GNUNET_CRYPTO_public_key_from_string (subject_pkey,
                                                     &set[i].subject_key))
         {
           GNUNET_free (tmp_str);
diff --git a/src/arm/Makefile.am b/src/arm/Makefile.am
index 8a738c5a9..6ecc7ca7a 100644
--- a/src/arm/Makefile.am
+++ b/src/arm/Makefile.am
@@ -18,7 +18,7 @@ lib_LTLIBRARIES = libgnunetarm.la
 libgnunetarm_la_SOURCES = \
   arm_api.c arm_monitor_api.c arm.h
 libgnunetarm_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL) $(XLIB)
 libgnunetarm_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)   \
@@ -38,19 +38,19 @@ gnunet_arm_SOURCES = \
  gnunet-arm.c
 gnunet_arm_LDADD = \
   libgnunetarm.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 gnunet_service_arm_SOURCES = \
  gnunet-service-arm.c
 gnunet_service_arm_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 mockup_service_SOURCES = \
   mockup-service.c
  mockup_service_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 mockup_service_LDFLAGS = \
  $(GN_LIBINTL)
 
@@ -74,19 +74,19 @@ test_arm_api_SOURCES = \
  test_arm_api.c
 test_arm_api_LDADD = \
   libgnunetarm.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_exponential_backoff_SOURCES = \
  test_exponential_backoff.c
 test_exponential_backoff_LDADD = \
   libgnunetarm.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_gnunet_service_arm_SOURCES = \
  test_gnunet_service_arm.c
  test_gnunet_service_arm_LDADD = \
   libgnunetarm.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 SUFFIXES = .py.in .py
 .py.in.py:
diff --git a/src/auction/Makefile.am b/src/auction/Makefile.am
index 0cb5d5a84..ec0ffaf33 100644
--- a/src/auction/Makefile.am
+++ b/src/auction/Makefile.am
@@ -20,7 +20,7 @@ libexec_PROGRAMS = \
 gnunet_service_auction_SOURCES = \
        gnunet-service-auction.c
 gnunet_service_auction_LDADD = \
-       $(top_builddir)/src/util/libgnunetutil.la \
+       $(top_builddir)/src/lib/util/libgnunetutil.la \
        -ljansson \
        $(GN_LIBINTL)
 
@@ -33,21 +33,21 @@ bin_PROGRAMS = \
 gnunet_auction_create_SOURCES = \
        gnunet-auction-create.c
 gnunet_auction_create_LDADD = \
-       $(top_builddir)/src/util/libgnunetutil.la \
+       $(top_builddir)/src/lib/util/libgnunetutil.la \
        -ljansson \
        $(GN_LIBINTL)
 
 gnunet_auction_info_SOURCES = \
        gnunet-auction-info.c
 gnunet_auction_info_LDADD = \
-       $(top_builddir)/src/util/libgnunetutil.la \
+       $(top_builddir)/src/lib/util/libgnunetutil.la \
        -ljansson \
        $(GN_LIBINTL)
 
 gnunet_auction_join_SOURCES = \
        gnunet-auction-join.c
 gnunet_auction_join_LDADD = \
-       $(top_builddir)/src/util/libgnunetutil.la \
+       $(top_builddir)/src/lib/util/libgnunetutil.la \
        -ljansson \
        $(GN_LIBINTL)
 
@@ -58,7 +58,7 @@ check_PROGRAMS = \
 test_auction_api_SOURCES = \
        test_auction_api.c
 test_auction_api_LDADD = \
-       $(top_builddir)/src/util/libgnunetutil.la
+       $(top_builddir)/src/lib/util/libgnunetutil.la
 
 
 check_SCRIPTS = \
diff --git a/src/cadet/Makefile.am b/src/cadet/Makefile.am
index 3f1c79de0..b28286197 100644
--- a/src/cadet/Makefile.am
+++ b/src/cadet/Makefile.am
@@ -35,7 +35,7 @@ libgnunetcadet_la_SOURCES = \
   cadet_api_list_tunnels.c \
   cadet_api_helper.c
 libgnunetcadet_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(XLIB) \
   $(LTLIBINTL)
 libgnunetcadet_la_LDFLAGS = \
@@ -46,7 +46,7 @@ gnunet_cadet_SOURCES = \
   gnunet-cadet.c
 gnunet_cadet_LDADD = \
   libgnunetcadet.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 gnunet_cadet_LDFLAGS = \
   $(GN_LIBINTL)
 
@@ -61,14 +61,14 @@ gnunet_service_cadet_SOURCES = \
  gnunet-service-cadet_paths.c gnunet-service-cadet_paths.h \
  gnunet-service-cadet_peer.c gnunet-service-cadet_peer.h
 gnunet_service_cadet_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/dht/libgnunetdht.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/transport/libgnunettransportapplication.la \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/block/libgnunetblock.la
+  $(top_builddir)/src/lib/hello/libgnunethello.la \
+  $(top_builddir)/src/lib/block/libgnunetblock.la
 if LINUX
 gnunet_service_cadet_LDFLAGS = -lrt \
     $(GN_LIBINTL)
@@ -80,7 +80,7 @@ test_cadet_local_mq_SOURCES = \
 test_cadet_local_mq_LDADD = \
   libgnunetcadet.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 if ENABLE_TEST_RUN
 AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
diff --git a/src/cli/Makefile.am b/src/cli/Makefile.am
new file mode 100644
index 000000000..d94046cde
--- /dev/null
+++ b/src/cli/Makefile.am
@@ -0,0 +1,2 @@
+SUBDIRS = \
+       util
diff --git a/src/cli/util/.gitignore b/src/cli/util/.gitignore
new file mode 100644
index 000000000..9e045f16f
--- /dev/null
+++ b/src/cli/util/.gitignore
@@ -0,0 +1,10 @@
+gnunet-config
+gnunet-config-diff
+gnunet-crypto-tvg
+gnunet-ecc
+gnunet-qr
+gnunet-resolver
+gnunet-scrypt
+gnunet-uri
+gnunet-base32
+gnunet-timeout
diff --git a/src/cli/util/Makefile.am b/src/cli/util/Makefile.am
new file mode 100644
index 000000000..cac477e13
--- /dev/null
+++ b/src/cli/util/Makefile.am
@@ -0,0 +1,108 @@
+# This Makefile.am is in the public domain
+AM_CPPFLAGS = -I$(top_srcdir)/src/include
+
+plugindir = $(libdir)/gnunet
+
+libexecdir= $(pkglibdir)/libexec/
+
+pkgcfgdir= $(pkgdatadir)/config.d/
+
+if USE_COVERAGE
+  AM_CFLAGS = --coverage -O0
+  XLIB = -lgcov
+endif
+
+gnunet_config_diff_SOURCES = \
+ gnunet-config-diff.c
+gnunet_config_diff_LDADD = \
+ $(top_builddir)/src/lib/util/libgnunetutil.la
+
+GNUNET_ECC = gnunet-ecc
+GNUNET_SCRYPT = gnunet-scrypt
+
+libexec_PROGRAMS = \
+ gnunet-timeout
+
+bin_PROGRAMS = \
+ gnunet-base32 \
+ gnunet-config \
+ gnunet-resolver \
+ $(GNUNET_ECC) \
+ $(GNUNET_SCRYPT) \
+ gnunet-uri
+if HAVE_ZBAR
+bin_PROGRAMS += gnunet-qr
+endif
+
+noinst_PROGRAMS = \
+ gnunet-config-diff \
+ gnunet-crypto-tvg
+
+if ENABLE_TEST_RUN
+AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
+TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+endif
+
+gnunet_timeout_SOURCES = \
+ gnunet-timeout.c
+
+gnunet_resolver_SOURCES = \
+ gnunet-resolver.c
+gnunet_resolver_LDADD = \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(GN_LIBINTL)
+
+gnunet_crypto_tvg_SOURCES = \
+ gnunet-crypto-tvg.c
+gnunet_crypto_tvg_LDADD = \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(GN_LIBINTL) -lgcrypt -ljansson
+
+gnunet_ecc_SOURCES = \
+ gnunet-ecc.c
+gnunet_ecc_LDADD = \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(GN_LIBINTL) -lgcrypt
+
+gnunet_base32_SOURCES = \
+ gnunet-base32.c
+gnunet_base32_LDADD = \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(GN_LIBINTL)
+
+gnunet_scrypt_SOURCES = \
+ gnunet-scrypt.c
+gnunet_scrypt_LDADD = \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(GN_LIBINTL) -lgcrypt
+
+
+gnunet_config_SOURCES = \
+ gnunet-config.c
+gnunet_config_LDADD = \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(GN_LIBINTL)
+
+gnunet_uri_SOURCES = \
+ gnunet-uri.c
+gnunet_uri_LDADD = \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(GN_LIBINTL)
+
+
+gnunet_qr_SOURCES = \
+  gnunet-qr.c
+gnunet_qr_LDADD = \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(GN_LIBINTL)
+gnunet_qr_LDFLAGS= -lzbar
+if HAVE_PNG
+gnunet_qr_LDFLAGS += -lpng
+endif
+
+check_SCRIPTS = \
+ test_crypto_vectors.sh
+
+EXTRA_DIST = \
+  test_crypto_vectors.sh \
+  crypto-test-vectors.json
diff --git a/src/util/crypto-test-vectors.json 
b/src/cli/util/crypto-test-vectors.json
similarity index 100%
rename from src/util/crypto-test-vectors.json
rename to src/cli/util/crypto-test-vectors.json
diff --git a/src/util/gnunet-base32.c b/src/cli/util/gnunet-base32.c
similarity index 100%
rename from src/util/gnunet-base32.c
rename to src/cli/util/gnunet-base32.c
diff --git a/src/util/gnunet-config-diff.c b/src/cli/util/gnunet-config-diff.c
similarity index 100%
rename from src/util/gnunet-config-diff.c
rename to src/cli/util/gnunet-config-diff.c
diff --git a/src/util/gnunet-config.c b/src/cli/util/gnunet-config.c
similarity index 100%
rename from src/util/gnunet-config.c
rename to src/cli/util/gnunet-config.c
diff --git a/src/util/gnunet-crypto-tvg.c b/src/cli/util/gnunet-crypto-tvg.c
similarity index 100%
rename from src/util/gnunet-crypto-tvg.c
rename to src/cli/util/gnunet-crypto-tvg.c
diff --git a/src/util/gnunet-ecc.c b/src/cli/util/gnunet-ecc.c
similarity index 100%
rename from src/util/gnunet-ecc.c
rename to src/cli/util/gnunet-ecc.c
diff --git a/src/util/gnunet-qr.c b/src/cli/util/gnunet-qr.c
similarity index 100%
rename from src/util/gnunet-qr.c
rename to src/cli/util/gnunet-qr.c
diff --git a/src/util/gnunet-resolver.c b/src/cli/util/gnunet-resolver.c
similarity index 100%
rename from src/util/gnunet-resolver.c
rename to src/cli/util/gnunet-resolver.c
diff --git a/src/util/gnunet-scrypt.c b/src/cli/util/gnunet-scrypt.c
similarity index 100%
rename from src/util/gnunet-scrypt.c
rename to src/cli/util/gnunet-scrypt.c
diff --git a/src/util/gnunet-timeout.c b/src/cli/util/gnunet-timeout.c
similarity index 100%
rename from src/util/gnunet-timeout.c
rename to src/cli/util/gnunet-timeout.c
diff --git a/src/util/gnunet-uri.c b/src/cli/util/gnunet-uri.c
similarity index 100%
rename from src/util/gnunet-uri.c
rename to src/cli/util/gnunet-uri.c
diff --git a/src/util/test_crypto_vectors.sh 
b/src/cli/util/test_crypto_vectors.sh
similarity index 100%
rename from src/util/test_crypto_vectors.sh
rename to src/cli/util/test_crypto_vectors.sh
diff --git a/src/consensus/Makefile.am b/src/consensus/Makefile.am
index 49d111538..a88b8bc60 100644
--- a/src/consensus/Makefile.am
+++ b/src/consensus/Makefile.am
@@ -38,7 +38,7 @@ lib_LTLIBRARIES = \
 gnunet_service_consensus_SOURCES = \
  gnunet-service-consensus.c
 gnunet_service_consensus_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/set/libgnunetset.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
@@ -48,7 +48,7 @@ gnunet_service_evil_consensus_SOURCES = \
  gnunet-service-consensus.c \
  consensus_protocol.h
 gnunet_service_evil_consensus_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/set/libgnunetset.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
@@ -59,7 +59,7 @@ libgnunetconsensus_la_SOURCES = \
   consensus_api.c \
   consensus.h
 libgnunetconsensus_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunetconsensus_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)
@@ -71,9 +71,9 @@ plugin_LTLIBRARIES = \
 libgnunet_plugin_block_consensus_la_SOURCES = \
   plugin_block_consensus.c
 libgnunet_plugin_block_consensus_la_LIBADD = \
-  $(top_builddir)/src/block/libgnunetblock.la \
-  $(top_builddir)/src/block/libgnunetblockgroup.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/block/libgnunetblock.la \
+  $(top_builddir)/src/lib/block/libgnunetblockgroup.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunet_plugin_block_consensus_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -91,7 +91,7 @@ endif
 test_consensus_api_SOURCES = \
  test_consensus_api.c
 test_consensus_api_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetconsensus.la
 
diff --git a/src/conversation/Makefile.am b/src/conversation/Makefile.am
index 0f99a6526..0b8a34d36 100644
--- a/src/conversation/Makefile.am
+++ b/src/conversation/Makefile.am
@@ -41,7 +41,7 @@ plugin_LTLIBRARIES = \
 libgnunet_plugin_gnsrecord_conversation_la_SOURCES = \
   plugin_gnsrecord_conversation.c
 libgnunet_plugin_gnsrecord_conversation_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunet_plugin_gnsrecord_conversation_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -50,7 +50,7 @@ libgnunet_plugin_gnsrecord_conversation_la_LDFLAGS = \
 libgnunetmicrophone_la_SOURCES = \
   microphone.c
 libgnunetmicrophone_la_LIBADD = \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 libgnunetmicrophone_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)   \
   -version-info 0:0:0
@@ -58,7 +58,7 @@ libgnunetmicrophone_la_LDFLAGS = \
 libgnunetspeaker_la_SOURCES = \
   speaker.c
 libgnunetspeaker_la_LIBADD = \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 libgnunetspeaker_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)   \
   -version-info 0:0:0
@@ -70,10 +70,10 @@ libgnunetconversation_la_SOURCES = \
   conversation.h
 libgnunetconversation_la_LIBADD = \
   $(top_builddir)/src/gns/libgnunetgns.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/namestore/libgnunetnamestore.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 libgnunetconversation_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)   \
@@ -113,7 +113,7 @@ if BUILD_PULSE_HELPERS
 gnunet_helper_audio_record_SOURCES = \
   gnunet-helper-audio-record.c
 gnunet_helper_audio_record_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   -lpulse  -lopus -logg \
   $(INTLLIBS)
 #gnunet_helper_audio_record_LDFLAGS = \
@@ -122,7 +122,7 @@ gnunet_helper_audio_record_LDADD = \
 gnunet_helper_audio_playback_SOURCES = \
   gnunet-helper-audio-playback.c
 gnunet_helper_audio_playback_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   -lpulse -lopus -logg \
   $(INTLLIBS)
 #gnunet_helper_audio_playback_LDFLAGS = \
@@ -132,7 +132,7 @@ if BUILD_GST_HELPERS
 gnunet_helper_audio_record_SOURCES = \
   gnunet-helper-audio-record-gst.c
 gnunet_helper_audio_record_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GST_LIBS) \
   $(INTLLIBS)
 gnunet_helper_audio_record_LDFLAGS = \
@@ -143,7 +143,7 @@ gnunet_helper_audio_record_CFLAGS = \
 gnunet_helper_audio_playback_SOURCES = \
     gnunet-helper-audio-playback-gst.c
 gnunet_helper_audio_playback_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GST_LIBS) \
   $(INTLLIBS)
 gnunet_helper_audio_playback_LDFLAGS = \
@@ -155,7 +155,7 @@ if BUILD_EXPERIMENTAL_HELPERS
 gnunet_helper_audio_record_SOURCES = \
   gnunet_gst_test.c gnunet_gst.c
 gnunet_helper_audio_record_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GST_LIBS) \
   $(INTLLIBS)
 gnunet_helper_audio_record_LDFLAGS = \
@@ -166,7 +166,7 @@ gnunet_helper_audio_record_CFLAGS = \
 gnunet_helper_audio_playback_SOURCES = \
     gnunet_gst_test.c gnunet_gst.c
 gnunet_helper_audio_playback_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GST_LIBS) \
   $(INTLLIBS)
 gnunet_helper_audio_playback_LDFLAGS = \
@@ -184,7 +184,7 @@ gnunet_service_conversation_LDADD = \
   libgnunetspeaker.la \
   libgnunetmicrophone.la \
   $(top_builddir)/src/cadet/libgnunetcadet.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(INTLLIBS)
 #gnunet_service_conversation_LDFLAGS = \
@@ -197,10 +197,10 @@ gnunet_conversation_LDADD = \
   libgnunetspeaker.la \
   libgnunetconversation.la \
   $(top_builddir)/src/gns/libgnunetgns.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/namestore/libgnunetnamestore.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(INTLLIBS)
 #gnunet_conversation_LDFLAGS = \
 # 
@@ -210,7 +210,7 @@ gnunet_conversation_test_SOURCES = \
 gnunet_conversation_test_LDADD = \
   libgnunetmicrophone.la \
   libgnunetspeaker.la \
-  $(top_builddir)/src/util/libgnunetutil.la  \
+  $(top_builddir)/src/lib/util/libgnunetutil.la  \
   $(INTLLIBS)
 #gnunet_conversation_test_LDFLAGS = \
 # 
@@ -222,11 +222,11 @@ test_conversation_api_LDADD = \
   libgnunetconversation.la \
   libgnunetspeaker.la \
   libgnunetmicrophone.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/namestore/libgnunetnamestore.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 test_conversation_api_LDFLAGS = \
   -export-dynamic
 
@@ -236,11 +236,11 @@ test_conversation_api_twocalls_LDADD = \
   libgnunetconversation.la \
   libgnunetspeaker.la \
   libgnunetmicrophone.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/namestore/libgnunetnamestore.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 test_conversation_api_twocalls_LDFLAGS = \
   -export-dynamic
 
@@ -250,11 +250,11 @@ test_conversation_api_reject_LDADD = \
   libgnunetconversation.la \
   libgnunetspeaker.la \
   libgnunetmicrophone.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/namestore/libgnunetnamestore.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 test_conversation_api_reject_LDFLAGS = \
   -export-dynamic
 
diff --git a/src/conversation/conversation_api.c 
b/src/conversation/conversation_api.c
index 9c4c520be..ed22bf9cf 100644
--- a/src/conversation/conversation_api.c
+++ b/src/conversation/conversation_api.c
@@ -105,7 +105,7 @@ struct GNUNET_CONVERSATION_Caller
   /**
    * Identity of the person calling us.
    */
-  struct GNUNET_IDENTITY_PublicKey caller_id;
+  struct GNUNET_CRYPTO_PublicKey caller_id;
 
   /**
    * Internal handle to identify the caller with the service.
@@ -192,7 +192,7 @@ struct GNUNET_CONVERSATION_Phone
   /**
    * My GNS zone.
    */
-  struct GNUNET_IDENTITY_PrivateKey my_zone;
+  struct GNUNET_CRYPTO_PrivateKey my_zone;
 
   /**
    * State machine for the phone.
@@ -263,7 +263,7 @@ handle_phone_ring (void *cls,
 {
   struct GNUNET_CONVERSATION_Phone *phone = cls;
   struct GNUNET_CONVERSATION_Caller *caller;
-  struct GNUNET_IDENTITY_PublicKey caller_id;
+  struct GNUNET_CRYPTO_PublicKey caller_id;
   size_t key_len;
   size_t read;
 
@@ -276,7 +276,7 @@ handle_phone_ring (void *cls,
 
   case PS_READY:
     if ((GNUNET_SYSERR ==
-         GNUNET_IDENTITY_read_public_key_from_buffer (&ring[1],
+         GNUNET_CRYPTO_read_public_key_from_buffer (&ring[1],
                                                       key_len,
                                                       &caller_id,
                                                       &read)) ||
diff --git a/src/conversation/conversation_api_call.c 
b/src/conversation/conversation_api_call.c
index 129192bf0..2650eb782 100644
--- a/src/conversation/conversation_api_call.c
+++ b/src/conversation/conversation_api_call.c
@@ -455,7 +455,7 @@ handle_gns_response (void *cls,
   struct GNUNET_CONVERSATION_Call *call = cls;
   struct GNUNET_MQ_Envelope *e;
   struct ClientCallMessage *ccm;
-  const struct GNUNET_IDENTITY_PrivateKey *caller_id;
+  const struct GNUNET_CRYPTO_PrivateKey *caller_id;
   size_t key_len;
 
   (void) was_gns;
@@ -475,12 +475,12 @@ handle_gns_response (void *cls,
                      rd[i].data,
                      rd[i].data_size);
       caller_id = GNUNET_IDENTITY_ego_get_private_key (call->caller_id);
-      key_len = GNUNET_IDENTITY_private_key_get_length (caller_id);
+      key_len = GNUNET_CRYPTO_private_key_get_length (caller_id);
       e = GNUNET_MQ_msg_extra (ccm, key_len,
                                GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL);
       ccm->line_port = call->phone_record.line_port;
       ccm->target = call->phone_record.peer;
-      GNUNET_IDENTITY_write_private_key_to_buffer (caller_id,
+      GNUNET_CRYPTO_write_private_key_to_buffer (caller_id,
                                                    &ccm[1], key_len);
       ccm->key_len = htonl (key_len);
       GNUNET_MQ_send (call->mq,
diff --git a/src/conversation/gnunet-conversation.c 
b/src/conversation/gnunet-conversation.c
index 9ff0002e7..41fc7bd0b 100644
--- a/src/conversation/gnunet-conversation.c
+++ b/src/conversation/gnunet-conversation.c
@@ -116,7 +116,7 @@ struct CallList
   /**
    * Public key identifying the caller.
    */
-  struct GNUNET_IDENTITY_PublicKey caller_id;
+  struct GNUNET_CRYPTO_PublicKey caller_id;
 
   /**
    * Unique number of the call.
@@ -194,7 +194,7 @@ static char *ego_name;
 /**
  * Public key of active conversation partner (if any).
  */
-static struct GNUNET_IDENTITY_PublicKey peer_key;
+static struct GNUNET_CRYPTO_PublicKey peer_key;
 
 /**
  * Name of active conversation partner (if any).
@@ -244,7 +244,7 @@ static void
 phone_event_handler (void *cls,
                      enum GNUNET_CONVERSATION_PhoneEventCode code,
                      struct GNUNET_CONVERSATION_Caller *caller,
-                     const struct GNUNET_IDENTITY_PublicKey *caller_id)
+                     const struct GNUNET_CRYPTO_PublicKey *caller_id)
 {
   struct CallList *cl;
 
diff --git a/src/conversation/gnunet-service-conversation.c 
b/src/conversation/gnunet-service-conversation.c
index 1fff8bd26..06721e535 100644
--- a/src/conversation/gnunet-service-conversation.c
+++ b/src/conversation/gnunet-service-conversation.c
@@ -756,8 +756,8 @@ handle_cadet_ring_message (void *cls, const struct 
CadetPhoneRingMessage *msg)
   struct GNUNET_MQ_Envelope *env;
   struct ClientPhoneRingMessage *cring;
   struct CadetPhoneRingInfoPS rs;
-  struct GNUNET_IDENTITY_PublicKey identity;
-  struct GNUNET_IDENTITY_Signature sig;
+  struct GNUNET_CRYPTO_PublicKey identity;
+  struct GNUNET_CRYPTO_Signature sig;
   size_t key_len;
   size_t sig_len;
   size_t read;
@@ -771,7 +771,7 @@ handle_cadet_ring_message (void *cls, const struct 
CadetPhoneRingMessage *msg)
   sig_len = ntohl (msg->sig_len);
 
   if ((GNUNET_SYSERR ==
-       GNUNET_IDENTITY_read_public_key_from_buffer (&msg[1],
+       GNUNET_CRYPTO_read_public_key_from_buffer (&msg[1],
                                                     key_len,
                                                     &identity,
                                                     &read)) ||
@@ -781,11 +781,11 @@ handle_cadet_ring_message (void *cls, const struct 
CadetPhoneRingMessage *msg)
     destroy_line_cadet_channels (ch);
     return;
   }
-  GNUNET_IDENTITY_read_signature_from_buffer (&sig,
+  GNUNET_CRYPTO_read_signature_from_buffer (&sig,
                                               (char*) &msg[1] + read,
                                               sig_len);
   if (GNUNET_OK !=
-      GNUNET_IDENTITY_signature_verify (
+      GNUNET_CRYPTO_signature_verify (
         GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING,
         &rs,
         &sig,
@@ -1165,9 +1165,9 @@ handle_client_call_message (void *cls, const struct 
ClientCallMessage *msg)
   struct GNUNET_MQ_Envelope *e;
   struct CadetPhoneRingMessage *ring;
   struct CadetPhoneRingInfoPS rs;
-  struct GNUNET_IDENTITY_PrivateKey caller_id;
-  struct GNUNET_IDENTITY_PublicKey caller_id_pub;
-  struct GNUNET_IDENTITY_Signature sig;
+  struct GNUNET_CRYPTO_PrivateKey caller_id;
+  struct GNUNET_CRYPTO_PublicKey caller_id_pub;
+  struct GNUNET_CRYPTO_Signature sig;
   ssize_t written;
   size_t key_len;
   size_t pkey_len;
@@ -1183,7 +1183,7 @@ handle_client_call_message (void *cls, const struct 
ClientCallMessage *msg)
     GNUNET_TIME_absolute_hton (GNUNET_TIME_relative_to_absolute 
(RING_TIMEOUT));
   key_len = ntohl (msg->key_len);
   if (GNUNET_SYSERR ==
-      GNUNET_IDENTITY_read_private_key_from_buffer (&msg[1],
+      GNUNET_CRYPTO_read_private_key_from_buffer (&msg[1],
                                                     key_len,
                                                     &caller_id,
                                                     &read))
@@ -1205,19 +1205,19 @@ handle_client_call_message (void *cls, const struct 
ClientCallMessage *msg)
                                              cadet_handlers);
   ch->mq = GNUNET_CADET_get_mq (ch->channel);
   GNUNET_assert (read == key_len);
-  GNUNET_IDENTITY_sign (&caller_id, &rs, &sig);
-  sig_len = GNUNET_IDENTITY_signature_get_length (&sig);
-  GNUNET_IDENTITY_key_get_public (&caller_id, &caller_id_pub);
-  pkey_len = GNUNET_IDENTITY_public_key_get_length (&caller_id_pub);
+  GNUNET_CRYPTO_sign (&caller_id, &rs, &sig);
+  sig_len = GNUNET_CRYPTO_signature_get_length (&sig);
+  GNUNET_CRYPTO_key_get_public (&caller_id, &caller_id_pub);
+  pkey_len = GNUNET_CRYPTO_public_key_get_length (&caller_id_pub);
   e = GNUNET_MQ_msg_extra (ring, pkey_len + sig_len,
                            GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING);
-  written = GNUNET_IDENTITY_write_public_key_to_buffer (&caller_id_pub,
+  written = GNUNET_CRYPTO_write_public_key_to_buffer (&caller_id_pub,
                                                         &ring[1],
                                                         pkey_len);
   ring->expiration_time = rs.expiration_time;
   ring->key_len = htonl (pkey_len);
   ring->sig_len = htonl (sig_len);
-  GNUNET_IDENTITY_write_signature_to_buffer (&sig,
+  GNUNET_CRYPTO_write_signature_to_buffer (&sig,
                                              (char *) &ring[1] + written,
                                              sig_len);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending RING message via CADET\n");
diff --git a/src/conversation/test_conversation_api.c 
b/src/conversation/test_conversation_api.c
index 22e9b1dd9..2e804a485 100644
--- a/src/conversation/test_conversation_api.c
+++ b/src/conversation/test_conversation_api.c
@@ -305,7 +305,7 @@ static void
 phone_event_handler (void *cls,
                      enum GNUNET_CONVERSATION_PhoneEventCode code,
                      struct GNUNET_CONVERSATION_Caller *caller,
-                     const struct GNUNET_IDENTITY_PublicKey *caller_id)
+                     const struct GNUNET_CRYPTO_PublicKey *caller_id)
 {
   static enum GNUNET_CONVERSATION_PhoneEventCode expect =
     GNUNET_CONVERSATION_EC_PHONE_RING;
@@ -385,7 +385,7 @@ call_event_handler (void *cls, enum 
GNUNET_CONVERSATION_CallEventCode code)
 
 static void
 caller_ego_create_cont (void *cls,
-                        const struct GNUNET_IDENTITY_PrivateKey *pk,
+                        const struct GNUNET_CRYPTO_PrivateKey *pk,
                         enum GNUNET_ErrorCode ec)
 {
   (void) cls;
@@ -402,7 +402,7 @@ namestore_put_cont (void *cls, enum GNUNET_ErrorCode ec)
   GNUNET_assert (GNUNET_EC_NONE == ec);
   GNUNET_assert (NULL == op);
   op = GNUNET_IDENTITY_create (id, "caller-ego", NULL,
-                               GNUNET_IDENTITY_TYPE_ECDSA,
+                               GNUNET_PUBLIC_KEY_TYPE_ECDSA,
                                &caller_ego_create_cont,
                                NULL);
 }
@@ -415,7 +415,7 @@ identity_cb (void *cls,
              const char *name)
 {
   struct GNUNET_GNSRECORD_Data rd;
-  struct GNUNET_IDENTITY_PublicKey pub;
+  struct GNUNET_CRYPTO_PublicKey pub;
 
   (void) cls;
   (void) ctx;
@@ -466,7 +466,7 @@ identity_cb (void *cls,
 
 static void
 phone_ego_create_cont (void *cls,
-                       const struct GNUNET_IDENTITY_PrivateKey *pk,
+                       const struct GNUNET_CRYPTO_PrivateKey *pk,
                        enum GNUNET_ErrorCode ec)
 {
   (void) cls;
@@ -486,7 +486,7 @@ run (void *cls,
   GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_test, NULL);
   id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL);
   op = GNUNET_IDENTITY_create (id, "phone-ego", NULL,
-                               GNUNET_IDENTITY_TYPE_ECDSA,
+                               GNUNET_PUBLIC_KEY_TYPE_ECDSA,
                                &phone_ego_create_cont,
                                NULL);
   ns = GNUNET_NAMESTORE_connect (cfg);
diff --git a/src/conversation/test_conversation_api_reject.c 
b/src/conversation/test_conversation_api_reject.c
index a7aab069f..37192f5b8 100644
--- a/src/conversation/test_conversation_api_reject.c
+++ b/src/conversation/test_conversation_api_reject.c
@@ -179,7 +179,7 @@ static void
 phone_event_handler (void *cls,
                      enum GNUNET_CONVERSATION_PhoneEventCode code,
                      struct GNUNET_CONVERSATION_Caller *caller,
-                     const struct GNUNET_IDENTITY_PublicKey *caller_id)
+                     const struct GNUNET_CRYPTO_PublicKey *caller_id)
 {
   static enum GNUNET_CONVERSATION_PhoneEventCode expect =
     GNUNET_CONVERSATION_EC_PHONE_RING;
@@ -238,7 +238,7 @@ call_event_handler (void *cls, enum 
GNUNET_CONVERSATION_CallEventCode code)
 
 static void
 caller_ego_create_cont (void *cls,
-                        const struct GNUNET_IDENTITY_PrivateKey *pk,
+                        const struct GNUNET_CRYPTO_PrivateKey *pk,
                         enum GNUNET_ErrorCode ec)
 {
   (void) cls;
@@ -255,7 +255,7 @@ namestore_put_cont (void *cls, enum GNUNET_ErrorCode ec)
   GNUNET_assert (GNUNET_EC_NONE == ec);
   GNUNET_assert (NULL == op);
   op = GNUNET_IDENTITY_create (id, "caller-ego", NULL,
-                               GNUNET_IDENTITY_TYPE_ECDSA,
+                               GNUNET_PUBLIC_KEY_TYPE_ECDSA,
                                &caller_ego_create_cont,
                                NULL);
 }
@@ -268,7 +268,7 @@ identity_cb (void *cls,
              const char *name)
 {
   struct GNUNET_GNSRECORD_Data rd;
-  struct GNUNET_IDENTITY_PublicKey pub;
+  struct GNUNET_CRYPTO_PublicKey pub;
 
   (void) cls;
   (void) ctx;
@@ -319,7 +319,7 @@ identity_cb (void *cls,
 
 static void
 phone_ego_create_cont (void *cls,
-                       const struct GNUNET_IDENTITY_PrivateKey *pk,
+                       const struct GNUNET_CRYPTO_PrivateKey *pk,
                        enum GNUNET_ErrorCode ec)
 {
   (void) cls;
@@ -339,7 +339,7 @@ run (void *cls,
   GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_test, NULL);
   id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL);
   op = GNUNET_IDENTITY_create (id, "phone-ego", NULL,
-                               GNUNET_IDENTITY_TYPE_ECDSA,
+                               GNUNET_PUBLIC_KEY_TYPE_ECDSA,
                                &phone_ego_create_cont,
                                NULL);
   ns = GNUNET_NAMESTORE_connect (cfg);
diff --git a/src/conversation/test_conversation_api_twocalls.c 
b/src/conversation/test_conversation_api_twocalls.c
index 1bd2b4e22..2ca31854d 100644
--- a/src/conversation/test_conversation_api_twocalls.c
+++ b/src/conversation/test_conversation_api_twocalls.c
@@ -403,7 +403,7 @@ static void
 phone_event_handler (void *cls,
                      enum GNUNET_CONVERSATION_PhoneEventCode code,
                      struct GNUNET_CONVERSATION_Caller *caller,
-                     const struct GNUNET_IDENTITY_PublicKey *caller_id)
+                     const struct GNUNET_CRYPTO_PublicKey *caller_id)
 {
   const char *cid;
 
@@ -507,7 +507,7 @@ call_event_handler (void *cls, enum 
GNUNET_CONVERSATION_CallEventCode code)
 
 static void
 caller_ego_create_cont (void *cls,
-                        const struct GNUNET_IDENTITY_PrivateKey *pk,
+                        const struct GNUNET_CRYPTO_PrivateKey *pk,
                         enum GNUNET_ErrorCode ec)
 {
   (void) cls;
@@ -524,7 +524,7 @@ namestore_put_cont (void *cls, enum GNUNET_ErrorCode ec)
   GNUNET_assert (GNUNET_EC_NONE == ec);
   GNUNET_assert (NULL == op);
   op = GNUNET_IDENTITY_create (id, "caller-ego", NULL,
-                               GNUNET_IDENTITY_TYPE_ECDSA,
+                               GNUNET_PUBLIC_KEY_TYPE_ECDSA,
                                &caller_ego_create_cont,
                                NULL);
 }
@@ -537,7 +537,7 @@ identity_cb (void *cls,
              const char *name)
 {
   struct GNUNET_GNSRECORD_Data rd;
-  struct GNUNET_IDENTITY_PublicKey pub;
+  struct GNUNET_CRYPTO_PublicKey pub;
 
   (void) cls;
   (void) ctx;
@@ -595,7 +595,7 @@ identity_cb (void *cls,
 
 static void
 phone_ego_create_cont (void *cls,
-                       const struct GNUNET_IDENTITY_PrivateKey *pk,
+                       const struct GNUNET_CRYPTO_PrivateKey *pk,
                        enum GNUNET_ErrorCode ec)
 {
   (void) cls;
@@ -616,7 +616,7 @@ run (void *cls,
   GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
   id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL);
   op = GNUNET_IDENTITY_create (id, "phone-ego", NULL,
-                               GNUNET_IDENTITY_TYPE_ECDSA,
+                               GNUNET_PUBLIC_KEY_TYPE_ECDSA,
                                &phone_ego_create_cont,
                                NULL);
   ns = GNUNET_NAMESTORE_connect (cfg);
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
index 5e2a74ec3..7a9046c57 100644
--- a/src/core/Makefile.am
+++ b/src/core/Makefile.am
@@ -29,7 +29,7 @@ libgnunetcore_la_SOURCES = \
   core_api.c core.h \
   core_api_monitor_peers.c
 libgnunetcore_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL) $(XLIB)
 libgnunetcore_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)  \
@@ -44,9 +44,9 @@ libgnunet_test_core_plugin_cmd_just_run_la_LIBADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
+  $(top_builddir)/src/lib/hello/libgnunethello.la \
   $(top_builddir)/src/arm/libgnunetarm.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunet_test_core_plugin_cmd_just_run_la_LDFLAGS = \
   $(GN_PLUGIN_LDFLAGS)
@@ -58,7 +58,7 @@ libgnunetcoretesting_la_LIBADD = \
   $(top_builddir)/src/arm/libgnunetarm.la \
   $(top_builddir)/src/transport/libgnunettransportapplication.la \
   $(top_builddir)/src/transport/libgnunettransportcore.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 libgnunetcoretesting_la_LDFLAGS = \
   $(GN_LIBINTL) \
   $(GN_LIB_LDFLAGS) \
@@ -80,7 +80,7 @@ gnunet_service_core_LDADD = \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/transport/libgnunettransportapplication.la \
   $(top_builddir)/src/transport/libgnunettransportcore.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL) $(Z_LIBS)
 
 
@@ -88,7 +88,7 @@ gnunet_core_SOURCES = \
  gnunet-core.c
 gnunet_core_LDADD = \
   libgnunetcore.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 gnunet_core_LDFLAGS = \
   $(GN_LIBINTL)
 
@@ -114,14 +114,14 @@ test_core_api_send_to_self_SOURCES = \
 test_core_api_send_to_self_LDADD = \
  libgnunetcore.la \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_core_api_start_only_SOURCES = \
  test_core_api_start_only.c
 test_core_api_start_only_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
  libgnunetcore.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 EXTRA_DIST = \
   test_core_start_testcase.sh \
diff --git a/src/curl/Makefile.am b/src/curl/Makefile.am
index bf18b0647..78eae4b97 100644
--- a/src/curl/Makefile.am
+++ b/src/curl/Makefile.am
@@ -17,7 +17,7 @@ libgnunetcurl_la_SOURCES = \
   curl.c \
   curl_reschedule.c
 libgnunetcurl_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   -ljansson \
   @LIBCURL@ \
   $(XLIB)
@@ -34,5 +34,5 @@ libgnunetcurl_la_CPPFLAGS = \
 #  test_curl.c
 #test_curl_LDADD = \
 #  libgnunetcurl.la \
-#  $(top_builddir)/src/util/libgnunetutil.la \
+#  $(top_builddir)/src/lib/util/libgnunetutil.la \
 #  -ljansson -lcurl
diff --git a/src/datacache/Makefile.am b/src/datacache/Makefile.am
index 1ae4744a8..def1eb58e 100644
--- a/src/datacache/Makefile.am
+++ b/src/datacache/Makefile.am
@@ -34,7 +34,7 @@ libgnunetdatacache_la_SOURCES = \
   datacache.c
 libgnunetdatacache_la_LIBADD = \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 libgnunetdatacache_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)  \
@@ -57,7 +57,7 @@ libgnunet_plugin_datacache_sqlite_la_SOURCES = \
 libgnunet_plugin_datacache_sqlite_la_LIBADD = \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/sq/libgnunetsq.la \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3 \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lsqlite3 \
   $(LTLIBINTL)
 libgnunet_plugin_datacache_sqlite_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -66,7 +66,7 @@ libgnunet_plugin_datacache_heap_la_SOURCES = \
   plugin_datacache_heap.c
 libgnunet_plugin_datacache_heap_la_LIBADD = \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \
   $(LTLIBINTL)
 libgnunet_plugin_datacache_heap_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -76,7 +76,7 @@ libgnunet_plugin_datacache_postgres_la_SOURCES = \
 libgnunet_plugin_datacache_postgres_la_LIBADD = \
   $(top_builddir)/src/pq/libgnunetpq.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_PLUGIN_LDFLAGS) -lpq
 libgnunet_plugin_datacache_postgres_la_CPPFLAGS = \
  $(POSTGRESQL_CPPFLAGS) $(AM_CPPFLAGS)
@@ -86,7 +86,7 @@ libgnunet_plugin_datacache_postgres_la_LDFLAGS = \
 libgnunet_plugin_datacache_template_la_SOURCES = \
   plugin_datacache_template.c
 libgnunet_plugin_datacache_template_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \
   $(LTLIBINTL)
 libgnunet_plugin_datacache_template_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -126,42 +126,42 @@ test_datacache_sqlite_SOURCES = \
 test_datacache_sqlite_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
  libgnunetdatacache.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_datacache_quota_sqlite_SOURCES = \
  test_datacache_quota.c
 test_datacache_quota_sqlite_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
  libgnunetdatacache.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_datacache_heap_SOURCES = \
  test_datacache.c
 test_datacache_heap_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
  libgnunetdatacache.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_datacache_quota_heap_SOURCES = \
  test_datacache_quota.c
 test_datacache_quota_heap_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
  libgnunetdatacache.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_datacache_postgres_SOURCES = \
  test_datacache.c
 test_datacache_postgres_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
  libgnunetdatacache.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_datacache_quota_postgres_SOURCES = \
  test_datacache_quota.c
 test_datacache_quota_postgres_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
  libgnunetdatacache.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 EXTRA_DIST = \
  test_datacache_data_sqlite.conf \
diff --git a/src/datastore/Makefile.am b/src/datastore/Makefile.am
index 595c7da3d..e8ede4b3e 100644
--- a/src/datastore/Makefile.am
+++ b/src/datastore/Makefile.am
@@ -29,7 +29,7 @@ libgnunetdatastore_la_SOURCES = \
   datastore_api.c datastore.h
 libgnunetdatastore_la_LIBADD = \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 libgnunetdatastore_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)  \
@@ -45,14 +45,14 @@ gnunet_service_datastore_SOURCES = \
  gnunet-service-datastore.c
 gnunet_service_datastore_LDADD = \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 gnunet_datastore_SOURCES = \
  gnunet-datastore.c
 gnunet_datastore_LDADD = \
   libgnunetdatastore.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 
@@ -99,7 +99,7 @@ libgnunet_plugin_datastore_sqlite_la_SOURCES = \
 libgnunet_plugin_datastore_sqlite_la_LIBADD = \
   $(top_builddir)/src/sq/libgnunetsq.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3 \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lsqlite3 \
   $(LTLIBINTL)
 libgnunet_plugin_datastore_sqlite_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -108,7 +108,7 @@ libgnunet_plugin_datastore_sqlite_la_LDFLAGS = \
 libgnunet_plugin_datastore_heap_la_SOURCES = \
   plugin_datastore_heap.c
 libgnunet_plugin_datastore_heap_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \
   $(LTLIBINTL)
 libgnunet_plugin_datastore_heap_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -119,7 +119,7 @@ libgnunet_plugin_datastore_postgres_la_SOURCES = \
 libgnunet_plugin_datastore_postgres_la_LIBADD = \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/pq/libgnunetpq.la \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lpq
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lpq
 libgnunet_plugin_datastore_postgres_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS) $(POSTGRESQL_LDFLAGS)
 libgnunet_plugin_datastore_postgres_la_CPPFLAGS = \
@@ -129,7 +129,7 @@ libgnunet_plugin_datastore_postgres_la_CPPFLAGS = \
 libgnunet_plugin_datastore_template_la_SOURCES = \
   plugin_datastore_template.c
 libgnunet_plugin_datastore_template_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \
   $(LTLIBINTL)
 libgnunet_plugin_datastore_template_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -153,33 +153,33 @@ test_datastore_api_heap_SOURCES = \
 test_datastore_api_heap_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
  libgnunetdatastore.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_datastore_api_management_heap_SOURCES = \
  test_datastore_api_management.c
 test_datastore_api_management_heap_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
  libgnunetdatastore.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 perf_datastore_api_heap_SOURCES = \
  perf_datastore_api.c
 perf_datastore_api_heap_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
  libgnunetdatastore.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 perf_plugin_datastore_heap_SOURCES = \
  perf_plugin_datastore.c
 perf_plugin_datastore_heap_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_plugin_datastore_heap_SOURCES = \
  test_plugin_datastore.c
 test_plugin_datastore_heap_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 
 test_datastore_api_sqlite_SOURCES = \
@@ -187,33 +187,33 @@ test_datastore_api_sqlite_SOURCES = \
 test_datastore_api_sqlite_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
  libgnunetdatastore.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_datastore_api_management_sqlite_SOURCES = \
  test_datastore_api_management.c
 test_datastore_api_management_sqlite_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
  libgnunetdatastore.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 perf_datastore_api_sqlite_SOURCES = \
  perf_datastore_api.c
 perf_datastore_api_sqlite_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
  libgnunetdatastore.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 perf_plugin_datastore_sqlite_SOURCES = \
  perf_plugin_datastore.c
 perf_plugin_datastore_sqlite_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_plugin_datastore_sqlite_SOURCES = \
  test_plugin_datastore.c
 test_plugin_datastore_sqlite_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 
 test_datastore_api_postgres_SOURCES = \
@@ -221,33 +221,33 @@ test_datastore_api_postgres_SOURCES = \
 test_datastore_api_postgres_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
  libgnunetdatastore.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_datastore_api_management_postgres_SOURCES = \
  test_datastore_api_management.c
 test_datastore_api_management_postgres_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
  libgnunetdatastore.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 perf_datastore_api_postgres_SOURCES = \
  perf_datastore_api.c
 perf_datastore_api_postgres_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
  libgnunetdatastore.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_plugin_datastore_postgres_SOURCES = \
  test_plugin_datastore.c
 test_plugin_datastore_postgres_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 perf_plugin_datastore_postgres_SOURCES = \
  perf_plugin_datastore.c
 perf_plugin_datastore_postgres_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 
 EXTRA_DIST = \
diff --git a/src/dht/Makefile.am b/src/dht/Makefile.am
index 62b093c5d..1e3a5f8f8 100644
--- a/src/dht/Makefile.am
+++ b/src/dht/Makefile.am
@@ -21,7 +21,7 @@ lib_LTLIBRARIES = \
 libgnunetdht_la_SOURCES = \
   dht_api.c dht.h
 libgnunetdht_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(XLIB) \
   $(LTLIBINTL)
 libgnunetdht_la_LDFLAGS = \
@@ -35,10 +35,10 @@ plugin_LTLIBRARIES = \
 libgnunet_plugin_block_dht_la_SOURCES = \
   plugin_block_dht.c
 libgnunet_plugin_block_dht_la_LIBADD = \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/block/libgnunetblock.la \
-  $(top_builddir)/src/block/libgnunetblockgroup.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/hello/libgnunethello.la \
+  $(top_builddir)/src/lib/block/libgnunetblock.la \
+  $(top_builddir)/src/lib/block/libgnunetblockgroup.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunet_plugin_block_dht_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -64,11 +64,11 @@ gnunet_service_dht_LDADD = \
   $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/nse/libgnunetnse.la \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/block/libgnunetblock.la \
-  $(top_builddir)/src/block/libgnunetblockgroup.la \
+  $(top_builddir)/src/lib/hello/libgnunethello.la \
+  $(top_builddir)/src/lib/block/libgnunetblock.la \
+  $(top_builddir)/src/lib/block/libgnunetblockgroup.la \
   $(top_builddir)/src/datacache/libgnunetdatacache.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   -lm
 gnunet_service_dht_LDFLAGS = \
   $(GN_LIBINTL)
@@ -77,7 +77,7 @@ gnunet_dht_get_SOURCES = \
  gnunet-dht-get.c
 gnunet_dht_get_LDADD = \
   libgnunetdht.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 gnunet_dht_get_LDFLAGS = \
   $(GN_LIBINTL)
 
@@ -85,7 +85,7 @@ gnunet_dht_hello_SOURCES = \
  gnunet-dht-hello.c
 gnunet_dht_hello_LDADD = \
   libgnunetdht.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 gnunet_dht_hello_LDFLAGS = \
   $(GN_LIBINTL)
 
@@ -93,7 +93,7 @@ gnunet_dht_put_SOURCES = \
  gnunet-dht-put.c
 gnunet_dht_put_LDADD = \
   libgnunetdht.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 gnunet_dht_put_LDFLAGS = \
   $(GN_LIBINTL)
 
@@ -101,7 +101,7 @@ gnunet_dht_monitor_SOURCES = \
  gnunet-dht-monitor.c
 gnunet_dht_monitor_LDADD = \
   libgnunetdht.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 gnunet_dht_monitor_LDFLAGS = \
   $(GN_LIBINTL)
 
@@ -112,9 +112,9 @@ endif
 test_dht_api_SOURCES = \
  test_dht_api.c
 test_dht_api_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/hello/libgnunethello.la \
+ $(top_builddir)/src/lib/hello/libgnunethello.la \
  libgnunetdht.la
 
 EXTRA_DIST = \
diff --git a/src/dhtu/Makefile.am b/src/dhtu/Makefile.am
index 732b37ff7..a22a72c89 100644
--- a/src/dhtu/Makefile.am
+++ b/src/dhtu/Makefile.am
@@ -22,7 +22,7 @@ plugin_LTLIBRARIES += libgnunet_plugin_dhtu_ip.la
 libgnunet_plugin_dhtu_ip_la_SOURCES = \
   plugin_dhtu_ip.c
 libgnunet_plugin_dhtu_ip_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(XLIBS) \
   $(LTLIBINTL)
 libgnunet_plugin_dhtu_ip_la_LDFLAGS = \
@@ -36,9 +36,9 @@ libgnunet_plugin_dhtu_gnunet_la_LIBADD = \
   $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/transport/libgnunettransportapplication.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
+  $(top_builddir)/src/lib/hello/libgnunethello.la \
   $(top_builddir)/src/nse/libgnunetnse.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(XLIBS) \
   $(LTLIBINTL)
 libgnunet_plugin_dhtu_gnunet_la_LDFLAGS = \
@@ -53,7 +53,7 @@ libgnunettestingdhtu_la_SOURCES = \
 libgnunettestingdhtu_la_LIBADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
  $(top_builddir)/src/arm/libgnunetarm.la \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(LTLIBINTL)
 libgnunettestingdhtu_la_LDFLAGS = \
  $(GN_LIB_LDFLAGS) \
@@ -66,7 +66,7 @@ test_dhtu_ip_SOURCES = \
 test_dhtu_ip_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
  $(top_builddir)/src/arm/libgnunetarm.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 check_PROGRAMS = \
  test_dhtu_ip
diff --git a/src/dns/Makefile.am b/src/dns/Makefile.am
index f8672d55e..6c7462d9a 100644
--- a/src/dns/Makefile.am
+++ b/src/dns/Makefile.am
@@ -45,33 +45,33 @@ gnunet_dns_monitor_SOURCES = \
  gnunet-dns-monitor.c
 gnunet_dns_monitor_LDADD = \
   libgnunetdns.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 gnunet_zonewalk_SOURCES = \
  gnunet-zonewalk.c
 gnunet_zonewalk_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 gnunet_dns_redirector_SOURCES = \
  gnunet-dns-redirector.c
 gnunet_dns_redirector_LDADD = \
   libgnunetdns.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 gnunet_service_dns_SOURCES = \
  gnunet-service-dns.c
 gnunet_service_dns_LDADD = \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 libgnunetdns_la_SOURCES = \
  dns_api.c dns.h
 libgnunetdns_la_LIBADD = \
- $(top_builddir)/src/util/libgnunetutil.la $(XLIB)
+ $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIB)
 libgnunetdns_la_LDFLAGS = \
   $(GN_LIBINTL) \
   $(GN_LIB_LDFLAGS) \
@@ -80,9 +80,9 @@ libgnunetdns_la_LDFLAGS = \
 libgnunet_plugin_block_dns_la_SOURCES = \
   plugin_block_dns.c
 libgnunet_plugin_block_dns_la_LIBADD = \
-  $(top_builddir)/src/block/libgnunetblockgroup.la \
-  $(top_builddir)/src/block/libgnunetblock.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/block/libgnunetblockgroup.la \
+  $(top_builddir)/src/lib/block/libgnunetblock.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 libgnunet_plugin_block_dns_la_LDFLAGS = \
   $(GN_LIBINTL) \
   $(top_builddir)/src/block/$(GN_PLUGIN_LDFLAGS)
diff --git a/src/exit/Makefile.am b/src/exit/Makefile.am
index c0323d0d6..9e36a5064 100644
--- a/src/exit/Makefile.am
+++ b/src/exit/Makefile.am
@@ -32,7 +32,7 @@ gnunet_daemon_exit_SOURCES = \
 gnunet_daemon_exit_LDADD = \
   $(top_builddir)/src/dht/libgnunetdht.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/cadet/libgnunetcadet.la \
   $(top_builddir)/src/regex/libgnunetregex.la \
   $(GN_LIBINTL)
diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am
index 9a7ff0011..573063301 100644
--- a/src/fs/Makefile.am
+++ b/src/fs/Makefile.am
@@ -44,7 +44,7 @@ libgnunetfs_la_SOURCES = \
 libgnunetfs_la_LIBADD = \
   $(top_builddir)/src/datastore/libgnunetdatastore.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL) $(XLIB) $(LIBGCRYPT_LIBS) -lunistring
 
 if HAVE_LIBEXTRACTOR
@@ -77,7 +77,7 @@ gnunet_directory_SOURCES = \
  gnunet-directory.c
 gnunet_directory_LDADD = \
   libgnunetfs.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 if HAVE_LIBEXTRACTOR
@@ -89,7 +89,7 @@ gnunet_fs_SOURCES = \
  gnunet-fs.c
 gnunet_fs_LDADD = \
   libgnunetfs.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 if HAVE_LIBEXTRACTOR
@@ -101,7 +101,7 @@ gnunet_download_SOURCES =  \
  gnunet-download.c
 gnunet_download_LDADD =  \
  libgnunetfs.la \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(GN_LIBINTL)
 
 gnunet_publish_SOURCES =  \
@@ -109,7 +109,7 @@ gnunet_publish_SOURCES =  \
 gnunet_publish_LDADD =  \
  $(top_builddir)/src/identity/libgnunetidentity.la \
  libgnunetfs.la \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(GN_LIBINTL)
 
 if HAVE_LIBEXTRACTOR
@@ -120,7 +120,7 @@ endif
 gnunet_auto_share_SOURCES =  \
  gnunet-auto-share.c
 gnunet_auto_share_LDADD =  \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(GN_LIBINTL)
 
 if HAVE_LIBEXTRACTOR
@@ -132,7 +132,7 @@ gnunet_helper_fs_publish_SOURCES =  \
  gnunet-helper-fs-publish.c
 gnunet_helper_fs_publish_LDADD =  \
   libgnunetfs.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 if HAVE_LIBEXTRACTOR
@@ -144,7 +144,7 @@ gnunet_search_SOURCES = \
  gnunet-search.c
 gnunet_search_LDADD = \
   libgnunetfs.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 if HAVE_LIBEXTRACTOR
@@ -158,7 +158,7 @@ gnunet_daemon_fsprofiler_SOURCES =  \
 gnunet_daemon_fsprofiler_LDADD = \
   libgnunetfs.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 gnunet_service_fs_SOURCES =  \
@@ -174,12 +174,12 @@ gnunet_service_fs_SOURCES =  \
 gnunet_service_fs_LDADD =  \
  libgnunetfs.la \
  $(top_builddir)/src/dht/libgnunetdht.la \
- $(top_builddir)/src/block/libgnunetblock.la \
+ $(top_builddir)/src/lib/block/libgnunetblock.la \
  $(top_builddir)/src/datastore/libgnunetdatastore.la \
  $(top_builddir)/src/statistics/libgnunetstatistics.la \
  $(top_builddir)/src/cadet/libgnunetcadet.la \
  $(top_builddir)/src/core/libgnunetcore.la \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
  $(GN_LIBINTL) -lm
 
@@ -187,16 +187,16 @@ gnunet_unindex_SOURCES = \
  gnunet-unindex.c
 gnunet_unindex_LDADD = \
   libgnunetfs.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 libgnunet_plugin_block_fs_la_SOURCES = \
   plugin_block_fs.c
 libgnunet_plugin_block_fs_la_LIBADD = \
-  $(top_builddir)/src/block/libgnunetblockgroup.la \
-  $(top_builddir)/src/block/libgnunetblock.la \
+  $(top_builddir)/src/lib/block/libgnunetblockgroup.la \
+  $(top_builddir)/src/lib/block/libgnunetblock.la \
   libgnunetfs.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunet_plugin_block_fs_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -231,8 +231,8 @@ check_PROGRAMS = \
 test_plugin_block_fs_SOURCES = \
  test_plugin_block_fs.c
 test_plugin_block_fs_LDADD = \
- $(top_builddir)/src/block/libgnunetblock.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/block/libgnunetblock.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 if HAVE_PYTHON
 check_SCRIPTS = \
@@ -267,7 +267,7 @@ test_fs_directory_SOURCES = \
  test_fs_directory.c
 test_fs_directory_LDADD = \
   libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 if HAVE_LIBEXTRACTOR
 test_fs_directory_LDADD += \
@@ -280,34 +280,34 @@ test_fs_download_SOURCES = \
 test_fs_download_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la  \
   libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_fs_download_indexed_SOURCES = \
  test_fs_download.c
 test_fs_download_indexed_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la  \
   libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_fs_download_cadet_SOURCES = \
  test_fs_download.c
 test_fs_download_cadet_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la  \
   libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_fs_download_persistence_SOURCES = \
  test_fs_download_persistence.c
 test_fs_download_persistence_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la  \
   libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_fs_file_information_SOURCES = \
  test_fs_file_information.c
 test_fs_file_information_LDADD = \
   libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 if HAVE_LIBEXTRACTOR
 test_fs_file_information_LDADD += \
@@ -319,104 +319,104 @@ test_fs_getopt_SOURCES = \
  test_fs_getopt.c
 test_fs_getopt_LDADD = \
   libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_fs_list_indexed_SOURCES = \
  test_fs_list_indexed.c
 test_fs_list_indexed_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_fs_namespace_SOURCES = \
  test_fs_namespace.c
 test_fs_namespace_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_fs_namespace_list_updateable_SOURCES = \
  test_fs_namespace_list_updateable.c
 test_fs_namespace_list_updateable_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_fs_publish_SOURCES = \
  test_fs_publish.c
 test_fs_publish_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_fs_publish_persistence_SOURCES = \
  test_fs_publish_persistence.c
 test_fs_publish_persistence_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_fs_search_SOURCES = \
  test_fs_search.c
 test_fs_search_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetfs.la       \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_fs_search_with_and_SOURCES = \
  test_fs_search_with_and.c
 test_fs_search_with_and_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetfs.la       \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_fs_search_probes_SOURCES = \
  test_fs_search_probes.c
 test_fs_search_probes_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetfs.la       \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_fs_search_persistence_SOURCES = \
  test_fs_search_persistence.c
 test_fs_search_persistence_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetfs.la       \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_fs_start_stop_SOURCES = \
  test_fs_start_stop.c
 test_fs_start_stop_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_fs_unindex_SOURCES = \
  test_fs_unindex.c
 test_fs_unindex_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetfs.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_fs_unindex_persistence_SOURCES = \
  test_fs_unindex_persistence.c
 test_fs_unindex_persistence_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetfs.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_fs_meta_data_SOURCES = \
  test_fs_meta_data.c
 test_fs_meta_data_LDADD = \
  libgnunetfs.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 
 test_fs_uri_SOURCES = \
  test_fs_uri.c
 test_fs_uri_LDADD = \
   libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 # TNG
 #test_fs_test_lib_SOURCES = \
@@ -425,7 +425,7 @@ test_fs_uri_LDADD = \
 #  libgnunetfstest.a \
 #  $(top_builddir)/src/testbed/libgnunettestbed.la \
 #  libgnunetfs.la  \
-#  $(top_builddir)/src/util/libgnunetutil.la
+#  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 #test_gnunet_service_fs_p2p_SOURCES = \
 # test_gnunet_service_fs_p2p.c
@@ -433,7 +433,7 @@ test_fs_uri_LDADD = \
 #  libgnunetfstest.a \
 #  $(top_builddir)/src/testbed/libgnunettestbed.la \
 #  libgnunetfs.la  \
-#  $(top_builddir)/src/util/libgnunetutil.la
+#  $(top_builddir)/src/lib/util/libgnunetutil.la
 #
 #test_gnunet_service_fs_p2p_cadet_SOURCES = \
 # test_gnunet_service_fs_p2p.c
@@ -441,7 +441,7 @@ test_fs_uri_LDADD = \
 #  libgnunetfstest.a \
 #  $(top_builddir)/src/testbed/libgnunettestbed.la \
 #  libgnunetfs.la  \
-#  $(top_builddir)/src/util/libgnunetutil.la
+#  $(top_builddir)/src/lib/util/libgnunetutil.la
 #
 #test_gnunet_service_fs_migration_SOURCES = \
 # test_gnunet_service_fs_migration.c
@@ -449,7 +449,7 @@ test_fs_uri_LDADD = \
 #  libgnunetfstest.a \
 #  $(top_builddir)/src/testbed/libgnunettestbed.la \
 #  libgnunetfs.la  \
-#  $(top_builddir)/src/util/libgnunetutil.la
+#  $(top_builddir)/src/lib/util/libgnunetutil.la
 #
 #perf_gnunet_service_fs_p2p_SOURCES = \
 # perf_gnunet_service_fs_p2p.c
@@ -458,7 +458,7 @@ test_fs_uri_LDADD = \
 #  $(top_builddir)/src/statistics/libgnunetstatistics.la \
 #  $(top_builddir)/src/testbed/libgnunettestbed.la \
 #  libgnunetfs.la  \
-#  $(top_builddir)/src/util/libgnunetutil.la
+#  $(top_builddir)/src/lib/util/libgnunetutil.la
 #
 #perf_gnunet_service_fs_p2p_index_SOURCES = \
 # perf_gnunet_service_fs_p2p.c
@@ -467,7 +467,7 @@ test_fs_uri_LDADD = \
 #  $(top_builddir)/src/statistics/libgnunetstatistics.la \
 #  $(top_builddir)/src/testbed/libgnunettestbed.la \
 #  libgnunetfs.la  \
-#  $(top_builddir)/src/util/libgnunetutil.la
+#  $(top_builddir)/src/lib/util/libgnunetutil.la
 #
 #perf_gnunet_service_fs_p2p_dht_SOURCES = \
 # perf_gnunet_service_fs_p2p.c
@@ -476,7 +476,7 @@ test_fs_uri_LDADD = \
 #  $(top_builddir)/src/statistics/libgnunetstatistics.la \
 #  $(top_builddir)/src/testbed/libgnunettestbed.la \
 #  libgnunetfs.la  \
-#  $(top_builddir)/src/util/libgnunetutil.la
+#  $(top_builddir)/src/lib/util/libgnunetutil.la
 #
 #perf_gnunet_service_fs_p2p_respect_SOURCES = \
 # perf_gnunet_service_fs_p2p_respect.c
@@ -485,7 +485,7 @@ test_fs_uri_LDADD = \
 #  $(top_builddir)/src/statistics/libgnunetstatistics.la \
 #  $(top_builddir)/src/testbed/libgnunettestbed.la \
 #  libgnunetfs.la  \
-#  $(top_builddir)/src/util/libgnunetutil.la
+#  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_gnunet_fs_psd.py: test_gnunet_fs_psd.py.in Makefile
        $(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" 
-v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v 
pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < 
$(srcdir)/test_gnunet_fs_psd.py.in > test_gnunet_fs_psd.py
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c
index 59f16210a..7a87130de 100644
--- a/src/fs/gnunet-publish.c
+++ b/src/fs/gnunet-publish.c
@@ -476,7 +476,7 @@ uri_ksk_continuation (void *cls,
                       const char *emsg)
 {
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv;
-  const struct GNUNET_IDENTITY_PrivateKey *pk;
+  const struct GNUNET_CRYPTO_PrivateKey *pk;
 
   if (NULL != emsg)
   {
@@ -489,7 +489,7 @@ uri_ksk_continuation (void *cls,
     return;
   }
   pk = GNUNET_IDENTITY_ego_get_private_key (namespace);
-  if (GNUNET_IDENTITY_TYPE_ECDSA != ntohl (pk->type))
+  if (GNUNET_PUBLIC_KEY_TYPE_ECDSA != ntohl (pk->type))
     return;
   priv = &pk->ecdsa_key;
   GNUNET_FS_publish_sks (ctx,
@@ -574,7 +574,7 @@ directory_trim_complete (struct GNUNET_FS_ShareTreeItem 
*directory_scan_result)
 {
   struct GNUNET_FS_FileInformation *fi;
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv;
-  const struct GNUNET_IDENTITY_PrivateKey *pk;
+  const struct GNUNET_CRYPTO_PrivateKey *pk;
 
   fi = get_file_information (directory_scan_result);
   GNUNET_FS_share_tree_free (directory_scan_result);
@@ -596,7 +596,7 @@ directory_trim_complete (struct GNUNET_FS_ShareTreeItem 
*directory_scan_result)
   if (NULL != namespace)
   {
     pk = GNUNET_IDENTITY_ego_get_private_key (namespace);
-    GNUNET_assert (GNUNET_IDENTITY_TYPE_ECDSA == ntohl (pk->type));
+    GNUNET_assert (GNUNET_PUBLIC_KEY_TYPE_ECDSA == ntohl (pk->type));
     priv = &pk->ecdsa_key;
   }
   pc = GNUNET_FS_publish_start (ctx,
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am
index 0c50bc83f..b1f4e5ab8 100644
--- a/src/gns/Makefile.am
+++ b/src/gns/Makefile.am
@@ -84,13 +84,13 @@ CLEANFILES = test_gnunet_gns.sh
 libgnunet_plugin_rest_gns_la_SOURCES = \
   plugin_rest_gns.c
 libgnunet_plugin_rest_gns_la_LIBADD = \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecordjson.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecordjson.la \
   libgnunetgns.la \
   $(top_builddir)/src/rest/libgnunetrest.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(top_builddir)/src/json/libgnunetjson.la \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \
   $(LTLIBINTL) -ljansson $(MHD_LIBS)
 libgnunet_plugin_rest_gns_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -100,9 +100,9 @@ libgnunet_plugin_rest_gns_la_CFLAGS = $(MHD_CFLAGS) 
$(AM_CFLAGS)
 libgnunet_plugin_gnsrecord_gns_la_SOURCES = \
   plugin_gnsrecord_gns.c
 libgnunet_plugin_gnsrecord_gns_la_LIBADD = \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunet_plugin_gnsrecord_gns_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -112,9 +112,9 @@ gnunet_gns_SOURCES = \
  gnunet-gns.c
 gnunet_gns_LDADD = \
   libgnunetgns.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LIBIDN) $(LIBIDN2) \
   $(GN_LIBINTL)
 
@@ -122,16 +122,16 @@ gnunet_gns_benchmark_SOURCES = \
  gnunet-gns-benchmark.c
 gnunet_gns_benchmark_LDADD = \
   libgnunetgns.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 
 gnunet_bcd_SOURCES = \
  gnunet-bcd.c
 gnunet_bcd_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(GN_LIBINTL) $(MHD_LIBS)
 gnunet_bcd_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS)
@@ -140,9 +140,9 @@ gnunet_bcd_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS)
 gnunet_dns2gns_SOURCES = \
  gnunet-dns2gns.c
 gnunet_dns2gns_LDADD = \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   libgnunetgns.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(USE_VPN) \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(GN_LIBINTL)
@@ -168,7 +168,7 @@ gnunet_gns_proxy_SOURCES = \
 gnunet_gns_proxy_LDADD = $(MHD_LIBS) @LIBCURL@ -lgnutls \
   libgnunetgns.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 if HAVE_GNUTLS_DANE
 gnunet_gns_proxy_LDADD += -lgnutls-dane
@@ -178,7 +178,7 @@ gnunet_gns_proxy_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ 
$(AM_CFLAGS)
 test_gns_proxy_SOURCES = \
   test_gns_proxy.c
 test_gns_proxy_LDADD = $(MHD_LIBS) @LIBCURL@ -lgnutls \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 test_gns_proxy_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS)
 
@@ -187,8 +187,8 @@ test_gns_proxy_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ 
$(AM_CFLAGS)
 #gnunet_gns_import_LDADD = \
 #  $(top_builddir)/src/identity/libgnunetidentity.la \
 #  $(top_builddir)/src/namestore/libgnunetnamestore.la \
-#  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
-#  $(top_builddir)/src/util/libgnunetutil.la \
+#  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
+#  $(top_builddir)/src/lib/util/libgnunetutil.la \
 #  $(GN_LIBINTL)
 
 
@@ -198,11 +198,11 @@ gnunet_service_gns_SOURCES = \
  gnunet-service-gns_interceptor.c gnunet-service-gns_interceptor.h
 gnunet_service_gns_LDADD = \
   -lm \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(top_builddir)/src/revocation/libgnunetrevocation.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/dns/libgnunetdns.la \
   $(top_builddir)/src/dht/libgnunetdht.la \
   $(top_builddir)/src/namecache/libgnunetnamecache.la \
@@ -214,9 +214,9 @@ libgnunetgns_la_SOURCES = \
  gns_api.c gns_api.h \
  gns_tld_api.c gns.h
 libgnunetgns_la_LIBADD = \
- $(top_builddir)/src/util/libgnunetutil.la $(XLIB) \
+ $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIB) \
  $(top_builddir)/src/identity/libgnunetidentity.la \
- $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la
+ $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la
 libgnunetgns_la_LDFLAGS = \
   $(GN_LIBINTL) \
   $(GN_LIB_LDFLAGS)
@@ -225,11 +225,11 @@ libgnunetgns_la_LDFLAGS = \
 libgnunet_plugin_block_gns_la_SOURCES = \
   plugin_block_gns.c
 libgnunet_plugin_block_gns_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/block/libgnunetblock.la \
-  $(top_builddir)/src/block/libgnunetblockgroup.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/block/libgnunetblock.la \
+  $(top_builddir)/src/lib/block/libgnunetblockgroup.la \
   $(top_builddir)/src/identity/libgnunetidentity.la  \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la
 libgnunet_plugin_block_gns_la_LDFLAGS = \
   $(GN_LIBINTL) \
   $(GN_PLUGIN_LDFLAGS)
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c
index 2e5ddc2b7..0dc7580f9 100644
--- a/src/gns/gns_api.c
+++ b/src/gns/gns_api.c
@@ -342,7 +342,7 @@ GNUNET_GNS_lookup_cancel (struct GNUNET_GNS_LookupRequest 
*lr)
 struct GNUNET_GNS_LookupRequest *
 GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle,
                            const char *name,
-                           const struct GNUNET_IDENTITY_PublicKey *zone,
+                           const struct GNUNET_CRYPTO_PublicKey *zone,
                            uint32_t type,
                            enum GNUNET_GNS_LocalOptions options,
                            uint16_t recursion_depth_limit,
@@ -376,7 +376,7 @@ GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle,
   lr->lookup_proc = proc;
   lr->proc_cls = proc_cls;
   lr->r_id = handle->r_id_gen++;
-  key_len = GNUNET_IDENTITY_public_key_get_length (zone);
+  key_len = GNUNET_CRYPTO_public_key_get_length (zone);
   lr->env = GNUNET_MQ_msg_extra (lookup_msg,
                                  nlen + key_len,
                                  GNUNET_MESSAGE_TYPE_GNS_LOOKUP);
@@ -386,7 +386,7 @@ GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle,
   lookup_msg->recursion_depth_limit
     = htons (recursion_depth_limit);
   lookup_msg->key_len = htonl (key_len);
-  written = GNUNET_IDENTITY_write_public_key_to_buffer (zone,
+  written = GNUNET_CRYPTO_write_public_key_to_buffer (zone,
                                                         buf,
                                                         key_len);
   GNUNET_assert (0 <= written);
@@ -420,7 +420,7 @@ GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle,
 struct GNUNET_GNS_LookupRequest*
 GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
                    const char *name,
-                   const struct GNUNET_IDENTITY_PublicKey *zone,
+                   const struct GNUNET_CRYPTO_PublicKey *zone,
                    uint32_t type,
                    enum GNUNET_GNS_LocalOptions options,
                    GNUNET_GNS_LookupResultProcessor proc,
diff --git a/src/gns/gns_tld_api.c b/src/gns/gns_tld_api.c
index 78a70f14e..1ea87fd97 100644
--- a/src/gns/gns_tld_api.c
+++ b/src/gns/gns_tld_api.c
@@ -166,7 +166,7 @@ process_lookup_result (void *cls,
  */
 static void
 lookup_with_public_key (struct GNUNET_GNS_LookupWithTldRequest *ltr,
-                        const struct GNUNET_IDENTITY_PublicKey *pkey)
+                        const struct GNUNET_CRYPTO_PublicKey *pkey)
 {
   ltr->lr = GNUNET_GNS_lookup (ltr->gns_handle,
                                ltr->name,
@@ -189,11 +189,11 @@ lookup_with_public_key (struct 
GNUNET_GNS_LookupWithTldRequest *ltr,
  */
 static void
 identity_zone_cb (void *cls,
-                  const struct GNUNET_IDENTITY_PrivateKey *priv,
+                  const struct GNUNET_CRYPTO_PrivateKey *priv,
                   const char *ego_name)
 {
   struct GNUNET_GNS_LookupWithTldRequest *ltr = cls;
-  struct GNUNET_IDENTITY_PublicKey pkey;
+  struct GNUNET_CRYPTO_PublicKey pkey;
 
   ltr->id_co = NULL;
   if (NULL == priv)
@@ -218,7 +218,7 @@ identity_zone_cb (void *cls,
     ltr->options = GNUNET_GNS_LO_NO_DHT;
   else
     ltr->options = GNUNET_GNS_LO_LOCAL_MASTER;
-  GNUNET_IDENTITY_key_get_public (priv, &pkey);
+  GNUNET_CRYPTO_key_get_public (priv, &pkey);
   lookup_with_public_key (ltr, &pkey);
 }
 
@@ -248,7 +248,7 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle 
*handle,
   const char *tld;
   char *dot_tld;
   char *zonestr;
-  struct GNUNET_IDENTITY_PublicKey pkey;
+  struct GNUNET_CRYPTO_PublicKey pkey;
 
   ltr = GNUNET_new (struct GNUNET_GNS_LookupWithTldRequest);
   ltr->gns_handle = handle;
@@ -260,7 +260,7 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle 
*handle,
   /* start with trivial case: TLD is zkey */
   tld = get_tld (ltr->name);
   if (GNUNET_OK ==
-      GNUNET_IDENTITY_public_key_from_string (tld, &pkey))
+      GNUNET_CRYPTO_public_key_from_string (tld, &pkey))
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "`%s' seems to be a valid zone key\n", tld);
@@ -282,7 +282,7 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle 
*handle,
                                                             &zonestr))
     {
       if (GNUNET_OK !=
-          GNUNET_IDENTITY_public_key_from_string (zonestr,
+          GNUNET_CRYPTO_public_key_from_string (zonestr,
                                                   &pkey))
       {
         GNUNET_log_config_invalid (
diff --git a/src/gns/gnunet-bcd.c b/src/gns/gnunet-bcd.c
index 754f8ac6f..0f7fb6507 100644
--- a/src/gns/gnunet-bcd.c
+++ b/src/gns/gnunet-bcd.c
@@ -364,9 +364,9 @@ create_response (void *cls,
                                                    MHD_GET_ARGUMENT_KIND,
                                                    "gnspng");
 
-  struct GNUNET_IDENTITY_PublicKey pk;
+  struct GNUNET_CRYPTO_PublicKey pk;
   if (NULL == gnskey
-      || GNUNET_OK != GNUNET_IDENTITY_public_key_from_string (gnskey, &pk))
+      || GNUNET_OK != GNUNET_CRYPTO_public_key_from_string (gnskey, &pk))
   {
     return MHD_queue_response (connection,
                                MHD_HTTP_BAD_REQUEST,
diff --git a/src/gns/gnunet-gns-import.c b/src/gns/gnunet-gns-import.c
index e99c4d3dd..5d4602682 100644
--- a/src/gns/gnunet-gns-import.c
+++ b/src/gns/gnunet-gns-import.c
@@ -168,7 +168,7 @@ check_pkey (unsigned int rd_len, const struct 
GNUNET_GNSRECORD_Data *rd,
             char *pk, int *found_rec)
 {
   int i;
-  struct GNUNET_IDENTITY_PublicKey pubkey;
+  struct GNUNET_CRYPTO_PublicKey pubkey;
 
   for (i = 0; i < rd_len; i++)
   {
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c
index fc8de860d..aaf82a557 100644
--- a/src/gns/gnunet-service-gns.c
+++ b/src/gns/gnunet-service-gns.c
@@ -122,7 +122,7 @@ struct GNS_TopLevelDomain
   /**
    * Public key associated with the @a tld.
    */
-  struct GNUNET_IDENTITY_PublicKey pkey;
+  struct GNUNET_CRYPTO_PublicKey pkey;
 
   /**
    * Top-level domain as a string, including leading ".".
@@ -176,7 +176,7 @@ static struct GNS_TopLevelDomain *tld_tail;
  */
 int
 GNS_find_tld (const char *tld_str,
-              struct GNUNET_IDENTITY_PublicKey *pkey)
+              struct GNUNET_CRYPTO_PublicKey *pkey)
 {
   if ('\0' == *tld_str)
     return GNUNET_NO;
@@ -420,7 +420,7 @@ handle_lookup (void *cls,
 {
   struct GnsClient *gc = cls;
   struct ClientLookupHandle *clh;
-  struct GNUNET_IDENTITY_PublicKey zone;
+  struct GNUNET_CRYPTO_PublicKey zone;
   const char *name;
   size_t key_len;
   size_t read;
@@ -434,7 +434,7 @@ handle_lookup (void *cls,
   clh->gc = gc;
   clh->request_id = sh_msg->id;
   if ((GNUNET_SYSERR ==
-       GNUNET_IDENTITY_read_public_key_from_buffer (&sh_msg[1],
+       GNUNET_CRYPTO_read_public_key_from_buffer (&sh_msg[1],
                                                     key_len,
                                                     &zone,
                                                     &read)) ||
@@ -498,7 +498,7 @@ read_service_conf (void *cls,
                    const char *option,
                    const char *value)
 {
-  struct GNUNET_IDENTITY_PublicKey pk;
+  struct GNUNET_CRYPTO_PublicKey pk;
   struct GNS_TopLevelDomain *tld;
 
   (void) cls;
diff --git a/src/gns/gnunet-service-gns.h b/src/gns/gnunet-service-gns.h
index d4fb9ec9f..13e28349c 100644
--- a/src/gns/gnunet-service-gns.h
+++ b/src/gns/gnunet-service-gns.h
@@ -37,7 +37,7 @@
  */
 int
 GNS_find_tld (const char *tld_str,
-              struct GNUNET_IDENTITY_PublicKey *pkey);
+              struct GNUNET_CRYPTO_PublicKey *pkey);
 
 
 /**
diff --git a/src/gns/gnunet-service-gns_interceptor.c 
b/src/gns/gnunet-service-gns_interceptor.c
index 3358692da..f49d60b94 100644
--- a/src/gns/gnunet-service-gns_interceptor.c
+++ b/src/gns/gnunet-service-gns_interceptor.c
@@ -313,7 +313,7 @@ handle_dns_request (void *cls,
 {
   struct GNUNET_DNSPARSER_Packet *p;
   struct InterceptLookupHandle *ilh;
-  struct GNUNET_IDENTITY_PublicKey zone;
+  struct GNUNET_CRYPTO_PublicKey zone;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Hijacked a DNS request. Processing.\n");
diff --git a/src/gns/gnunet-service-gns_resolver.c 
b/src/gns/gnunet-service-gns_resolver.c
index b6a81b3a1..aa0189b15 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -164,7 +164,7 @@ struct AuthorityChain
     /**
      * The zone of the GNS authority
      */
-    struct GNUNET_IDENTITY_PublicKey gns_authority;
+    struct GNUNET_CRYPTO_PublicKey gns_authority;
 
     struct
     {
@@ -264,7 +264,7 @@ struct GNS_ResolverHandle
   /**
    * The top-level GNS authoritative zone to query
    */
-  struct GNUNET_IDENTITY_PublicKey authority_zone;
+  struct GNUNET_CRYPTO_PublicKey authority_zone;
 
   /**
    * called when resolution phase finishes
@@ -1213,7 +1213,7 @@ handle_gns_redirect_result (struct GNS_ResolverHandle *rh,
   const char *tld;
   struct AuthorityChain *ac;
   int af;
-  struct GNUNET_IDENTITY_PublicKey zone;
+  struct GNUNET_CRYPTO_PublicKey zone;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Handling GNS REDIRECT result `%s'\n",
@@ -1644,7 +1644,7 @@ recursive_pkey_resolution (struct GNS_ResolverHandle *rh,
                            const struct GNUNET_GNSRECORD_Data *rd)
 {
   struct AuthorityChain *ac;
-  struct GNUNET_IDENTITY_PublicKey auth;
+  struct GNUNET_CRYPTO_PublicKey auth;
 
   /* delegation to another zone */
   if (GNUNET_OK != GNUNET_GNSRECORD_identity_from_data (rd->data,
@@ -1703,7 +1703,7 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle 
*rh,
     char *n;
     size_t off;
     struct Gns2DnsPending *gp;
-    struct GNUNET_IDENTITY_PublicKey zone;
+    struct GNUNET_CRYPTO_PublicKey zone;
     struct sockaddr_in v4;
     struct sockaddr_in6 v6;
 
@@ -2173,7 +2173,7 @@ handle_gns_resolution_result (void *cls,
       case GNUNET_GNSRECORD_TYPE_PKEY:
       case GNUNET_GNSRECORD_TYPE_EDKEY:
         {
-          struct GNUNET_IDENTITY_PublicKey pubkey;
+          struct GNUNET_CRYPTO_PublicKey pubkey;
           if (rd[i].data_size < sizeof(uint32_t))
           {
             GNUNET_break_op (0);
@@ -2530,7 +2530,7 @@ handle_namecache_block_response (void *cls,
   struct GNS_ResolverHandle *rh = cls;
   struct AuthorityChain *ac = rh->ac_tail;
   const char *label = ac->label;
-  const struct GNUNET_IDENTITY_PublicKey *auth =
+  const struct GNUNET_CRYPTO_PublicKey *auth =
     &ac->authority_info.gns_authority;
   struct GNUNET_HashCode query;
 
@@ -2790,7 +2790,7 @@ start_resolver_lookup (void *cls)
  * @return handle to cancel operation
  */
 struct GNS_ResolverHandle *
-GNS_resolver_lookup (const struct GNUNET_IDENTITY_PublicKey *zone,
+GNS_resolver_lookup (const struct GNUNET_CRYPTO_PublicKey *zone,
                      uint32_t record_type,
                      const char *name,
                      enum GNUNET_GNS_LocalOptions options,
diff --git a/src/gns/gnunet-service-gns_resolver.h 
b/src/gns/gnunet-service-gns_resolver.h
index b099c5d65..908af58e7 100644
--- a/src/gns/gnunet-service-gns_resolver.h
+++ b/src/gns/gnunet-service-gns_resolver.h
@@ -86,7 +86,7 @@ typedef void
  * @return handle to cancel operation
  */
 struct GNS_ResolverHandle *
-GNS_resolver_lookup (const struct GNUNET_IDENTITY_PublicKey *zone,
+GNS_resolver_lookup (const struct GNUNET_CRYPTO_PublicKey *zone,
                      uint32_t record_type,
                      const char *name,
                      enum GNUNET_GNS_LocalOptions options,
diff --git a/src/gns/plugin_gnsrecord_gns.c b/src/gns/plugin_gnsrecord_gns.c
index 7c1c9b2e6..65587172d 100644
--- a/src/gns/plugin_gnsrecord_gns.c
+++ b/src/gns/plugin_gnsrecord_gns.c
@@ -49,7 +49,7 @@ gns_value_to_string (void *cls,
                      size_t data_size)
 {
   const char *cdata;
-  struct GNUNET_IDENTITY_PublicKey pk;
+  struct GNUNET_CRYPTO_PublicKey pk;
 
   switch (type)
   {
@@ -61,7 +61,7 @@ gns_value_to_string (void *cls,
                                              type,
                                              &pk))
       return NULL;
-    return GNUNET_IDENTITY_public_key_to_string (&pk);
+    return GNUNET_CRYPTO_public_key_to_string (&pk);
 
   case GNUNET_GNSRECORD_TYPE_NICK:
   case GNUNET_GNSRECORD_TYPE_REDIRECT:
@@ -160,7 +160,7 @@ gns_string_to_value (void *cls,
                      void **data,
                      size_t *data_size)
 {
-  struct GNUNET_IDENTITY_PublicKey pk;
+  struct GNUNET_CRYPTO_PublicKey pk;
   uint32_t record_type;
 
   if (NULL == s)
@@ -170,14 +170,14 @@ gns_string_to_value (void *cls,
   case GNUNET_GNSRECORD_TYPE_PKEY:
   case GNUNET_GNSRECORD_TYPE_EDKEY:
     if (GNUNET_OK !=
-        GNUNET_IDENTITY_public_key_from_string (s, &pk))
+        GNUNET_CRYPTO_public_key_from_string (s, &pk))
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                   _ ("Unable to parse zone key record `%s'\n"),
                   s);
       return GNUNET_SYSERR;
     }
-    *data_size = GNUNET_IDENTITY_public_key_get_length (&pk);
+    *data_size = GNUNET_CRYPTO_public_key_get_length (&pk);
     if (GNUNET_OK !=
         GNUNET_GNSRECORD_data_from_identity (&pk,
                                              (char **) data,
diff --git a/src/hello/gnunet-hello.c b/src/hello/gnunet-hello.c
deleted file mode 100644
index 302800598..000000000
--- a/src/hello/gnunet-hello.c
+++ /dev/null
@@ -1,427 +0,0 @@
-/*
-     This file is part of GNUnet
-     Copyright (C) 2012 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 hello/gnunet-hello.c
- * @brief change HELLO files to never expire
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_protocols.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_hello_uri_lib.h"
-#include "gnunet_transport_plugin.h"
-
-/**
- * Closure for #add_to_buf().
- */
-struct AddContext
-{
-  /**
-   * Where to add.
-   */
-  char *buf;
-
-  /**
-   * Maximum number of bytes left
-   */
-  size_t max;
-
-  /**
-   * Number of bytes added so far.
-   */
-  size_t ret;
-
-  struct GNUNET_HELLO_Builder *builder;
-};
-
-/**
- * Entry in doubly-linked list of all of our plugins.
- */
-struct TransportPlugin
-{
-  /**
-   * This is a doubly-linked list.
-   */
-  struct TransportPlugin *next;
-
-  /**
-   * This is a doubly-linked list.
-   */
-  struct TransportPlugin *prev;
-
-  /**
-   * API of the transport as returned by the plugin's
-   * initialization function.
-   */
-  struct GNUNET_TRANSPORT_PluginFunctions *api;
-
-  /**
-   * Short name for the plugin (e.g. "tcp").
-   */
-  char *short_name;
-
-  /**
-   * Name of the library (e.g. "gnunet_plugin_transport_tcp").
-   */
-  char *lib_name;
-
-  /**
-   * Environment this transport service is using
-   * for this plugin.
-   */
-  struct GNUNET_TRANSPORT_PluginEnvironment env;
-};
-
-static int address_count;
-
-/**
- * Our private key.
- */
-static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key;
-
-/**
- * Local peer own ID.
- */
-struct GNUNET_PeerIdentity my_full_id;
-
-/**
- * The file with hello in old style which we like to replace with the new one.
- */
-static char *hello_file;
-
-/**
- * Head of DLL of all loaded plugins.
- */
-static struct TransportPlugin *plugins_head;
-
-/**
- * Head of DLL of all loaded plugins.
- */
-static struct TransportPlugin *plugins_tail;
-
-static void
-plugins_load (const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  struct TransportPlugin *plug;
-  struct TransportPlugin *next;
-  char *libname;
-  char *plugs;
-  char *pos;
-
-  if (NULL != plugins_head)
-    return; /* already loaded */
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_string (cfg, "TRANSPORT", "PLUGINS",
-                                             &plugs))
-    return;
-  fprintf (stdout,"Starting transport plugins `%s'\n",
-              plugs);
-  for (pos = strtok (plugs, " "); pos != NULL; pos = strtok (NULL, " "))
-  {
-    fprintf (stdout,"Loading `%s' transport plugin\n",
-                pos);
-    GNUNET_asprintf (&libname, "libgnunet_plugin_transport_%s", pos);
-    plug = GNUNET_new (struct TransportPlugin);
-    plug->short_name = GNUNET_strdup (pos);
-    plug->lib_name = libname;
-    plug->env.cfg = cfg;
-    plug->env.cls = plug->short_name;
-    GNUNET_CONTAINER_DLL_insert (plugins_head, plugins_tail, plug);
-  }
-  GNUNET_free (plugs);
-  next = plugins_head;
-  while (next != NULL)
-  {
-    plug = next;
-    next = plug->next;
-    plug->api = GNUNET_PLUGIN_load (plug->lib_name, &plug->env);
-    if (plug->api == NULL)
-    {
-      fprintf (stdout,"Failed to load transport plugin for `%s'\n",
-                  plug->lib_name);
-      GNUNET_CONTAINER_DLL_remove (plugins_head, plugins_tail, plug);
-      GNUNET_free (plug->short_name);
-      GNUNET_free (plug->lib_name);
-      GNUNET_free (plug);
-    }
-  }
-}
-
-
-static int
-add_to_builder (void *cls,
-            const struct GNUNET_HELLO_Address *address,
-            struct GNUNET_TIME_Absolute expiration)
-{
-  struct GNUNET_HELLO_Builder *builder= cls;
-  struct TransportPlugin *pos = plugins_head;
-  const char *addr;
-  char *uri;
-
-  while (NULL != pos)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "short_name: %s transport_name: %s\n",
-                pos->short_name,
-              address->transport_name);
-    if (0 == strcmp (address->transport_name, pos->short_name))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "short_name: %s transport_name: %s are the same\n",
-                  pos->short_name,
-              address->transport_name);
-      addr = strchr (strchr (pos->api->address_to_string (pos, address, 
address->address_length), '.')+1, '.') + 1;
-    }
-    pos = pos->next;
-  }
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Hello address string: %s\n",
-              addr);
-  GNUNET_asprintf (&uri, "%s://%s", address->transport_name, addr);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Hello address uri string: %s\n",
-              uri);
-  GNUNET_HELLO_builder_add_address (builder,
-                                    uri);
-}
-
-
-/**
- * Add the given address with infinite expiration to the buffer.
- *
- * @param cls closure
- * @param address address to add
- * @param expiration old expiration
- * @return #GNUNET_OK keep iterating
- */
-static int
-add_to_buf (void *cls,
-            const struct GNUNET_HELLO_Address *address,
-            struct GNUNET_TIME_Absolute expiration)
-{
-  struct AddContext *ac = cls;
-  size_t ret;
-
-  ret = GNUNET_HELLO_add_address (address,
-                                  GNUNET_TIME_UNIT_FOREVER_ABS,
-                                  ac->buf,
-                                  ac->max);
-
-  ac->buf += ret;
-  ac->max -= ret;
-  ac->ret += ret;
-  address_count++;
-  return GNUNET_OK;
-}
-
-
-/**
- * Add addresses from the address list to the HELLO.
- *
- * @param cls the HELLO with the addresses to add
- * @param max maximum space available
- * @param buf where to add the addresses
- * @return number of bytes added, 0 to terminate
- */
-static ssize_t
-add_from_hello (void *cls, size_t max, void *buf)
-{
-  struct GNUNET_HELLO_Message **orig = cls;
-  struct AddContext ac;
-
-  if (NULL == *orig)
-    return GNUNET_SYSERR; /* already done */
-  ac.buf = buf;
-  ac.max = max;
-  ac.ret = 0;
-  GNUNET_assert (
-    NULL ==
-    GNUNET_HELLO_iterate_addresses (*orig, GNUNET_NO, &add_to_buf, &ac));
-  *orig = NULL;
-  return ac.ret;
-}
-
-
-/**
- * Main function that will be run without the scheduler.
- *
- * @param cls closure
- * @param args remaining command-line arguments
- * @param cfgfile name of the configuration file used (for saving, can be 
NULL!)
- * @param c configuration
- */
-static void
-run (void *cls,
-     char *const *args,
-     const char *cfgfile,
-     const struct GNUNET_CONFIGURATION_Handle *c)
-{
-  struct GNUNET_DISK_FileHandle *fh;
-  struct GNUNET_HELLO_Message *orig;
-  struct GNUNET_HELLO_Message *result;
-  struct GNUNET_PeerIdentity pid;
-  uint64_t fsize;
-  ssize_t size_written;
-  struct GNUNET_HELLO_Builder *builder;
-  char *url;
-  const struct GNUNET_MessageHeader *msg;
-  struct GNUNET_MQ_Envelope *env;
-
-  plugins_load (c);
-  address_count = 0;
-
-  my_private_key =
-    GNUNET_CRYPTO_eddsa_key_create_from_configuration (c);
-  GNUNET_CRYPTO_eddsa_key_get_public (my_private_key,
-                                      &my_full_id.public_key);
-  fprintf (stdout,"We are peer %s\n", GNUNET_i2s (&my_full_id));
-
-  GNUNET_log_setup ("gnunet-hello", "DEBUG", NULL);
-
-  if (GNUNET_OK !=
-      GNUNET_DISK_file_size (hello_file, &fsize, GNUNET_YES, GNUNET_YES))
-  {
-    fprintf (stderr,
-             _ ("Error accessing file `%s': %s\n"),
-             hello_file,
-             strerror (errno));
-    return;
-  }
-  if (fsize > 65536)
-  {
-    fprintf (stderr, _ ("File `%s' is too big to be a HELLO\n"), hello_file);
-    return;
-  }
-  if (fsize < sizeof(struct GNUNET_MessageHeader))
-  {
-    fprintf (stderr, _ ("File `%s' is too small to be a HELLO\n"), hello_file);
-    return;
-  }
-  fh = GNUNET_DISK_file_open (hello_file,
-                              GNUNET_DISK_OPEN_READ,
-                              GNUNET_DISK_PERM_USER_READ);
-  if (NULL == fh)
-  {
-    fprintf (stderr,
-             _ ("Error opening file `%s': %s\n"),
-             hello_file,
-             strerror (errno));
-    return;
-  }
-  {
-    char buf[fsize] GNUNET_ALIGN;
-
-    GNUNET_assert (fsize == GNUNET_DISK_file_read (fh, buf, fsize));
-    GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fh));
-    orig = (struct GNUNET_HELLO_Message *) buf;
-    if ((fsize < GNUNET_HELLO_size (orig)) ||
-        (GNUNET_OK != GNUNET_HELLO_get_id (orig, &pid)))
-    {
-      fprintf (stderr,
-               _ ("Did not find well-formed HELLO in file `%s'\n"),
-               hello_file);
-      return;
-    }
-    {
-      char *pids;
-
-      pids = GNUNET_CRYPTO_eddsa_public_key_to_string (&pid.public_key);
-      fprintf (stdout, "Processing HELLO for peer `%s'\n", pids);
-      GNUNET_free (pids);
-    }
-    /* result = GNUNET_HELLO_create (&pid.public_key, */
-    /*                               &add_from_hello, */
-    /*                               &orig, */
-    /*                               GNUNET_HELLO_is_friend_only (orig)); */
-
-    builder = GNUNET_HELLO_builder_new (&pid);
-    GNUNET_assert (
-    NULL ==
-    GNUNET_HELLO_iterate_addresses ((const struct GNUNET_HELLO_Message *) 
orig, GNUNET_NO, &add_to_builder, builder));
-    url = GNUNET_HELLO_builder_to_url (builder, my_private_key);
-    fprintf (stdout,"url: %s\n", url);
-    env = GNUNET_HELLO_builder_to_env (builder,
-                                 my_private_key,
-                                 GNUNET_TIME_UNIT_ZERO);
-    msg = GNUNET_MQ_env_get_msg (env);
-    //GNUNET_assert (NULL != result);
-    GNUNET_assert (NULL != msg);
-    fh =
-      GNUNET_DISK_file_open (hello_file,
-                             GNUNET_DISK_OPEN_WRITE | 
GNUNET_DISK_OPEN_TRUNCATE,
-                             GNUNET_DISK_PERM_USER_READ
-                             | GNUNET_DISK_PERM_USER_WRITE);
-    if (NULL == fh)
-    {
-      fprintf (stderr,
-               _ ("Error opening file `%s': %s\n"),
-               hello_file,
-               strerror (errno));
-      GNUNET_free (result);
-      return;
-    }
-    //fsize = GNUNET_HELLO_size (result);
-    size_written = GNUNET_DISK_file_write (fh, msg, ntohs (msg->size));
-    if (ntohs (msg->size) != size_written)
-    {
-      fprintf (stderr,
-               _ ("Error writing HELLO to file `%s': %s expected size %u size 
written %u\n"),
-               hello_file,
-               strerror (errno));
-      (void) GNUNET_DISK_file_close (fh);
-      return;
-    }
-    GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fh));
-  }
-  fprintf (stderr,
-           _ ("Modified %u addresses, wrote %u bytes\n"),
-           address_count,
-           (unsigned int) ntohs (msg->size));
-  GNUNET_HELLO_builder_free (builder);
-}
-
-
-int
-main (int argc, char *argv[])
-{
-  struct GNUNET_GETOPT_CommandLineOption options[] =
-  { GNUNET_GETOPT_option_string ('h',
-                               "hello-file",
-                               "HELLO_FILE",
-                               gettext_noop ("Hello file to read"),
-                               &hello_file),
-    GNUNET_GETOPT_OPTION_END };
-  int ret;
-
-  ret = (GNUNET_OK ==
-         GNUNET_PROGRAM_run2 (argc,
-                             argv,
-                             "gnunet-peerinfo",
-                             gettext_noop ("Print information about peers."),
-                             options,
-                             &run,
-                             NULL,
-                             GNUNET_YES));
-  return ret;
-}
-
-
-/* end of gnunet-hello.c */
diff --git a/src/hostlist/Makefile.am b/src/hostlist/Makefile.am
index 1fdab4a3d..c03e5bab2 100644
--- a/src/hostlist/Makefile.am
+++ b/src/hostlist/Makefile.am
@@ -27,10 +27,10 @@ gnunet_daemon_hostlist_SOURCES = \
 
 gnunet_daemon_hostlist_LDADD = \
   $(top_builddir)/src/core/libgnunetcore.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
+  $(top_builddir)/src/lib/hello/libgnunethello.la \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBMHD) \
   @LIBCURL@ \
   $(GN_LIBINTL)
@@ -55,13 +55,13 @@ endif
 # test_gnunet_daemon_hostlist.c
 #test_gnunet_daemon_hostlist_LDADD = \
 #  $(top_builddir)/src/transport/libgnunettransport.la \
-#  $(top_builddir)/src/util/libgnunetutil.la
+#  $(top_builddir)/src/lib/util/libgnunetutil.la
 #
 #test_gnunet_daemon_hostlist_reconnect_SOURCES = \
 # test_gnunet_daemon_hostlist_reconnect.c
 #test_gnunet_daemon_hostlist_reconnect_LDADD = \
 #  $(top_builddir)/src/transport/libgnunettransport.la \
-#  $(top_builddir)/src/util/libgnunetutil.la
+#  $(top_builddir)/src/lib/util/libgnunetutil.la
 #
 #test_gnunet_daemon_hostlist_learning_SOURCES = \
 # test_gnunet_daemon_hostlist_learning.c
@@ -69,7 +69,7 @@ endif
 #  $(top_builddir)/src/transport/libgnunettransport.la \
 #  $(top_builddir)/src/core/libgnunetcore.la \
 #  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-#  $(top_builddir)/src/util/libgnunetutil.la
+#  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 EXTRA_DIST = \
   test_hostlist_defaults.conf \
diff --git a/src/identity/Makefile.am b/src/identity/Makefile.am
index fecfaea47..bd9712da3 100644
--- a/src/identity/Makefile.am
+++ b/src/identity/Makefile.am
@@ -26,7 +26,7 @@ libgnunet_plugin_rest_identity_la_SOURCES = \
 libgnunet_plugin_rest_identity_la_LIBADD = \
   libgnunetidentity.la \
   $(top_builddir)/src/rest/libgnunetrest.la \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \
   $(LTLIBINTL) -ljansson $(MHD_LIBS)
 libgnunet_plugin_rest_identity_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -39,7 +39,7 @@ libgnunetidentity_la_SOURCES = \
   identity_api_suffix_lookup.c \
   identity.h
 libgnunetidentity_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL) $(XLIB)
 libgnunetidentity_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)   \
@@ -57,7 +57,7 @@ gnunet_service_identity_SOURCES = \
 gnunet_service_identity_LDADD = \
   libgnunetidentity.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 
@@ -66,7 +66,7 @@ gnunet_identity_SOURCES = \
 gnunet_identity_LDADD = \
   libgnunetidentity.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 check_PROGRAMS = \
@@ -86,7 +86,7 @@ test_identity_SOURCES = \
 test_identity_LDADD = \
   libgnunetidentity.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 EXTRA_DIST = \
   test_identity.conf \
diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c
index 7adc86eb8..9fe4ccc51 100644
--- a/src/identity/gnunet-identity.c
+++ b/src/identity/gnunet-identity.c
@@ -123,7 +123,7 @@ static struct GNUNET_IDENTITY_Operation *delete_op;
 /**
  * Private key from command line option, or NULL.
  */
-struct GNUNET_IDENTITY_PrivateKey pk;
+struct GNUNET_CRYPTO_PrivateKey pk;
 
 /**
  * Value to return from #main().
@@ -213,7 +213,7 @@ delete_finished (void *cls,
  */
 static void
 create_finished (void *cls,
-                 const struct GNUNET_IDENTITY_PrivateKey *pk,
+                 const struct GNUNET_CRYPTO_PrivateKey *pk,
                  enum GNUNET_ErrorCode ec)
 {
   struct GNUNET_IDENTITY_Operation **op = cls;
@@ -228,16 +228,16 @@ create_finished (void *cls,
   }
   else if (verbose)
   {
-    struct GNUNET_IDENTITY_PublicKey pub;
+    struct GNUNET_CRYPTO_PublicKey pub;
     char *pubs;
 
-    GNUNET_IDENTITY_key_get_public (pk, &pub);
-    pubs = GNUNET_IDENTITY_public_key_to_string (&pub);
+    GNUNET_CRYPTO_key_get_public (pk, &pub);
+    pubs = GNUNET_CRYPTO_public_key_to_string (&pub);
     if (private_keys)
     {
       char *privs;
 
-      privs = GNUNET_IDENTITY_private_key_to_string (pk);
+      privs = GNUNET_CRYPTO_private_key_to_string (pk);
       fprintf (stdout, "%s - %s\n", pubs, privs);
       GNUNET_free (privs);
     }
@@ -258,15 +258,15 @@ create_finished (void *cls,
 static void
 write_encrypted_message (void)
 {
-  struct GNUNET_IDENTITY_PublicKey recipient;
+  struct GNUNET_CRYPTO_PublicKey recipient;
   size_t ct_len = strlen (write_msg) + 1
-                  + GNUNET_IDENTITY_ENCRYPT_OVERHEAD_BYTES;
+                  + GNUNET_CRYPTO_ENCRYPT_OVERHEAD_BYTES;
   unsigned char ct[ct_len];
-  if (GNUNET_IDENTITY_public_key_from_string (pubkey_msg, &recipient) !=
+  if (GNUNET_CRYPTO_public_key_from_string (pubkey_msg, &recipient) !=
       GNUNET_SYSERR)
   {
     size_t msg_len = strlen (write_msg) + 1;
-    if (GNUNET_OK == GNUNET_IDENTITY_encrypt (write_msg,
+    if (GNUNET_OK == GNUNET_CRYPTO_encrypt (write_msg,
                                               msg_len,
                                               &recipient,
                                               ct, ct_len))
@@ -309,7 +309,7 @@ read_encrypted_message (struct GNUNET_IDENTITY_Ego *ego)
                                                         deserialized_msg,
                                                         &msg_len))
   {
-    if (GNUNET_OK == GNUNET_IDENTITY_decrypt (deserialized_msg,
+    if (GNUNET_OK == GNUNET_CRYPTO_decrypt (deserialized_msg,
                                               msg_len,
                                               
GNUNET_IDENTITY_ego_get_private_key (
                                                 ego),
@@ -373,7 +373,7 @@ print_ego (void *cls,
            void **ctx,
            const char *identifier)
 {
-  struct GNUNET_IDENTITY_PublicKey pk;
+  struct GNUNET_CRYPTO_PublicKey pk;
   char *s;
   char *privs;
 
@@ -405,8 +405,8 @@ print_ego (void *cls,
                      set_ego)) )
     return;
   GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
-  s = GNUNET_IDENTITY_public_key_to_string (&pk);
-  privs = GNUNET_IDENTITY_private_key_to_string (
+  s = GNUNET_CRYPTO_public_key_to_string (&pk);
+  privs = GNUNET_CRYPTO_private_key_to_string (
     GNUNET_IDENTITY_ego_get_private_key (ego));
   if ((NULL != read_msg) && (NULL != set_ego))
   {
@@ -429,12 +429,12 @@ print_ego (void *cls,
       if (private_keys)
         fprintf (stdout, "%s - %s - %s - %s\n",
                  identifier, s, privs,
-                 (ntohl (pk.type) == GNUNET_IDENTITY_TYPE_ECDSA) ?
+                 (ntohl (pk.type) == GNUNET_PUBLIC_KEY_TYPE_ECDSA) ?
                  "ECDSA" : "EdDSA");
       else
         fprintf (stdout, "%s - %s - %s\n",
                  identifier, s,
-                 (ntohl (pk.type) == GNUNET_IDENTITY_TYPE_ECDSA) ?
+                 (ntohl (pk.type) == GNUNET_PUBLIC_KEY_TYPE_ECDSA) ?
                  "ECDSA" : "EdDSA");
 
     }
@@ -497,7 +497,7 @@ run (void *cls,
                                      strlen (privkey_ego),
                                      &pk,
                                      sizeof(struct
-                                            GNUNET_IDENTITY_PrivateKey));
+                                            GNUNET_CRYPTO_PrivateKey));
       create_op =
         GNUNET_IDENTITY_create (sh,
                                 create_ego,
@@ -512,8 +512,8 @@ run (void *cls,
                                 create_ego,
                                 NULL,
                                 (type_eddsa) ?
-                                GNUNET_IDENTITY_TYPE_EDDSA :
-                                GNUNET_IDENTITY_TYPE_ECDSA,
+                                GNUNET_PUBLIC_KEY_TYPE_EDDSA :
+                                GNUNET_PUBLIC_KEY_TYPE_ECDSA,
                                 &create_finished,
                                 &create_op);
   }
diff --git a/src/identity/gnunet-service-identity.c 
b/src/identity/gnunet-service-identity.c
index 07296a882..7ac4bf2b9 100644
--- a/src/identity/gnunet-service-identity.c
+++ b/src/identity/gnunet-service-identity.c
@@ -57,7 +57,7 @@ struct Ego
   /**
    * Private key of the ego.
    */
-  struct GNUNET_IDENTITY_PrivateKey pk;
+  struct GNUNET_CRYPTO_PrivateKey pk;
 
   /**
    * String identifier for the ego.
@@ -238,7 +238,7 @@ create_update_message (struct Ego *ego)
   size_t name_len;
   ssize_t key_len;
 
-  key_len = GNUNET_IDENTITY_private_key_get_length (&ego->pk);
+  key_len = GNUNET_CRYPTO_private_key_get_length (&ego->pk);
   name_len = (NULL == ego->identifier) ? 0 : (strlen (ego->identifier) + 1);
   env = GNUNET_MQ_msg_extra (um, name_len + key_len,
                              GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
@@ -246,7 +246,7 @@ create_update_message (struct Ego *ego)
   um->end_of_list = htons (GNUNET_NO);
   um->key_len = htons (key_len);
   GNUNET_memcpy (&um[1], ego->identifier, name_len);
-  GNUNET_IDENTITY_write_private_key_to_buffer (&ego->pk,
+  GNUNET_CRYPTO_write_private_key_to_buffer (&ego->pk,
                                                ((char*) &um[1]) + name_len,
                                                key_len);
   return env;
@@ -422,7 +422,7 @@ notify_listeners (struct Ego *ego)
   ssize_t key_len;
 
   name_len = (NULL == ego->identifier) ? 0 : (strlen (ego->identifier) + 1);
-  key_len = GNUNET_IDENTITY_private_key_get_length (&ego->pk);
+  key_len = GNUNET_CRYPTO_private_key_get_length (&ego->pk);
   um = GNUNET_malloc (sizeof(struct UpdateMessage) + name_len + key_len);
   um->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
   um->header.size = htons (sizeof(struct UpdateMessage) + name_len + key_len);
@@ -430,7 +430,7 @@ notify_listeners (struct Ego *ego)
   um->end_of_list = htons (GNUNET_NO);
   um->key_len = htons (key_len);
   GNUNET_memcpy (&um[1], ego->identifier, name_len);
-  GNUNET_IDENTITY_write_private_key_to_buffer (&ego->pk,
+  GNUNET_CRYPTO_write_private_key_to_buffer (&ego->pk,
                                                ((char*) &um[1]) + name_len,
                                                key_len);
   GNUNET_notification_context_broadcast (nc, &um->header, GNUNET_NO);
@@ -487,7 +487,7 @@ static void
 handle_create_message (void *cls,
                        const struct CreateRequestMessage *crm)
 {
-  struct GNUNET_IDENTITY_PrivateKey private_key;
+  struct GNUNET_CRYPTO_PrivateKey private_key;
   struct GNUNET_SERVICE_Client *client = cls;
   struct Ego *ego;
   char *str;
@@ -498,7 +498,7 @@ handle_create_message (void *cls,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREATE message from 
client\n");
   key_len = ntohs (crm->key_len);
   if ((GNUNET_SYSERR ==
-      GNUNET_IDENTITY_read_private_key_from_buffer (&crm[1],
+      GNUNET_CRYPTO_read_private_key_from_buffer (&crm[1],
                                                     key_len,
                                                     &private_key,
                                                     &kb_read)) ||
@@ -531,7 +531,7 @@ handle_create_message (void *cls,
   if (GNUNET_OK !=
       GNUNET_DISK_fn_write (fn,
                             &private_key,
-                            sizeof(struct GNUNET_IDENTITY_PrivateKey),
+                            sizeof(struct GNUNET_CRYPTO_PrivateKey),
                             GNUNET_DISK_PERM_USER_READ
                             | GNUNET_DISK_PERM_USER_WRITE))
     GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", fn);
diff --git a/src/identity/identity.h b/src/identity/identity.h
index a3193ca2a..acb403736 100644
--- a/src/identity/identity.h
+++ b/src/identity/identity.h
@@ -43,12 +43,12 @@ struct GNUNET_IDENTITY_Ego
   /**
    * The identity key pair
    */
-  struct GNUNET_IDENTITY_PublicKey pub;
+  struct GNUNET_CRYPTO_PublicKey pub;
 
   /**
    * The identity key pair
    */
-  struct GNUNET_IDENTITY_PrivateKey pk;
+  struct GNUNET_CRYPTO_PrivateKey pk;
 
   /**
    * Current name associated with this ego.
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c
index 3a9258aa4..fe789d643 100644
--- a/src/identity/identity_api.c
+++ b/src/identity/identity_api.c
@@ -75,7 +75,7 @@ struct GNUNET_IDENTITY_Operation
   /**
    * Private key to return to @e create_cont, or NULL.
    */
-  struct GNUNET_IDENTITY_PrivateKey pk;
+  struct GNUNET_CRYPTO_PrivateKey pk;
 
   /**
    * Continuation to invoke with the result of the transmission for
@@ -162,10 +162,10 @@ GNUNET_IDENTITY_ego_get_anonymous ()
 
   if (setup)
     return &anon;
-  anon.pk.type = htonl (GNUNET_IDENTITY_TYPE_ECDSA);
-  anon.pub.type = htonl (GNUNET_IDENTITY_TYPE_ECDSA);
+  anon.pk.type = htonl (GNUNET_PUBLIC_KEY_TYPE_ECDSA);
+  anon.pub.type = htonl (GNUNET_PUBLIC_KEY_TYPE_ECDSA);
   anon.pk.ecdsa_key = *GNUNET_CRYPTO_ecdsa_key_get_anonymous ();
-  key_len = GNUNET_IDENTITY_private_key_get_length (&anon.pk);
+  key_len = GNUNET_CRYPTO_private_key_get_length (&anon.pk);
   GNUNET_assert (0 < key_len);
   GNUNET_CRYPTO_hash (&anon.pk,
                       key_len,
@@ -175,50 +175,6 @@ GNUNET_IDENTITY_ego_get_anonymous ()
 }
 
 
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_key_get_public (const struct
-                                GNUNET_IDENTITY_PrivateKey *privkey,
-                                struct GNUNET_IDENTITY_PublicKey *key)
-{
-  key->type = privkey->type;
-  switch (ntohl (privkey->type))
-  {
-  case GNUNET_IDENTITY_TYPE_ECDSA:
-    GNUNET_CRYPTO_ecdsa_key_get_public (&privkey->ecdsa_key,
-                                        &key->ecdsa_key);
-    break;
-  case GNUNET_IDENTITY_TYPE_EDDSA:
-    GNUNET_CRYPTO_eddsa_key_get_public (&privkey->eddsa_key,
-                                        &key->eddsa_key);
-    break;
-  default:
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-static enum GNUNET_GenericReturnValue
-private_key_create (enum GNUNET_IDENTITY_KeyType ktype,
-                    struct GNUNET_IDENTITY_PrivateKey *key)
-{
-  key->type = htonl (ktype);
-  switch (ktype)
-  {
-  case GNUNET_IDENTITY_TYPE_ECDSA:
-    GNUNET_CRYPTO_ecdsa_key_create (&key->ecdsa_key);
-    break;
-  case GNUNET_IDENTITY_TYPE_EDDSA:
-    GNUNET_CRYPTO_eddsa_key_create (&key->eddsa_key);
-    break;
-  default:
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
 
 /**
  * Try again to connect to the identity service.
@@ -399,7 +355,7 @@ handle_identity_update (void *cls,
   size_t kb_read;
   struct GNUNET_HashCode id;
   struct GNUNET_IDENTITY_Ego *ego;
-  struct GNUNET_IDENTITY_PrivateKey private_key;
+  struct GNUNET_CRYPTO_PrivateKey private_key;
   const char *tmp;
 
   if (GNUNET_YES == ntohs (um->end_of_list))
@@ -414,13 +370,13 @@ handle_identity_update (void *cls,
   memset (&private_key, 0, sizeof (private_key));
   key_len = ntohs (um->key_len);
   GNUNET_assert (GNUNET_SYSERR !=
-                 GNUNET_IDENTITY_read_private_key_from_buffer (tmp + name_len,
+                 GNUNET_CRYPTO_read_private_key_from_buffer (tmp + name_len,
                                                                key_len,
                                                                &private_key,
                                                                &kb_read));
-  GNUNET_assert (0 <= GNUNET_IDENTITY_private_key_get_length (&private_key));
+  GNUNET_assert (0 <= GNUNET_CRYPTO_private_key_get_length (&private_key));
   GNUNET_CRYPTO_hash (&private_key,
-                      GNUNET_IDENTITY_private_key_get_length (&private_key),
+                      GNUNET_CRYPTO_private_key_get_length (&private_key),
                       &id);
   ego = GNUNET_CONTAINER_multihashmap_get (h->egos,
                                            &id);
@@ -550,19 +506,19 @@ GNUNET_IDENTITY_connect (const struct 
GNUNET_CONFIGURATION_Handle *cfg,
 }
 
 
+
 /**
  * Obtain the ECC key associated with a ego.
  *
  * @param ego the ego
  * @return associated ECC key, valid as long as the ego is valid
  */
-const struct GNUNET_IDENTITY_PrivateKey *
+const struct GNUNET_CRYPTO_PrivateKey *
 GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego)
 {
   return &ego->pk;
 }
 
-
 /**
  * Get the identifier (public key) of an ego.
  *
@@ -571,26 +527,45 @@ GNUNET_IDENTITY_ego_get_private_key (const struct 
GNUNET_IDENTITY_Ego *ego)
  */
 void
 GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego,
-                                    struct GNUNET_IDENTITY_PublicKey *pk)
+                                    struct GNUNET_CRYPTO_PublicKey *pk)
 {
   if (GNUNET_NO == ego->pub_initialized)
   {
-    GNUNET_IDENTITY_key_get_public (&ego->pk, &ego->pub);
+    GNUNET_CRYPTO_key_get_public (&ego->pk, &ego->pub);
     ego->pub_initialized = GNUNET_YES;
   }
   *pk = ego->pub;
 }
 
+static enum GNUNET_GenericReturnValue
+private_key_create (enum GNUNET_CRYPTO_KeyType ktype,
+                    struct GNUNET_CRYPTO_PrivateKey *key)
+{
+  key->type = htonl (ktype);
+  switch (ktype)
+  {
+  case GNUNET_PUBLIC_KEY_TYPE_ECDSA:
+    GNUNET_CRYPTO_ecdsa_key_create (&key->ecdsa_key);
+    break;
+  case GNUNET_PUBLIC_KEY_TYPE_EDDSA:
+    GNUNET_CRYPTO_eddsa_key_create (&key->eddsa_key);
+    break;
+  default:
+    GNUNET_break (0);
+    return GNUNET_SYSERR;
+  }
+  return GNUNET_OK;
+}
 
 struct GNUNET_IDENTITY_Operation *
 GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h,
                         const char *name,
-                        const struct GNUNET_IDENTITY_PrivateKey *privkey,
-                        enum GNUNET_IDENTITY_KeyType ktype,
+                        const struct GNUNET_CRYPTO_PrivateKey *privkey,
+                        enum GNUNET_CRYPTO_KeyType ktype,
                         GNUNET_IDENTITY_CreateContinuation cont,
                         void *cont_cls)
 {
-  struct GNUNET_IDENTITY_PrivateKey private_key;
+  struct GNUNET_CRYPTO_PrivateKey private_key;
   struct GNUNET_IDENTITY_Operation *op;
   struct GNUNET_MQ_Envelope *env;
   struct CreateRequestMessage *crm;
@@ -617,11 +592,11 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h,
   }
   else
     private_key = *privkey;
-  key_len = GNUNET_IDENTITY_private_key_get_length (&private_key);
+  key_len = GNUNET_CRYPTO_private_key_get_length (&private_key);
   env = GNUNET_MQ_msg_extra (crm, slen + key_len,
                              GNUNET_MESSAGE_TYPE_IDENTITY_CREATE);
   crm->name_len = htons (slen);
-  GNUNET_IDENTITY_write_private_key_to_buffer (&private_key,
+  GNUNET_CRYPTO_write_private_key_to_buffer (&private_key,
                                                &crm[1],
                                                key_len);
   crm->key_len = htons (key_len);
@@ -790,571 +765,4 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle 
*h)
 }
 
 
-static enum GNUNET_GenericReturnValue
-check_key_type (uint32_t type)
-{
-  switch (type)
-  {
-  case GNUNET_IDENTITY_TYPE_ECDSA:
-  case GNUNET_IDENTITY_TYPE_EDDSA:
-    return GNUNET_OK;
-  default:
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_SYSERR;
-}
-
-
-ssize_t
-GNUNET_IDENTITY_private_key_get_length (const struct
-                                        GNUNET_IDENTITY_PrivateKey *key)
-{
-  switch (ntohl (key->type))
-  {
-  case GNUNET_IDENTITY_TYPE_ECDSA:
-    return sizeof (key->type) + sizeof (key->ecdsa_key);
-    break;
-  case GNUNET_IDENTITY_TYPE_EDDSA:
-    return sizeof (key->type) + sizeof (key->eddsa_key);
-    break;
-  default:
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Got key type %u\n", ntohl (key->type));
-    GNUNET_break (0);
-  }
-  return -1;
-}
-
-
-ssize_t
-GNUNET_IDENTITY_public_key_get_length (const struct
-                                       GNUNET_IDENTITY_PublicKey *key)
-{
-  switch (ntohl (key->type))
-  {
-  case GNUNET_IDENTITY_TYPE_ECDSA:
-    return sizeof (key->type) + sizeof (key->ecdsa_key);
-  case GNUNET_IDENTITY_TYPE_EDDSA:
-    return sizeof (key->type) + sizeof (key->eddsa_key);
-  default:
-    GNUNET_break (0);
-  }
-  return -1;
-}
-
-
-ssize_t
-GNUNET_IDENTITY_private_key_length_by_type (enum GNUNET_IDENTITY_KeyType kt)
-{
-  switch (kt)
-  {
-  case GNUNET_IDENTITY_TYPE_ECDSA:
-    return sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
-    break;
-  case GNUNET_IDENTITY_TYPE_EDDSA:
-    return sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
-    break;
-  default:
-    GNUNET_break (0);
-  }
-  return -1;
-}
-
-
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_read_public_key_from_buffer (const void *buffer,
-                                             size_t len,
-                                             struct GNUNET_IDENTITY_PublicKey *
-                                             key,
-                                             size_t *kb_read)
-{
-  if (len < sizeof (key->type))
-    return GNUNET_SYSERR;
-  GNUNET_memcpy (&key->type,
-                 buffer,
-                 sizeof (key->type));
-  ssize_t length = GNUNET_IDENTITY_public_key_get_length (key);
-  if (len < length)
-    return GNUNET_SYSERR;
-  if (length < 0)
-    return GNUNET_SYSERR;
-  GNUNET_memcpy (&key->ecdsa_key,
-                 buffer + sizeof (key->type),
-                 length - sizeof (key->type));
-  *kb_read = length;
-  return GNUNET_OK;
-}
-
-
-ssize_t
-GNUNET_IDENTITY_write_public_key_to_buffer (const struct
-                                            GNUNET_IDENTITY_PublicKey *key,
-                                            void*buffer,
-                                            size_t len)
-{
-  const ssize_t length = GNUNET_IDENTITY_public_key_get_length (key);
-  if (len < length)
-    return -1;
-  if (length < 0)
-    return -2;
-  GNUNET_memcpy (buffer, &(key->type), sizeof (key->type));
-  GNUNET_memcpy (buffer + sizeof (key->type), &(key->ecdsa_key), length
-                 - sizeof (key->type));
-  return length;
-}
-
-
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_read_private_key_from_buffer (const void *buffer,
-                                              size_t len,
-                                              struct
-                                              GNUNET_IDENTITY_PrivateKey *key,
-                                              size_t *kb_read)
-{
-  if (len < sizeof (key->type))
-    return GNUNET_SYSERR;
-  GNUNET_memcpy (&key->type,
-                 buffer,
-                 sizeof (key->type));
-  ssize_t length = GNUNET_IDENTITY_private_key_get_length (key);
-  if (len < length)
-    return GNUNET_SYSERR;
-  if (length < 0)
-    return GNUNET_SYSERR;
-  GNUNET_memcpy (&key->ecdsa_key,
-                 buffer + sizeof (key->type),
-                 length - sizeof (key->type));
-  *kb_read = length;
-  return GNUNET_OK;
-}
-
-
-ssize_t
-GNUNET_IDENTITY_write_private_key_to_buffer (const struct
-                                             GNUNET_IDENTITY_PrivateKey *key,
-                                             void *buffer,
-                                             size_t len)
-{
-  const ssize_t length = GNUNET_IDENTITY_private_key_get_length (key);
-  if (len < length)
-    return -1;
-  if (length < 0)
-    return -2;
-  GNUNET_memcpy (buffer, &(key->type), sizeof (key->type));
-  GNUNET_memcpy (buffer + sizeof (key->type), &(key->ecdsa_key), length
-                 - sizeof (key->type));
-  return length;
-}
-
-
-ssize_t
-GNUNET_IDENTITY_signature_get_length (const struct
-                                      GNUNET_IDENTITY_Signature *sig)
-{
-  switch (ntohl (sig->type))
-  {
-  case GNUNET_IDENTITY_TYPE_ECDSA:
-    return sizeof (sig->type) + sizeof (sig->ecdsa_signature);
-    break;
-  case GNUNET_IDENTITY_TYPE_EDDSA:
-    return sizeof (sig->type) + sizeof (sig->eddsa_signature);
-    break;
-  default:
-    GNUNET_break (0);
-  }
-  return -1;
-}
-
-
-ssize_t
-GNUNET_IDENTITY_signature_get_raw_length_by_type (uint32_t type)
-{
-  switch (ntohl (type))
-  {
-  case GNUNET_IDENTITY_TYPE_ECDSA:
-    return sizeof (struct GNUNET_CRYPTO_EcdsaSignature);
-    break;
-  case GNUNET_IDENTITY_TYPE_EDDSA:
-    return sizeof (struct GNUNET_CRYPTO_EddsaSignature);
-    break;
-  default:
-    GNUNET_break (0);
-  }
-  return -1;
-}
-
-
-ssize_t
-GNUNET_IDENTITY_read_signature_from_buffer (struct
-                                            GNUNET_IDENTITY_Signature *sig,
-                                            const void*buffer,
-                                            size_t len)
-{
-  if (len < sizeof (sig->type))
-    return -1;
-  GNUNET_memcpy (&(sig->type), buffer, sizeof (sig->type));
-  const ssize_t length = GNUNET_IDENTITY_signature_get_length (sig);
-  if (len < length)
-    return -1;
-  if (length < 0)
-    return -2;
-  GNUNET_memcpy (&(sig->ecdsa_signature), buffer + sizeof (sig->type), length
-                 - sizeof (sig->type));
-  return length;
-}
-
-
-ssize_t
-GNUNET_IDENTITY_write_signature_to_buffer (const struct
-                                           GNUNET_IDENTITY_Signature *sig,
-                                           void*buffer,
-                                           size_t len)
-{
-  const ssize_t length = GNUNET_IDENTITY_signature_get_length (sig);
-  if (len < length)
-    return -1;
-  if (length < 0)
-    return -2;
-  GNUNET_memcpy (buffer, &(sig->type), sizeof (sig->type));
-  GNUNET_memcpy (buffer + sizeof (sig->type), &(sig->ecdsa_signature), length
-                 - sizeof (sig->type));
-  return length;
-}
-
-
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_sign_raw_ (const struct
-                           GNUNET_IDENTITY_PrivateKey *priv,
-                           const struct
-                           GNUNET_CRYPTO_EccSignaturePurpose *purpose,
-                           unsigned char *sig)
-{
-  switch (ntohl (priv->type))
-  {
-  case GNUNET_IDENTITY_TYPE_ECDSA:
-    return GNUNET_CRYPTO_ecdsa_sign_ (&(priv->ecdsa_key), purpose,
-                                      (struct
-                                       GNUNET_CRYPTO_EcdsaSignature*) sig);
-    break;
-  case GNUNET_IDENTITY_TYPE_EDDSA:
-    return GNUNET_CRYPTO_eddsa_sign_ (&(priv->eddsa_key), purpose,
-                                      (struct
-                                       GNUNET_CRYPTO_EddsaSignature*) sig);
-    break;
-  default:
-    GNUNET_break (0);
-  }
-
-  return GNUNET_SYSERR;
-}
-
-
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_sign_ (const struct
-                       GNUNET_IDENTITY_PrivateKey *priv,
-                       const struct
-                       GNUNET_CRYPTO_EccSignaturePurpose *purpose,
-                       struct GNUNET_IDENTITY_Signature *sig)
-{
-  sig->type = priv->type;
-  switch (ntohl (priv->type))
-  {
-  case GNUNET_IDENTITY_TYPE_ECDSA:
-    return GNUNET_CRYPTO_ecdsa_sign_ (&(priv->ecdsa_key), purpose,
-                                      &(sig->ecdsa_signature));
-    break;
-  case GNUNET_IDENTITY_TYPE_EDDSA:
-    return GNUNET_CRYPTO_eddsa_sign_ (&(priv->eddsa_key), purpose,
-                                      &(sig->eddsa_signature));
-    break;
-  default:
-    GNUNET_break (0);
-  }
-
-  return GNUNET_SYSERR;
-}
-
-
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_signature_verify_ (uint32_t purpose,
-                                   const struct
-                                   GNUNET_CRYPTO_EccSignaturePurpose *validate,
-                                   const struct GNUNET_IDENTITY_Signature *sig,
-                                   const struct GNUNET_IDENTITY_PublicKey *pub)
-{
-  /* check type matching of 'sig' and 'pub' */
-  GNUNET_assert (ntohl (pub->type) == ntohl (sig->type));
-  switch (ntohl (pub->type))
-  {
-  case GNUNET_IDENTITY_TYPE_ECDSA:
-    return GNUNET_CRYPTO_ecdsa_verify_ (purpose, validate,
-                                        &(sig->ecdsa_signature),
-                                        &(pub->ecdsa_key));
-    break;
-  case GNUNET_IDENTITY_TYPE_EDDSA:
-    return GNUNET_CRYPTO_eddsa_verify_ (purpose, validate,
-                                        &(sig->eddsa_signature),
-                                        &(pub->eddsa_key));
-    break;
-  default:
-    GNUNET_break (0);
-  }
-
-  return GNUNET_SYSERR;
-}
-
-
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_signature_verify_raw_ (uint32_t purpose,
-                                       const struct
-                                       GNUNET_CRYPTO_EccSignaturePurpose *
-                                       validate,
-                                       const unsigned char *sig,
-                                       const struct
-                                       GNUNET_IDENTITY_PublicKey *pub)
-{
-  switch (ntohl (pub->type))
-  {
-  case GNUNET_IDENTITY_TYPE_ECDSA:
-    return GNUNET_CRYPTO_ecdsa_verify_ (purpose, validate,
-                                        (struct
-                                         GNUNET_CRYPTO_EcdsaSignature*) sig,
-                                        &(pub->ecdsa_key));
-    break;
-  case GNUNET_IDENTITY_TYPE_EDDSA:
-    return GNUNET_CRYPTO_eddsa_verify_ (purpose, validate,
-                                        (struct
-                                         GNUNET_CRYPTO_EddsaSignature*) sig,
-                                        &(pub->eddsa_key));
-    break;
-  default:
-    GNUNET_break (0);
-  }
-
-  return GNUNET_SYSERR;
-}
-
-
-ssize_t
-GNUNET_IDENTITY_encrypt_old (const void *block,
-                             size_t size,
-                             const struct GNUNET_IDENTITY_PublicKey *pub,
-                             struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
-                             void *result)
-{
-  struct GNUNET_CRYPTO_EcdhePrivateKey pk;
-  GNUNET_CRYPTO_ecdhe_key_create (&pk);
-  struct GNUNET_HashCode hash;
-  switch (ntohl (pub->type))
-  {
-  case GNUNET_IDENTITY_TYPE_ECDSA:
-    if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdh_ecdsa (&pk, &(pub->ecdsa_key),
-                                                   &hash))
-      return -1;
-    break;
-  case GNUNET_IDENTITY_TYPE_EDDSA:
-    if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdh_eddsa (&pk, &(pub->eddsa_key),
-                                                   &hash))
-      return -1;
-    break;
-  default:
-    return -1;
-  }
-  GNUNET_CRYPTO_ecdhe_key_get_public (&pk, ecc);
-  GNUNET_CRYPTO_ecdhe_key_clear (&pk);
-  struct GNUNET_CRYPTO_SymmetricSessionKey key;
-  struct GNUNET_CRYPTO_SymmetricInitializationVector iv;
-  GNUNET_CRYPTO_hash_to_aes_key (&hash, &key, &iv);
-  GNUNET_CRYPTO_zero_keys (&hash, sizeof(hash));
-  const ssize_t encrypted = GNUNET_CRYPTO_symmetric_encrypt (block, size, &key,
-                                                             &iv, result);
-  GNUNET_CRYPTO_zero_keys (&key, sizeof(key));
-  GNUNET_CRYPTO_zero_keys (&iv, sizeof(iv));
-  return encrypted;
-}
-
-
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_encrypt (const void *pt,
-                         size_t pt_size,
-                         const struct GNUNET_IDENTITY_PublicKey *pub,
-                         void *ct_buf,
-                         size_t ct_size)
-{
-  struct GNUNET_HashCode k;
-  struct GNUNET_CRYPTO_FoKemC kemc;
-  struct GNUNET_CRYPTO_FoKemC *kemc_buf = (struct GNUNET_CRYPTO_FoKemC*) 
ct_buf;
-  unsigned char *encrypted_data = (unsigned char*) &kemc_buf[1];
-  unsigned char nonce[crypto_secretbox_NONCEBYTES];
-  unsigned char key[crypto_secretbox_KEYBYTES];
-
-  if (ct_size < pt_size + GNUNET_IDENTITY_ENCRYPT_OVERHEAD_BYTES)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Output buffer size for ciphertext too small: Got %lu, want 
>=%lu\n",
-                ct_size, pt_size + GNUNET_IDENTITY_ENCRYPT_OVERHEAD_BYTES);
-    return GNUNET_SYSERR;
-  }
-  switch (ntohl (pub->type))
-  {
-  case GNUNET_IDENTITY_TYPE_ECDSA:
-    if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdsa_fo_kem_encaps (&(pub->ecdsa_key),
-                                                            &kemc,
-                                                            &k))
-      return GNUNET_SYSERR;
-    break;
-  case GNUNET_IDENTITY_TYPE_EDDSA:
-    if (GNUNET_SYSERR == GNUNET_CRYPTO_eddsa_fo_kem_encaps (&pub->eddsa_key,
-                                                            &kemc,
-                                                            &k))
-      return GNUNET_SYSERR;
-    break;
-  default:
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unsupported key type\n");
-    return GNUNET_SYSERR;
-  }
-  memcpy (key, &k, crypto_secretbox_KEYBYTES);
-  memcpy (nonce, ((char* ) &k) + crypto_secretbox_KEYBYTES,
-          crypto_secretbox_NONCEBYTES);
-  if (crypto_secretbox_easy (encrypted_data, pt, pt_size, nonce, key))
-    return GNUNET_SYSERR;
-  memcpy (kemc_buf, &kemc, sizeof (kemc));
-  return GNUNET_OK;
-}
-
-
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_decrypt (const void *ct_buf,
-                         size_t ct_size,
-                         const struct GNUNET_IDENTITY_PrivateKey *priv,
-                         void *pt,
-                         size_t pt_size)
-{
-  struct GNUNET_HashCode k;
-  struct GNUNET_CRYPTO_FoKemC *kemc = (struct GNUNET_CRYPTO_FoKemC*) ct_buf;
-  unsigned char *encrypted_data = (unsigned char*) &kemc[1];
-  unsigned char nonce[crypto_secretbox_NONCEBYTES];
-  unsigned char key[crypto_secretbox_KEYBYTES];
-  size_t expected_pt_len = ct_size - GNUNET_IDENTITY_ENCRYPT_OVERHEAD_BYTES;
-
-  if (pt_size < expected_pt_len)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Output buffer size for plaintext too small: Got %lu, want 
>=%lu\n",
-                pt_size, expected_pt_len);
-    return GNUNET_SYSERR;
-  }
-  switch (ntohl (priv->type))
-  {
-  case GNUNET_IDENTITY_TYPE_ECDSA:
-    if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdsa_fo_kem_decaps (&(priv->ecdsa_key),
-                                                            kemc,
-                                                            &k))
-      return GNUNET_SYSERR;
-    break;
-  case GNUNET_IDENTITY_TYPE_EDDSA:
-    if (GNUNET_SYSERR == GNUNET_CRYPTO_eddsa_fo_kem_decaps (&(priv->eddsa_key),
-                                                            kemc,
-                                                            &k))
-      return GNUNET_SYSERR;
-    break;
-  default:
-    return GNUNET_SYSERR;
-  }
-  memcpy (key, &k, crypto_secretbox_KEYBYTES);
-  memcpy (nonce, ((char* ) &k) + crypto_secretbox_KEYBYTES,
-          crypto_secretbox_NONCEBYTES);
-  if (crypto_secretbox_open_easy (pt, encrypted_data, ct_size - sizeof (*kemc),
-                                  nonce, key))
-    return GNUNET_SYSERR;
-  return GNUNET_OK;
-}
-
-
-ssize_t
-GNUNET_IDENTITY_decrypt_old (const void *block,
-                             size_t size,
-                             const struct GNUNET_IDENTITY_PrivateKey *priv,
-                             const struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
-                             void *result)
-{
-  struct GNUNET_HashCode hash;
-  switch (ntohl (priv->type))
-  {
-  case GNUNET_IDENTITY_TYPE_ECDSA:
-    if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdsa_ecdh (&(priv->ecdsa_key), ecc,
-                                                   &hash))
-      return -1;
-    break;
-  case GNUNET_IDENTITY_TYPE_EDDSA:
-    if (GNUNET_SYSERR == GNUNET_CRYPTO_eddsa_ecdh (&(priv->eddsa_key), ecc,
-                                                   &hash))
-      return -1;
-    break;
-  default:
-    return -1;
-  }
-  struct GNUNET_CRYPTO_SymmetricSessionKey key;
-  struct GNUNET_CRYPTO_SymmetricInitializationVector iv;
-  GNUNET_CRYPTO_hash_to_aes_key (&hash, &key, &iv);
-  GNUNET_CRYPTO_zero_keys (&hash, sizeof(hash));
-  const ssize_t decrypted = GNUNET_CRYPTO_symmetric_decrypt (block, size, &key,
-                                                             &iv, result);
-  GNUNET_CRYPTO_zero_keys (&key, sizeof(key));
-  GNUNET_CRYPTO_zero_keys (&iv, sizeof(iv));
-  return decrypted;
-}
-
-
-char *
-GNUNET_IDENTITY_public_key_to_string (const struct
-                                      GNUNET_IDENTITY_PublicKey *key)
-{
-  size_t size = GNUNET_IDENTITY_public_key_get_length (key);
-  return GNUNET_STRINGS_data_to_string_alloc (key,
-                                              size);
-}
-
-
-char *
-GNUNET_IDENTITY_private_key_to_string (const struct
-                                       GNUNET_IDENTITY_PrivateKey *key)
-{
-  size_t size = GNUNET_IDENTITY_private_key_get_length (key);
-  return GNUNET_STRINGS_data_to_string_alloc (key,
-                                              size);
-}
-
-
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_public_key_from_string (const char *str,
-                                        struct GNUNET_IDENTITY_PublicKey *key)
-{
-  enum GNUNET_GenericReturnValue ret;
-  ret = GNUNET_STRINGS_string_to_data (str,
-                                       strlen (str),
-                                       key,
-                                       sizeof (*key));
-  if (GNUNET_OK != ret)
-    return GNUNET_SYSERR;
-  return check_key_type (ntohl (key->type));
-
-}
-
-
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_private_key_from_string (const char *str,
-                                         struct GNUNET_IDENTITY_PrivateKey 
*key)
-{
-  enum GNUNET_GenericReturnValue ret;
-  ret = GNUNET_STRINGS_string_to_data (str,
-                                       strlen (str),
-                                       key,
-                                       sizeof (*key));
-  if (GNUNET_OK != ret)
-    return GNUNET_SYSERR;
-  return check_key_type (ntohl (key->type));
-}
-
-
 /* end of identity_api.c */
diff --git a/src/identity/identity_api_lookup.c 
b/src/identity/identity_api_lookup.c
index 4cc0b6334..03b229e08 100644
--- a/src/identity/identity_api_lookup.c
+++ b/src/identity/identity_api_lookup.c
@@ -131,7 +131,7 @@ handle_identity_update (void *cls, const struct 
UpdateMessage *um)
   size_t kb_read;
   struct GNUNET_HashCode id;
   struct GNUNET_IDENTITY_Ego ego;
-  struct GNUNET_IDENTITY_PrivateKey private_key;
+  struct GNUNET_CRYPTO_PrivateKey private_key;
   const char *tmp;
 
   memset (&ego, 0, sizeof (ego));
@@ -142,7 +142,7 @@ handle_identity_update (void *cls, const struct 
UpdateMessage *um)
   memset (&private_key, 0, sizeof (private_key));
   key_len = ntohs (um->header.size) - sizeof (*um) - name_len;
   GNUNET_assert (GNUNET_SYSERR !=
-                 GNUNET_IDENTITY_read_private_key_from_buffer (tmp + name_len,
+                 GNUNET_CRYPTO_read_private_key_from_buffer (tmp + name_len,
                                                                key_len,
                                                                &private_key,
                                                                &kb_read));
diff --git a/src/identity/identity_api_suffix_lookup.c 
b/src/identity/identity_api_suffix_lookup.c
index 4b459345d..7bc0d18f3 100644
--- a/src/identity/identity_api_suffix_lookup.c
+++ b/src/identity/identity_api_suffix_lookup.c
@@ -132,7 +132,7 @@ handle_identity_update (void *cls, const struct 
UpdateMessage *um)
   const char *str;
   size_t key_len;
   size_t kb_read;
-  struct GNUNET_IDENTITY_PrivateKey private_key;
+  struct GNUNET_CRYPTO_PrivateKey private_key;
   const char *tmp;
 
   tmp = (const char*) &um[1];
@@ -142,7 +142,7 @@ handle_identity_update (void *cls, const struct 
UpdateMessage *um)
   if (0 < key_len)
   {
     GNUNET_assert (GNUNET_SYSERR !=
-                   GNUNET_IDENTITY_read_private_key_from_buffer (tmp + 
name_len,
+                   GNUNET_CRYPTO_read_private_key_from_buffer (tmp + name_len,
                                                                  key_len,
                                                                  &private_key,
                                                                  &kb_read));
diff --git a/src/identity/plugin_rest_identity.c 
b/src/identity/plugin_rest_identity.c
index 093a24c39..cae0e4d95 100644
--- a/src/identity/plugin_rest_identity.c
+++ b/src/identity/plugin_rest_identity.c
@@ -385,7 +385,7 @@ ego_get_all (struct GNUNET_REST_RequestHandle *con_handle,
         GNUNET_CONTAINER_multihashmap_contains (
           handle->rest_handle->url_param_map, &key))
     {
-      privkey_str = GNUNET_IDENTITY_private_key_to_string (
+      privkey_str = GNUNET_CRYPTO_private_key_to_string (
         GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego));
       json_object_set_new (json_ego,
                            GNUNET_REST_IDENTITY_PARAM_PRIVKEY,
@@ -440,7 +440,7 @@ ego_get_response (struct RequestHandle *handle, struct 
EgoEntry *ego_entry)
       GNUNET_CONTAINER_multihashmap_contains (
         handle->rest_handle->url_param_map, &key))
   {
-    privkey_str = GNUNET_IDENTITY_private_key_to_string (
+    privkey_str = GNUNET_CRYPTO_private_key_to_string (
       GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego));
     json_object_set_new (json_ego,
                          GNUNET_REST_IDENTITY_PARAM_PRIVKEY,
@@ -576,7 +576,7 @@ do_finished (void *cls, enum GNUNET_ErrorCode ec)
  */
 static void
 do_finished_create (void *cls,
-                    const struct GNUNET_IDENTITY_PrivateKey *pk,
+                    const struct GNUNET_CRYPTO_PrivateKey *pk,
                     enum GNUNET_ErrorCode ec)
 {
   struct RequestHandle *handle = cls;
@@ -762,8 +762,8 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle,
   json_error_t err;
   char *egoname;
   char *privkey;
-  struct GNUNET_IDENTITY_PrivateKey pk;
-  struct GNUNET_IDENTITY_PrivateKey *pk_ptr;
+  struct GNUNET_CRYPTO_PrivateKey pk;
+  struct GNUNET_CRYPTO_PrivateKey *pk_ptr;
   int json_unpack_state;
   char term_data[handle->data_size + 1];
 
@@ -825,7 +825,7 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle,
                                    strlen (privkey),
                                    &pk,
                                    sizeof(struct
-                                          GNUNET_IDENTITY_PrivateKey));
+                                          GNUNET_CRYPTO_PrivateKey));
     pk_ptr = &pk;
   }
   else
@@ -834,7 +834,7 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle,
   handle->op = GNUNET_IDENTITY_create (identity_handle,
                                        handle->name,
                                        pk_ptr,
-                                       GNUNET_IDENTITY_TYPE_ECDSA,
+                                       GNUNET_PUBLIC_KEY_TYPE_ECDSA,
                                        &do_finished_create,
                                        handle);
 }
@@ -945,7 +945,7 @@ ego_sign_data_cb (void *cls, struct GNUNET_IDENTITY_Ego 
*ego)
     return;
   }
 
-  if (ntohl (ego->pk.type) != GNUNET_IDENTITY_TYPE_EDDSA)
+  if (ntohl (ego->pk.type) != GNUNET_PUBLIC_KEY_TYPE_EDDSA)
   {
     handle->ec = GNUNET_EC_IDENTITY_NOT_FOUND;
     GNUNET_SCHEDULER_add_now (&do_error, handle);
@@ -1069,7 +1069,7 @@ list_ego (void *cls,
           const char *identifier)
 {
   struct EgoEntry *ego_entry;
-  struct GNUNET_IDENTITY_PublicKey pk;
+  struct GNUNET_CRYPTO_PublicKey pk;
 
   if ((NULL == ego) && (ID_REST_STATE_INIT == state))
   {
@@ -1086,7 +1086,7 @@ list_ego (void *cls,
   {
     ego_entry = GNUNET_new (struct EgoEntry);
     GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
-    ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk);
+    ego_entry->keystring = GNUNET_CRYPTO_public_key_to_string (&pk);
     ego_entry->ego = ego;
     ego_entry->identifier = GNUNET_strdup (identifier);
     GNUNET_CONTAINER_DLL_insert_tail (ego_head,
@@ -1112,7 +1112,7 @@ list_ego (void *cls,
       /* Add */
       ego_entry = GNUNET_new (struct EgoEntry);
       GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
-      ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk);
+      ego_entry->keystring = GNUNET_CRYPTO_public_key_to_string (&pk);
       ego_entry->ego = ego;
       ego_entry->identifier = GNUNET_strdup (identifier);
       GNUNET_CONTAINER_DLL_insert_tail (ego_head,
diff --git a/src/identity/test_identity.c b/src/identity/test_identity.c
index 92c074981..d133e3ee4 100644
--- a/src/identity/test_identity.c
+++ b/src/identity/test_identity.c
@@ -253,24 +253,24 @@ success_rename_cont (void *cls, enum GNUNET_ErrorCode ec)
  */
 static void
 create_cb (void *cls,
-           const struct GNUNET_IDENTITY_PrivateKey *pk,
+           const struct GNUNET_CRYPTO_PrivateKey *pk,
            enum GNUNET_ErrorCode ec)
 {
   CHECK (NULL != pk);
   CHECK (GNUNET_EC_NONE == ec);
-  struct GNUNET_IDENTITY_PublicKey pub;
+  struct GNUNET_CRYPTO_PublicKey pub;
   size_t pt_len = strlen ("test") + 1;
-  unsigned char ct[pt_len + GNUNET_IDENTITY_ENCRYPT_OVERHEAD_BYTES];
+  unsigned char ct[pt_len + GNUNET_CRYPTO_ENCRYPT_OVERHEAD_BYTES];
   char pt[pt_len];
   enum GNUNET_GenericReturnValue res;
 
-  GNUNET_IDENTITY_key_get_public (pk, &pub);
-  res = GNUNET_IDENTITY_encrypt ("test", pt_len, &pub, ct,
+  GNUNET_CRYPTO_key_get_public (pk, &pub);
+  res = GNUNET_CRYPTO_encrypt ("test", pt_len, &pub, ct,
                                  pt_len
-                                 + GNUNET_IDENTITY_ENCRYPT_OVERHEAD_BYTES);
+                                 + GNUNET_CRYPTO_ENCRYPT_OVERHEAD_BYTES);
   CHECK (GNUNET_OK == res);
-  res = GNUNET_IDENTITY_decrypt (ct, pt_len
-                                 + GNUNET_IDENTITY_ENCRYPT_OVERHEAD_BYTES,
+  res = GNUNET_CRYPTO_decrypt (ct, pt_len
+                                 + GNUNET_CRYPTO_ENCRYPT_OVERHEAD_BYTES,
                                  pk, pt, pt_len);
   CHECK (GNUNET_OK == res);
   CHECK (0 == strcmp (pt, "test"));
@@ -298,7 +298,7 @@ run (void *cls,
   op = GNUNET_IDENTITY_create (h,
                                "test-id",
                                NULL,
-                               GNUNET_IDENTITY_TYPE_ECDSA,
+                               GNUNET_PUBLIC_KEY_TYPE_ECDSA,
                                &create_cb, NULL);
 }
 
diff --git a/src/include/gnunet_abd_service.h b/src/include/gnunet_abd_service.h
index 75c1757ab..cb6e77256 100644
--- a/src/include/gnunet_abd_service.h
+++ b/src/include/gnunet_abd_service.h
@@ -107,7 +107,7 @@ struct GNUNET_ABD_DelegationRecordSet
   /**
    * Public key of the subject this attribute was delegated to
    */
-  struct GNUNET_IDENTITY_PublicKey subject_key;
+  struct GNUNET_CRYPTO_PublicKey subject_key;
 
   /**
    * Length of attribute, may be 0
@@ -127,7 +127,7 @@ struct GNUNET_ABD_DelegationSet
   /**
    * Public key of the subject this attribute was delegated to
    */
-  struct GNUNET_IDENTITY_PublicKey subject_key;
+  struct GNUNET_CRYPTO_PublicKey subject_key;
 
   uint32_t subject_attribute_len;
 
@@ -147,12 +147,12 @@ struct GNUNET_ABD_Delegation
   /**
    * The issuer of the delegation
    */
-  struct GNUNET_IDENTITY_PublicKey issuer_key;
+  struct GNUNET_CRYPTO_PublicKey issuer_key;
 
   /**
    * Public key of the subject this attribute was delegated to
    */
-  struct GNUNET_IDENTITY_PublicKey subject_key;
+  struct GNUNET_CRYPTO_PublicKey subject_key;
 
   /**
    * Length of the attribute
@@ -185,17 +185,17 @@ struct GNUNET_ABD_Delegate
   /**
    * The issuer of the credential
    */
-  struct GNUNET_IDENTITY_PublicKey issuer_key;
+  struct GNUNET_CRYPTO_PublicKey issuer_key;
 
   /**
    * Public key of the subject this credential was issued to
    */
-  struct GNUNET_IDENTITY_PublicKey subject_key;
+  struct GNUNET_CRYPTO_PublicKey subject_key;
 
   /**
    * Signature of this credential
    */
-  struct GNUNET_IDENTITY_Signature signature;
+  struct GNUNET_CRYPTO_Signature signature;
 
   /**
    * Expiration of this credential
@@ -322,9 +322,9 @@ typedef void (*GNUNET_ABD_RemoveDelegateResultProcessor) 
(void *cls,
  */
 struct GNUNET_ABD_Request*
   GNUNET_ABD_verify (struct GNUNET_ABD_Handle *handle,
-                     const struct GNUNET_IDENTITY_PublicKey *issuer_key,
+                     const struct GNUNET_CRYPTO_PublicKey *issuer_key,
                      const char *issuer_attribute,
-                     const struct GNUNET_IDENTITY_PublicKey *subject_key,
+                     const struct GNUNET_CRYPTO_PublicKey *subject_key,
                      uint32_t delegate_count,
                      const struct GNUNET_ABD_Delegate *delegates,
                      enum GNUNET_ABD_AlgoDirectionFlags direction,
@@ -335,9 +335,9 @@ struct GNUNET_ABD_Request*
 
 struct GNUNET_ABD_Request*
   GNUNET_ABD_collect (struct GNUNET_ABD_Handle *handle,
-                      const struct GNUNET_IDENTITY_PublicKey *issuer_key,
+                      const struct GNUNET_CRYPTO_PublicKey *issuer_key,
                       const char *issuer_attribute,
-                      const struct GNUNET_IDENTITY_PrivateKey *subject_key,
+                      const struct GNUNET_CRYPTO_PrivateKey *subject_key,
                       enum GNUNET_ABD_AlgoDirectionFlags direction,
                       GNUNET_ABD_CredentialResultProcessor proc,
                       void *proc_cls,
@@ -360,7 +360,7 @@ struct GNUNET_ABD_Request *
 GNUNET_ABD_add_delegation (struct GNUNET_ABD_Handle *handle,
                            struct GNUNET_IDENTITY_Ego *issuer,
                            const char *attribute,
-                           struct GNUNET_IDENTITY_PublicKey *subject,
+                           struct GNUNET_CRYPTO_PublicKey *subject,
                            const char *delegated_attribute,
                            GNUNET_ABD_DelegateResultProcessor proc,
                            void *proc_cls);
@@ -393,8 +393,8 @@ GNUNET_ABD_remove_delegation (struct GNUNET_ABD_Handle 
*handle,
  * @return handle to the queued request
  */
 struct GNUNET_ABD_Delegate*
-GNUNET_ABD_delegate_issue (const struct GNUNET_IDENTITY_PrivateKey *issuer,
-                           struct GNUNET_IDENTITY_PublicKey *subject,
+GNUNET_ABD_delegate_issue (const struct GNUNET_CRYPTO_PrivateKey *issuer,
+                           struct GNUNET_CRYPTO_PublicKey *subject,
                            const char *iss_attr,
                            const char *sub_attr,
                            struct GNUNET_TIME_Absolute *expiration);
diff --git a/src/include/gnunet_conversation_service.h 
b/src/include/gnunet_conversation_service.h
index 7d54914d1..7857a49cf 100644
--- a/src/include/gnunet_conversation_service.h
+++ b/src/include/gnunet_conversation_service.h
@@ -151,7 +151,7 @@ typedef void
                                          struct GNUNET_CONVERSATION_Caller *
                                          caller,
                                          const struct
-                                         GNUNET_IDENTITY_PublicKey *caller_id);
+                                         GNUNET_CRYPTO_PublicKey *caller_id);
 
 
 /**
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index 44dfb4e44..ca51f586c 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -348,6 +348,105 @@ struct GNUNET_CRYPTO_Edx25519Signature
   unsigned char s[256 / 8];
 };
 
+/**
+ * Key type for the generic public key union
+ */
+enum GNUNET_CRYPTO_KeyType
+{
+  /**
+   * The identity type. The value is the same as the
+   * PKEY record type.
+   */
+  GNUNET_PUBLIC_KEY_TYPE_ECDSA = 65536,
+
+  /**
+   * EDDSA identity. The value is the same as the EDKEY
+   * record type.
+   */
+  GNUNET_PUBLIC_KEY_TYPE_EDDSA = 65556
+};
+
+/**
+ * A private key for an identity as per LSD0001.
+ * Note that these types are NOT packed and MUST NOT be used in RPC
+ * messages. Use the respective serialization functions.
+ */
+struct GNUNET_CRYPTO_PrivateKey
+{
+  /**
+   * Type of public key.
+   * Defined by the GNS zone type value.
+   * In NBO.
+   */
+  uint32_t type;
+
+  union
+  {
+    /**
+     * An ECDSA identity key.
+     */
+    struct GNUNET_CRYPTO_EcdsaPrivateKey ecdsa_key;
+
+    /**
+     * AN EdDSA identtiy key
+     */
+    struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_key;
+  };
+};
+
+
+/**
+ * An identity key as per LSD0001.
+ */
+struct GNUNET_CRYPTO_PublicKey
+{
+  /**
+   * Type of public key.
+   * Defined by the GNS zone type value.
+   * In NBO.
+   */
+  uint32_t type;
+
+  union
+  {
+    /**
+     * An ECDSA identity key.
+     */
+    struct GNUNET_CRYPTO_EcdsaPublicKey ecdsa_key;
+
+    /**
+     * AN EdDSA identtiy key
+     */
+    struct GNUNET_CRYPTO_EddsaPublicKey eddsa_key;
+  };
+};
+
+
+/**
+ * An identity signature as per LSD0001.
+ */
+struct GNUNET_CRYPTO_Signature
+{
+  /**
+   * Type of signature.
+   * Defined by the GNS zone type value.
+   * In NBO.
+   */
+  uint32_t type;
+
+  union
+  {
+    /**
+     * An ECDSA signature
+     */
+    struct GNUNET_CRYPTO_EcdsaSignature ecdsa_signature;
+
+    /**
+     * AN EdDSA signature
+     */
+    struct GNUNET_CRYPTO_EddsaSignature eddsa_signature;
+  };
+};
 
 /**
  * @brief type for session keys
@@ -3073,6 +3172,473 @@ GNUNET_CRYPTO_cs_verify (const struct 
GNUNET_CRYPTO_CsSignature *sig,
                          size_t msg_len);
 
 
+/**
+ * Get the compacted length of a #GNUNET_CRYPTO_PublicKey.
+ * Compacted means that it returns the minimum number of bytes this
+ * key is long, as opposed to the union structure inside
+ * #GNUNET_CRYPTO_PublicKey.
+ * Useful for compact serializations.
+ *
+ * @param key the key.
+ * @return -1 on error, else the compacted length of the key.
+ */
+ssize_t
+GNUNET_CRYPTO_public_key_get_length (const struct
+                                       GNUNET_CRYPTO_PublicKey *key);
+
+/**
+ * Reads a #GNUNET_CRYPTO_PublicKey from a compact buffer.
+ * The buffer has to contain at least the compacted length of
+ * a #GNUNET_CRYPTO_PublicKey in bytes.
+ * If the buffer is too small, the function returns -1 as error.
+ * If the buffer does not contain a valid key, it returns -2 as error.
+ *
+ * @param buffer the buffer
+ * @param len the length of buffer
+ * @param key the key
+ * @param the amount of bytes read from the buffer
+ * @return #GNUNET_SYSERR on error
+ */
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_read_public_key_from_buffer (
+  const void *buffer,
+  size_t len,
+  struct GNUNET_CRYPTO_PublicKey *key,
+  size_t *read);
+
+/**
+ * Get the compacted length of a #GNUNET_CRYPTO_PrivateKey.
+ * Compacted means that it returns the minimum number of bytes this
+ * key is long, as opposed to the union structure inside
+ * #GNUNET_CRYPTO_PrivateKey.
+ * Useful for compact serializations.
+ *
+ * @param key the key.
+ * @return -1 on error, else the compacted length of the key.
+ */
+ssize_t
+GNUNET_CRYPTO_private_key_get_length (
+  const struct GNUNET_CRYPTO_PrivateKey *key);
+
+
+/**
+ * Writes a #GNUNET_CRYPTO_PublicKey to a compact buffer.
+ * The buffer requires space for at least the compacted length of
+ * a #GNUNET_CRYPTO_PublicKey in bytes.
+ * If the buffer is too small, the function returns -1 as error.
+ * If the key is not valid, it returns -2 as error.
+ *
+ * @param key the key
+ * @param buffer the buffer
+ * @param len the length of buffer
+ * @return -1 or -2 on error, else the amount of bytes written to the buffer
+ */
+ssize_t
+GNUNET_CRYPTO_write_public_key_to_buffer (const struct
+                                            GNUNET_CRYPTO_PublicKey *key,
+                                            void*buffer,
+                                            size_t len);
+
+
+/**
+ * Reads a #GNUNET_CRYPTO_PrivateKey from a compact buffer.
+ * The buffer has to contain at least the compacted length of
+ * a #GNUNET_CRYPTO_PrivateKey in bytes.
+ * If the buffer is too small, the function returns GNUNET_SYSERR as error.
+ *
+ * @param buffer the buffer
+ * @param len the length of buffer
+ * @param key the key
+ * @param the amount of bytes read from the buffer
+ * @return #GNUNET_SYSERR on error
+ */
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_read_private_key_from_buffer (
+  const void*buffer,
+  size_t len,
+  struct GNUNET_CRYPTO_PrivateKey *key,
+  size_t *read);
+
+
+/**
+ * Writes a #GNUNET_CRYPTO_PrivateKey to a compact buffer.
+ * The buffer requires space for at least the compacted length of
+ * a #GNUNET_CRYPTO_PrivateKey in bytes.
+ * If the buffer is too small, the function returns -1 as error.
+ * If the key is not valid, it returns -2 as error.
+ *
+ * @param key the key
+ * @param buffer the buffer
+ * @param len the length of buffer
+ * @return -1 or -2 on error, else the amount of bytes written to the buffer
+ */
+ssize_t
+GNUNET_CRYPTO_write_private_key_to_buffer (
+  const struct GNUNET_CRYPTO_PrivateKey *key,
+  void*buffer,
+  size_t len);
+
+
+/**
+ * Get the compacted length of a #GNUNET_CRYPTO_Signature.
+ * Compacted means that it returns the minimum number of bytes this
+ * signature is long, as opposed to the union structure inside
+ * #GNUNET_CRYPTO_Signature.
+ * Useful for compact serializations.
+ *
+ * @param sig the signature.
+ * @return -1 on error, else the compacted length of the signature.
+ */
+ssize_t
+GNUNET_CRYPTO_signature_get_length (
+  const struct GNUNET_CRYPTO_Signature *sig);
+
+
+/**
+ * Get the compacted length of a signature by type.
+ * Compacted means that it returns the minimum number of bytes this
+ * signature is long, as opposed to the union structure inside
+ * #GNUNET_CRYPTO_Signature.
+ * Useful for compact serializations.
+ *
+ * @param sig the signature.
+ * @return -1 on error, else the compacted length of the signature.
+ */
+ssize_t
+GNUNET_CRYPTO_signature_get_raw_length_by_type (uint32_t type);
+
+
+/**
+ * Reads a #GNUNET_CRYPTO_Signature from a compact buffer.
+ * The buffer has to contain at least the compacted length of
+ * a #GNUNET_CRYPTO_Signature in bytes.
+ * If the buffer is too small, the function returns -1 as error.
+ * If the buffer does not contain a valid key, it returns -2 as error.
+ *
+ * @param sig the signature
+ * @param buffer the buffer
+ * @param len the length of buffer
+ * @return -1 or -2 on error, else the amount of bytes read from the buffer
+ */
+ssize_t
+GNUNET_CRYPTO_read_signature_from_buffer (
+  struct GNUNET_CRYPTO_Signature *sig,
+  const void*buffer,
+  size_t len);
+
+
+/**
+ * Writes a #GNUNET_CRYPTO_Signature to a compact buffer.
+ * The buffer requires space for at least the compacted length of
+ * a #GNUNET_CRYPTO_Signature in bytes.
+ * If the buffer is too small, the function returns -1 as error.
+ * If the key is not valid, it returns -2 as error.
+ *
+ * @param sig the signature
+ * @param buffer the buffer
+ * @param len the length of buffer
+ * @return -1 or -2 on error, else the amount of bytes written to the buffer
+ */
+ssize_t
+GNUNET_CRYPTO_write_signature_to_buffer (
+  const struct GNUNET_CRYPTO_Signature *sig,
+  void*buffer,
+  size_t len);
+
+
+/**
+ * @brief Sign a given block.
+ *
+ * The @a purpose data is the beginning of the data of which the signature is
+ * to be created. The `size` field in @a purpose must correctly indicate the
+ * number of bytes of the data structure, including its header. If possible,
+ * use #GNUNET_CRYPTO_sign() instead of this function.
+ *
+ * @param priv private key to use for the signing
+ * @param purpose what to sign (size, purpose)
+ * @param[out] sig where to write the signature
+ * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
+ */
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_sign_ (
+  const struct GNUNET_CRYPTO_PrivateKey *priv,
+  const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
+  struct GNUNET_CRYPTO_Signature *sig);
+
+/**
+ * @brief Sign a given block.
+ *
+ * The @a purpose data is the beginning of the data of which the signature is
+ * to be created. The `size` field in @a purpose must correctly indicate the
+ * number of bytes of the data structure, including its header.
+ * The signature payload and length depends on the key type.
+ *
+ * @param priv private key to use for the signing
+ * @param purpose what to sign (size, purpose)
+ * @param[out] sig where to write the signature
+ * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
+ */
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_sign_raw_ (
+  const struct GNUNET_CRYPTO_PrivateKey *priv,
+  const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
+  unsigned char *sig);
+
+
+/**
+ * @brief Sign a given block with #GNUNET_CRYPTO_PrivateKey.
+ *
+ * The @a ps data must be a fixed-size struct for which the signature is to be
+ * created. The `size` field in @a ps->purpose must correctly indicate the
+ * number of bytes of the data structure, including its header.
+ *
+ * @param priv private key to use for the signing
+ * @param ps packed struct with what to sign, MUST begin with a purpose
+ * @param[out] sig where to write the signature
+ */
+#define GNUNET_CRYPTO_sign(priv,ps,sig) do {                \
+          /* check size is set correctly */                                    
 \
+          GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps)));        
 \
+          /* check 'ps' begins with the purpose */                             
 \
+          GNUNET_static_assert (((void*) (ps)) ==                              
 \
+                                ((void*) &(ps)->purpose));                     
 \
+          GNUNET_assert (GNUNET_OK ==                                          
 \
+                         GNUNET_CRYPTO_sign_ (priv,               \
+                                                &(ps)->purpose,             \
+                                                sig));                      \
+} while (0)
+
+
+/**
+ * @brief Verify a given signature.
+ *
+ * The @a validate data is the beginning of the data of which the signature
+ * is to be verified. The `size` field in @a validate must correctly indicate
+ * the number of bytes of the data structure, including its header.  If @a
+ * purpose does not match the purpose given in @a validate (the latter must be
+ * in big endian), signature verification fails.  If possible,
+ * use #GNUNET_CRYPTO_signature_verify() instead of this function (only if @a 
validate
+ * is not fixed-size, you must use this function directly).
+ *
+ * @param purpose what is the purpose that the signature should have?
+ * @param validate block to validate (size, purpose, data)
+ * @param sig signature that is being validated
+ * @param pub public key of the signer
+ * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid
+ */
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_signature_verify_ (
+  uint32_t purpose,
+  const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
+  const struct GNUNET_CRYPTO_Signature *sig,
+  const struct GNUNET_CRYPTO_PublicKey *pub);
+
+/**
+ * @brief Verify a given signature.
+ *
+ * The @a validate data is the beginning of the data of which the signature
+ * is to be verified. The `size` field in @a validate must correctly indicate
+ * the number of bytes of the data structure, including its header.  If @a
+ * purpose does not match the purpose given in @a validate (the latter must be
+ * in big endian), signature verification fails.
+ *
+ * @param purpose what is the purpose that the signature should have?
+ * @param validate block to validate (size, purpose, data)
+ * @param sig signature that is being validated
+ * @param pub public key of the signer
+ * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid
+ */
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_signature_verify_raw_ (
+  uint32_t purpose,
+  const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
+  const unsigned char *sig,
+  const struct GNUNET_CRYPTO_PublicKey *pub);
+
+
+/**
+ * @brief Verify a given signature with #GNUNET_CRYPTO_PublicKey.
+ *
+ * The @a ps data must be a fixed-size struct for which the signature is to be
+ * created. The `size` field in @a ps->purpose must correctly indicate the
+ * number of bytes of the data structure, including its header.
+ *
+ * @param purp purpose of the signature, must match 'ps->purpose.purpose'
+ *              (except in host byte order)
+ * @param ps packed struct with what to sign, MUST begin with a purpose
+ * @param sig where to read the signature from
+ * @param pub public key to use for the verifying
+ */
+#define GNUNET_CRYPTO_signature_verify(purp,ps,sig,pub) ({             \
+    /* check size is set correctly */                                     \
+    GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps)));         \
+    /* check 'ps' begins with the purpose */                              \
+    GNUNET_static_assert (((void*) (ps)) ==                               \
+                          ((void*) &(ps)->purpose));                      \
+    GNUNET_CRYPTO_signature_verify_ (purp,                              \
+                                       &(ps)->purpose,                    \
+                                       sig,                               \
+                                       pub);                              \
+  })
+
+
+/**
+ * Encrypt a block with #GNUNET_CRYPTO_PublicKey and derives a
+ * #GNUNET_CRYPTO_EcdhePublicKey which is required for decryption
+ * using ecdh to derive a symmetric key.
+ *
+ * @param block the block to encrypt
+ * @param size the size of the @a block
+ * @param pub public key to use for ecdh
+ * @param ecc where to write the ecc public key
+ * @param result the output parameter in which to store the encrypted result
+ *               can be the same or overlap with @c block
+ * @returns the size of the encrypted block, -1 for errors.
+ *          Due to the use of CFB and therefore an effective stream cipher,
+ *          this size should be the same as @c len.
+ */
+ssize_t
+GNUNET_CRYPTO_encrypt_old (const void *block,
+                             size_t size,
+                             const struct GNUNET_CRYPTO_PublicKey *pub,
+                             struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
+                             void *result);
+
+
+/**
+ * Decrypt a given block with #GNUNET_CRYPTO_PrivateKey and a given
+ * #GNUNET_CRYPTO_EcdhePublicKey using ecdh to derive a symmetric key.
+ *
+ * @param block the data to decrypt, encoded as returned by encrypt
+ * @param size the size of the @a block to decrypt
+ * @param priv private key to use for ecdh
+ * @param ecc the ecc public key
+ * @param result address to store the result at
+ *               can be the same or overlap with @c block
+ * @return -1 on failure, size of decrypted block on success.
+ *         Due to the use of CFB and therefore an effective stream cipher,
+ *         this size should be the same as @c size.
+ */
+ssize_t
+GNUNET_CRYPTO_decrypt_old (
+  const void *block,
+  size_t size,
+  const struct GNUNET_CRYPTO_PrivateKey *priv,
+  const struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
+  void *result);
+
+#define GNUNET_CRYPTO_ENCRYPT_OVERHEAD_BYTES (crypto_secretbox_MACBYTES \
+                                                + sizeof (struct \
+                                                          
GNUNET_CRYPTO_FoKemC))
+
+/**
+ * Encrypt a block with #GNUNET_CRYPTO_PublicKey and derives a
+ * #GNUNET_CRYPTO_EcdhePublicKey which is required for decryption
+ * using ecdh to derive a symmetric key.
+ *
+ * Note that the result buffer for the ciphertext must be the length of
+ * the message to encrypt plus #GNUNET_CRYPTO_ENCRYPT_OVERHEAD_BYTES.
+ *
+ * @param block the block to encrypt
+ * @param size the size of the @a block
+ * @param pub public key to encrypt for
+ * @param result the output parameter in which to store the encrypted result
+ *               can be the same or overlap with @c block
+ * @returns GNUNET_OK on success.
+ */
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_encrypt (const void *block,
+                         size_t size,
+                         const struct GNUNET_CRYPTO_PublicKey *pub,
+                         void *result,
+                         size_t result_size);
+
+
+/**
+ * Decrypt a given block with #GNUNET_CRYPTO_PrivateKey and a given
+ * #GNUNET_CRYPTO_EcdhePublicKey using ecdh to derive a symmetric key.
+ *
+ * @param block the data to decrypt, encoded as returned by encrypt
+ * @param size the size of the @a block to decrypt
+ * @param priv private key to use for ecdh
+ * @param result address to store the result at
+ *               can be the same or overlap with @c block
+ * @returns GNUNET_OK on success.
+ */
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_decrypt (const void *block,
+                         size_t size,
+                         const struct GNUNET_CRYPTO_PrivateKey *priv,
+                         void *result,
+                         size_t result_size);
+
+
+/**
+ * Creates a (Base32) string representation of the public key.
+ * The resulting string encodes a compacted representation of the key.
+ * See also #GNUNET_CRYPTO_key_get_length.
+ *
+ * @param key the key.
+ * @return the string representation of the key, or NULL on error.
+ */
+char *
+GNUNET_CRYPTO_public_key_to_string (
+  const struct GNUNET_CRYPTO_PublicKey *key);
+
+
+/**
+ * Creates a (Base32) string representation of the private key.
+ * The resulting string encodes a compacted representation of the key.
+ * See also #GNUNET_CRYPTO_key_get_length.
+ *
+ * @param key the key.
+ * @return the string representation of the key, or NULL on error.
+ */
+char *
+GNUNET_CRYPTO_private_key_to_string (
+  const struct GNUNET_CRYPTO_PrivateKey *key);
+
+
+/**
+ * Parses a (Base32) string representation of the public key.
+ * See also #GNUNET_CRYPTO_public_key_to_string.
+ *
+ * @param str the encoded key.
+ * @param key where to write the key.
+ * @return GNUNET_SYSERR on error.
+ */
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_public_key_from_string (const char*str,
+                                        struct GNUNET_CRYPTO_PublicKey *key);
+
+
+/**
+ * Parses a (Base32) string representation of the private key.
+ * See also #GNUNET_CRYPTO_private_key_to_string.
+ *
+ * @param str the encoded key.
+ * @param key where to write the key.
+ * @return GNUNET_SYSERR on error.
+ */
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_private_key_from_string (const char*str,
+                                         struct GNUNET_CRYPTO_PrivateKey *key);
+
+
+/**
+ * Retrieves the public key representation of a private key.
+ *
+ * @param privkey the private key.
+ * @param key the public key result.
+ * @return GNUNET_SYSERR on error.
+ */
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_key_get_public (const struct
+                                GNUNET_CRYPTO_PrivateKey *privkey,
+                                struct GNUNET_CRYPTO_PublicKey *key);
+
+
+
 #if 0 /* keep Emacsens' auto-indent happy */
 {
 #endif
diff --git a/src/include/gnunet_gns_service.h b/src/include/gnunet_gns_service.h
index 1fcf7aa8b..1f19e58ac 100644
--- a/src/include/gnunet_gns_service.h
+++ b/src/include/gnunet_gns_service.h
@@ -137,7 +137,7 @@ enum GNUNET_GNS_LocalOptions
 struct GNUNET_GNS_LookupRequest *
 GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
                    const char *name,
-                   const struct GNUNET_IDENTITY_PublicKey *zone,
+                   const struct GNUNET_CRYPTO_PublicKey *zone,
                    uint32_t type,
                    enum GNUNET_GNS_LocalOptions options,
                    GNUNET_GNS_LookupResultProcessor proc,
@@ -161,7 +161,7 @@ GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
 struct GNUNET_GNS_LookupRequest *
 GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle,
                            const char *name,
-                           const struct GNUNET_IDENTITY_PublicKey *zone,
+                           const struct GNUNET_CRYPTO_PublicKey *zone,
                            uint32_t type,
                            enum GNUNET_GNS_LocalOptions options,
                            uint16_t recursion_depth_limit,
diff --git a/src/include/gnunet_gnsrecord_lib.h 
b/src/include/gnunet_gnsrecord_lib.h
index 338f22223..d78e637e8 100644
--- a/src/include/gnunet_gnsrecord_lib.h
+++ b/src/include/gnunet_gnsrecord_lib.h
@@ -339,7 +339,7 @@ struct GNUNET_GNSRECORD_ReverseRecord
   /**
    * The public key of the namespace the is delegating to our namespace
    */
-  struct GNUNET_IDENTITY_PublicKey pkey;
+  struct GNUNET_CRYPTO_PublicKey pkey;
 
   /**
    * The expiration time of the delegation
@@ -494,7 +494,7 @@ GNUNET_GNSRECORD_string_normalize (const char *src);
  * #GNUNET_GNSRECORD_z2s.
  */
 const char *
-GNUNET_GNSRECORD_z2s (const struct GNUNET_IDENTITY_PublicKey *z);
+GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_PublicKey *z);
 
 
 /**
@@ -508,7 +508,7 @@ GNUNET_GNSRECORD_z2s (const struct 
GNUNET_IDENTITY_PublicKey *z);
  *         key in an encoding suitable for DNS labels.
  */
 const char *
-GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_IDENTITY_PublicKey *pkey);
+GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_PublicKey *pkey);
 
 
 /**
@@ -522,7 +522,7 @@ GNUNET_GNSRECORD_pkey_to_zkey (const struct 
GNUNET_IDENTITY_PublicKey *pkey);
  */
 int
 GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey,
-                               struct GNUNET_IDENTITY_PublicKey *pkey);
+                               struct GNUNET_CRYPTO_PublicKey *pkey);
 
 
 /**
@@ -534,7 +534,7 @@ GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey,
  */
 void
 GNUNET_GNSRECORD_query_from_private_key (
-  const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label,
+  const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label,
   struct GNUNET_HashCode *query);
 
 
@@ -548,7 +548,7 @@ GNUNET_GNSRECORD_query_from_private_key (
  */
 void
 GNUNET_GNSRECORD_query_from_public_key (
-  const struct GNUNET_IDENTITY_PublicKey *pub, const char *label,
+  const struct GNUNET_CRYPTO_PublicKey *pub, const char *label,
   struct GNUNET_HashCode *query);
 
 
@@ -562,7 +562,7 @@ GNUNET_GNSRECORD_query_from_public_key (
  */
 ssize_t
 GNUNET_GNSRECORD_block_calculate_size (const struct
-                                       GNUNET_IDENTITY_PrivateKey *key,
+                                       GNUNET_CRYPTO_PrivateKey *key,
                                        const struct GNUNET_GNSRECORD_Data *rd,
                                        unsigned int rd_count);
 
@@ -576,7 +576,7 @@ GNUNET_GNSRECORD_block_calculate_size (const struct
  */
 enum GNUNET_GenericReturnValue
 GNUNET_GNSRECORD_block_sign (const struct
-                             GNUNET_IDENTITY_PrivateKey *key,
+                             GNUNET_CRYPTO_PrivateKey *key,
                              const char *label,
                              struct GNUNET_GNSRECORD_Block *block);
 
@@ -592,7 +592,7 @@ GNUNET_GNSRECORD_block_sign (const struct
  * @return GNUNET_OK on success
  */
 enum GNUNET_GenericReturnValue
-GNUNET_GNSRECORD_block_create (const struct GNUNET_IDENTITY_PrivateKey *key,
+GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_PrivateKey *key,
                                struct GNUNET_TIME_Absolute expire,
                                const char *label,
                                const struct GNUNET_GNSRECORD_Data *rd,
@@ -617,7 +617,7 @@ GNUNET_GNSRECORD_block_create (const struct 
GNUNET_IDENTITY_PrivateKey *key,
  */
 enum GNUNET_GenericReturnValue
 GNUNET_GNSRECORD_block_create_unsigned (const struct
-                                        GNUNET_IDENTITY_PrivateKey *key,
+                                        GNUNET_CRYPTO_PrivateKey *key,
                                         struct GNUNET_TIME_Absolute expire,
                                         const char *label,
                                         const struct GNUNET_GNSRECORD_Data *rd,
@@ -639,7 +639,7 @@ GNUNET_GNSRECORD_block_create_unsigned (const struct
  * @return GNUNET_OK on success.
  */
 enum GNUNET_GenericReturnValue
-GNUNET_GNSRECORD_block_create2 (const struct GNUNET_IDENTITY_PrivateKey *key,
+GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_PrivateKey *key,
                                 struct GNUNET_TIME_Absolute expire,
                                 const char *label,
                                 const struct GNUNET_GNSRECORD_Data *rd,
@@ -672,7 +672,7 @@ GNUNET_GNSRECORD_block_verify (const struct 
GNUNET_GNSRECORD_Block *block);
 enum GNUNET_GenericReturnValue
 GNUNET_GNSRECORD_block_decrypt (
   const struct GNUNET_GNSRECORD_Block *block,
-  const struct GNUNET_IDENTITY_PublicKey *zone_key, const char *label,
+  const struct GNUNET_CRYPTO_PublicKey *zone_key, const char *label,
   GNUNET_GNSRECORD_RecordCallback proc, void *proc_cls);
 
 
@@ -752,7 +752,7 @@ enum GNUNET_GenericReturnValue
 GNUNET_GNSRECORD_identity_from_data (const char *data,
                                      size_t data_size,
                                      uint32_t type,
-                                     struct GNUNET_IDENTITY_PublicKey *key);
+                                     struct GNUNET_CRYPTO_PublicKey *key);
 
 
 /**
@@ -766,7 +766,7 @@ GNUNET_GNSRECORD_identity_from_data (const char *data,
  */
 enum GNUNET_GenericReturnValue
 GNUNET_GNSRECORD_data_from_identity (const struct
-                                     GNUNET_IDENTITY_PublicKey *key,
+                                     GNUNET_CRYPTO_PublicKey *key,
                                      char **data,
                                      size_t *data_size,
                                      uint32_t *type);
diff --git a/src/include/gnunet_identity_service.h 
b/src/include/gnunet_identity_service.h
index fd0458f62..4743dbf7e 100644
--- a/src/include/gnunet_identity_service.h
+++ b/src/include/gnunet_identity_service.h
@@ -62,20 +62,6 @@ extern "C" {
  */
 #define GNUNET_IDENTITY_VERSION 0x00000100
 
-enum GNUNET_IDENTITY_KeyType
-{
-  /**
-   * The identity type. The value is the same as the
-   * PKEY record type.
-   */
-  GNUNET_IDENTITY_TYPE_ECDSA = 65536,
-
-  /**
-   * EDDSA identity. The value is the same as the EDKEY
-   * record type.
-   */
-  GNUNET_IDENTITY_TYPE_EDDSA = 65556
-};
 
 /**
  * Handle to access the identity service.
@@ -87,89 +73,6 @@ struct GNUNET_IDENTITY_Handle;
  */
 struct GNUNET_IDENTITY_Ego;
 
-/**
- * A private key for an identity as per LSD0001.
- * Note that these types are NOT packed and MUST NOT be used in RPC
- * messages. Use the respective serialization functions.
- */
-struct GNUNET_IDENTITY_PrivateKey
-{
-  /**
-   * Type of public key.
-   * Defined by the GNS zone type value.
-   * In NBO.
-   */
-  uint32_t type;
-
-  union
-  {
-    /**
-     * An ECDSA identity key.
-     */
-    struct GNUNET_CRYPTO_EcdsaPrivateKey ecdsa_key;
-
-    /**
-     * AN EdDSA identtiy key
-     */
-    struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_key;
-  };
-};
-
-
-/**
- * An identity key as per LSD0001.
- */
-struct GNUNET_IDENTITY_PublicKey
-{
-  /**
-   * Type of public key.
-   * Defined by the GNS zone type value.
-   * In NBO.
-   */
-  uint32_t type;
-
-  union
-  {
-    /**
-     * An ECDSA identity key.
-     */
-    struct GNUNET_CRYPTO_EcdsaPublicKey ecdsa_key;
-
-    /**
-     * AN EdDSA identtiy key
-     */
-    struct GNUNET_CRYPTO_EddsaPublicKey eddsa_key;
-  };
-};
-
-
-/**
- * An identity signature as per LSD0001.
- */
-struct GNUNET_IDENTITY_Signature
-{
-  /**
-   * Type of signature.
-   * Defined by the GNS zone type value.
-   * In NBO.
-   */
-  uint32_t type;
-
-  union
-  {
-    /**
-     * An ECDSA signature
-     */
-    struct GNUNET_CRYPTO_EcdsaSignature ecdsa_signature;
-
-    /**
-     * AN EdDSA signature
-     */
-    struct GNUNET_CRYPTO_EddsaSignature eddsa_signature;
-  };
-};
-
-
 /**
  * Handle for an operation with the identity service.
  */
@@ -182,7 +85,7 @@ struct GNUNET_IDENTITY_Operation;
  * @param ego the ego
  * @return associated ECC key, valid as long as the ego is valid
  */
-const struct GNUNET_IDENTITY_PrivateKey *
+const struct GNUNET_CRYPTO_PrivateKey *
 GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego);
 
 
@@ -203,7 +106,7 @@ GNUNET_IDENTITY_ego_get_anonymous (void);
  */
 void
 GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego,
-                                    struct GNUNET_IDENTITY_PublicKey *pk);
+                                    struct GNUNET_CRYPTO_PublicKey *pk);
 
 
 /**
@@ -326,7 +229,7 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle 
*h);
 typedef void
 (*GNUNET_IDENTITY_CreateContinuation) (
   void *cls,
-  const struct GNUNET_IDENTITY_PrivateKey *pk,
+  const struct GNUNET_CRYPTO_PrivateKey *pk,
   enum GNUNET_ErrorCode ec);
 
 
@@ -344,8 +247,8 @@ typedef void
 struct GNUNET_IDENTITY_Operation *
 GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id,
                         const char *name,
-                        const struct GNUNET_IDENTITY_PrivateKey *privkey,
-                        enum GNUNET_IDENTITY_KeyType ktype,
+                        const struct GNUNET_CRYPTO_PrivateKey *privkey,
+                        enum GNUNET_CRYPTO_KeyType ktype,
                         GNUNET_IDENTITY_CreateContinuation cont,
                         void *cont_cls);
 
@@ -396,472 +299,6 @@ void
 GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op);
 
 
-/**
- * Get the compacted length of a #GNUNET_IDENTITY_PublicKey.
- * Compacted means that it returns the minimum number of bytes this
- * key is long, as opposed to the union structure inside
- * #GNUNET_IDENTITY_PublicKey.
- * Useful for compact serializations.
- *
- * @param key the key.
- * @return -1 on error, else the compacted length of the key.
- */
-ssize_t
-GNUNET_IDENTITY_public_key_get_length (const struct
-                                       GNUNET_IDENTITY_PublicKey *key);
-
-/**
- * Reads a #GNUNET_IDENTITY_PublicKey from a compact buffer.
- * The buffer has to contain at least the compacted length of
- * a #GNUNET_IDENTITY_PublicKey in bytes.
- * If the buffer is too small, the function returns -1 as error.
- * If the buffer does not contain a valid key, it returns -2 as error.
- *
- * @param buffer the buffer
- * @param len the length of buffer
- * @param key the key
- * @param the amount of bytes read from the buffer
- * @return #GNUNET_SYSERR on error
- */
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_read_public_key_from_buffer (
-  const void *buffer,
-  size_t len,
-  struct GNUNET_IDENTITY_PublicKey *key,
-  size_t *read);
-
-/**
- * Get the compacted length of a #GNUNET_IDENTITY_PrivateKey.
- * Compacted means that it returns the minimum number of bytes this
- * key is long, as opposed to the union structure inside
- * #GNUNET_IDENTITY_PrivateKey.
- * Useful for compact serializations.
- *
- * @param key the key.
- * @return -1 on error, else the compacted length of the key.
- */
-ssize_t
-GNUNET_IDENTITY_private_key_get_length (
-  const struct GNUNET_IDENTITY_PrivateKey *key);
-
-
-/**
- * Writes a #GNUNET_IDENTITY_PublicKey to a compact buffer.
- * The buffer requires space for at least the compacted length of
- * a #GNUNET_IDENTITY_PublicKey in bytes.
- * If the buffer is too small, the function returns -1 as error.
- * If the key is not valid, it returns -2 as error.
- *
- * @param key the key
- * @param buffer the buffer
- * @param len the length of buffer
- * @return -1 or -2 on error, else the amount of bytes written to the buffer
- */
-ssize_t
-GNUNET_IDENTITY_write_public_key_to_buffer (const struct
-                                            GNUNET_IDENTITY_PublicKey *key,
-                                            void*buffer,
-                                            size_t len);
-
-
-/**
- * Reads a #GNUNET_IDENTITY_PrivateKey from a compact buffer.
- * The buffer has to contain at least the compacted length of
- * a #GNUNET_IDENTITY_PrivateKey in bytes.
- * If the buffer is too small, the function returns GNUNET_SYSERR as error.
- *
- * @param buffer the buffer
- * @param len the length of buffer
- * @param key the key
- * @param the amount of bytes read from the buffer
- * @return #GNUNET_SYSERR on error
- */
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_read_private_key_from_buffer (
-  const void*buffer,
-  size_t len,
-  struct GNUNET_IDENTITY_PrivateKey *key,
-  size_t *read);
-
-
-/**
- * Writes a #GNUNET_IDENTITY_PrivateKey to a compact buffer.
- * The buffer requires space for at least the compacted length of
- * a #GNUNET_IDENTITY_PrivateKey in bytes.
- * If the buffer is too small, the function returns -1 as error.
- * If the key is not valid, it returns -2 as error.
- *
- * @param key the key
- * @param buffer the buffer
- * @param len the length of buffer
- * @return -1 or -2 on error, else the amount of bytes written to the buffer
- */
-ssize_t
-GNUNET_IDENTITY_write_private_key_to_buffer (
-  const struct GNUNET_IDENTITY_PrivateKey *key,
-  void*buffer,
-  size_t len);
-
-
-/**
- * Get the compacted length of a #GNUNET_IDENTITY_Signature.
- * Compacted means that it returns the minimum number of bytes this
- * signature is long, as opposed to the union structure inside
- * #GNUNET_IDENTITY_Signature.
- * Useful for compact serializations.
- *
- * @param sig the signature.
- * @return -1 on error, else the compacted length of the signature.
- */
-ssize_t
-GNUNET_IDENTITY_signature_get_length (
-  const struct GNUNET_IDENTITY_Signature *sig);
-
-
-/**
- * Get the compacted length of a signature by type.
- * Compacted means that it returns the minimum number of bytes this
- * signature is long, as opposed to the union structure inside
- * #GNUNET_IDENTITY_Signature.
- * Useful for compact serializations.
- *
- * @param sig the signature.
- * @return -1 on error, else the compacted length of the signature.
- */
-ssize_t
-GNUNET_IDENTITY_signature_get_raw_length_by_type (uint32_t type);
-
-
-/**
- * Reads a #GNUNET_IDENTITY_Signature from a compact buffer.
- * The buffer has to contain at least the compacted length of
- * a #GNUNET_IDENTITY_Signature in bytes.
- * If the buffer is too small, the function returns -1 as error.
- * If the buffer does not contain a valid key, it returns -2 as error.
- *
- * @param sig the signature
- * @param buffer the buffer
- * @param len the length of buffer
- * @return -1 or -2 on error, else the amount of bytes read from the buffer
- */
-ssize_t
-GNUNET_IDENTITY_read_signature_from_buffer (
-  struct GNUNET_IDENTITY_Signature *sig,
-  const void*buffer,
-  size_t len);
-
-
-/**
- * Writes a #GNUNET_IDENTITY_Signature to a compact buffer.
- * The buffer requires space for at least the compacted length of
- * a #GNUNET_IDENTITY_Signature in bytes.
- * If the buffer is too small, the function returns -1 as error.
- * If the key is not valid, it returns -2 as error.
- *
- * @param sig the signature
- * @param buffer the buffer
- * @param len the length of buffer
- * @return -1 or -2 on error, else the amount of bytes written to the buffer
- */
-ssize_t
-GNUNET_IDENTITY_write_signature_to_buffer (
-  const struct GNUNET_IDENTITY_Signature *sig,
-  void*buffer,
-  size_t len);
-
-
-/**
- * @brief Sign a given block.
- *
- * The @a purpose data is the beginning of the data of which the signature is
- * to be created. The `size` field in @a purpose must correctly indicate the
- * number of bytes of the data structure, including its header. If possible,
- * use #GNUNET_IDENTITY_sign() instead of this function.
- *
- * @param priv private key to use for the signing
- * @param purpose what to sign (size, purpose)
- * @param[out] sig where to write the signature
- * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
- */
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_sign_ (
-  const struct GNUNET_IDENTITY_PrivateKey *priv,
-  const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
-  struct GNUNET_IDENTITY_Signature *sig);
-
-/**
- * @brief Sign a given block.
- *
- * The @a purpose data is the beginning of the data of which the signature is
- * to be created. The `size` field in @a purpose must correctly indicate the
- * number of bytes of the data structure, including its header.
- * The signature payload and length depends on the key type.
- *
- * @param priv private key to use for the signing
- * @param purpose what to sign (size, purpose)
- * @param[out] sig where to write the signature
- * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
- */
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_sign_raw_ (
-  const struct GNUNET_IDENTITY_PrivateKey *priv,
-  const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
-  unsigned char *sig);
-
-
-/**
- * @brief Sign a given block with #GNUNET_IDENTITY_PrivateKey.
- *
- * The @a ps data must be a fixed-size struct for which the signature is to be
- * created. The `size` field in @a ps->purpose must correctly indicate the
- * number of bytes of the data structure, including its header.
- *
- * @param priv private key to use for the signing
- * @param ps packed struct with what to sign, MUST begin with a purpose
- * @param[out] sig where to write the signature
- */
-#define GNUNET_IDENTITY_sign(priv,ps,sig) do {                \
-          /* check size is set correctly */                                    
 \
-          GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps)));        
 \
-          /* check 'ps' begins with the purpose */                             
 \
-          GNUNET_static_assert (((void*) (ps)) ==                              
 \
-                                ((void*) &(ps)->purpose));                     
 \
-          GNUNET_assert (GNUNET_OK ==                                          
 \
-                         GNUNET_IDENTITY_sign_ (priv,               \
-                                                &(ps)->purpose,             \
-                                                sig));                      \
-} while (0)
-
-
-/**
- * @brief Verify a given signature.
- *
- * The @a validate data is the beginning of the data of which the signature
- * is to be verified. The `size` field in @a validate must correctly indicate
- * the number of bytes of the data structure, including its header.  If @a
- * purpose does not match the purpose given in @a validate (the latter must be
- * in big endian), signature verification fails.  If possible,
- * use #GNUNET_IDENTITY_signature_verify() instead of this function (only if 
@a validate
- * is not fixed-size, you must use this function directly).
- *
- * @param purpose what is the purpose that the signature should have?
- * @param validate block to validate (size, purpose, data)
- * @param sig signature that is being validated
- * @param pub public key of the signer
- * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid
- */
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_signature_verify_ (
-  uint32_t purpose,
-  const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
-  const struct GNUNET_IDENTITY_Signature *sig,
-  const struct GNUNET_IDENTITY_PublicKey *pub);
-
-/**
- * @brief Verify a given signature.
- *
- * The @a validate data is the beginning of the data of which the signature
- * is to be verified. The `size` field in @a validate must correctly indicate
- * the number of bytes of the data structure, including its header.  If @a
- * purpose does not match the purpose given in @a validate (the latter must be
- * in big endian), signature verification fails.
- *
- * @param purpose what is the purpose that the signature should have?
- * @param validate block to validate (size, purpose, data)
- * @param sig signature that is being validated
- * @param pub public key of the signer
- * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid
- */
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_signature_verify_raw_ (
-  uint32_t purpose,
-  const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
-  const unsigned char *sig,
-  const struct GNUNET_IDENTITY_PublicKey *pub);
-
-
-/**
- * @brief Verify a given signature with #GNUNET_IDENTITY_PublicKey.
- *
- * The @a ps data must be a fixed-size struct for which the signature is to be
- * created. The `size` field in @a ps->purpose must correctly indicate the
- * number of bytes of the data structure, including its header.
- *
- * @param purp purpose of the signature, must match 'ps->purpose.purpose'
- *              (except in host byte order)
- * @param ps packed struct with what to sign, MUST begin with a purpose
- * @param sig where to read the signature from
- * @param pub public key to use for the verifying
- */
-#define GNUNET_IDENTITY_signature_verify(purp,ps,sig,pub) ({             \
-    /* check size is set correctly */                                     \
-    GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps)));         \
-    /* check 'ps' begins with the purpose */                              \
-    GNUNET_static_assert (((void*) (ps)) ==                               \
-                          ((void*) &(ps)->purpose));                      \
-    GNUNET_IDENTITY_signature_verify_ (purp,                              \
-                                       &(ps)->purpose,                    \
-                                       sig,                               \
-                                       pub);                              \
-  })
-
-
-/**
- * Encrypt a block with #GNUNET_IDENTITY_PublicKey and derives a
- * #GNUNET_CRYPTO_EcdhePublicKey which is required for decryption
- * using ecdh to derive a symmetric key.
- *
- * @param block the block to encrypt
- * @param size the size of the @a block
- * @param pub public key to use for ecdh
- * @param ecc where to write the ecc public key
- * @param result the output parameter in which to store the encrypted result
- *               can be the same or overlap with @c block
- * @returns the size of the encrypted block, -1 for errors.
- *          Due to the use of CFB and therefore an effective stream cipher,
- *          this size should be the same as @c len.
- */
-ssize_t
-GNUNET_IDENTITY_encrypt_old (const void *block,
-                             size_t size,
-                             const struct GNUNET_IDENTITY_PublicKey *pub,
-                             struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
-                             void *result);
-
-
-/**
- * Decrypt a given block with #GNUNET_IDENTITY_PrivateKey and a given
- * #GNUNET_CRYPTO_EcdhePublicKey using ecdh to derive a symmetric key.
- *
- * @param block the data to decrypt, encoded as returned by encrypt
- * @param size the size of the @a block to decrypt
- * @param priv private key to use for ecdh
- * @param ecc the ecc public key
- * @param result address to store the result at
- *               can be the same or overlap with @c block
- * @return -1 on failure, size of decrypted block on success.
- *         Due to the use of CFB and therefore an effective stream cipher,
- *         this size should be the same as @c size.
- */
-ssize_t
-GNUNET_IDENTITY_decrypt_old (
-  const void *block,
-  size_t size,
-  const struct GNUNET_IDENTITY_PrivateKey *priv,
-  const struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
-  void *result);
-
-#define GNUNET_IDENTITY_ENCRYPT_OVERHEAD_BYTES (crypto_secretbox_MACBYTES \
-                                                + sizeof (struct \
-                                                          
GNUNET_CRYPTO_FoKemC))
-
-/**
- * Encrypt a block with #GNUNET_IDENTITY_PublicKey and derives a
- * #GNUNET_CRYPTO_EcdhePublicKey which is required for decryption
- * using ecdh to derive a symmetric key.
- *
- * Note that the result buffer for the ciphertext must be the length of
- * the message to encrypt plus #GNUNET_IDENTITY_ENCRYPT_OVERHEAD_BYTES.
- *
- * @param block the block to encrypt
- * @param size the size of the @a block
- * @param pub public key to encrypt for
- * @param result the output parameter in which to store the encrypted result
- *               can be the same or overlap with @c block
- * @returns GNUNET_OK on success.
- */
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_encrypt (const void *block,
-                         size_t size,
-                         const struct GNUNET_IDENTITY_PublicKey *pub,
-                         void *result,
-                         size_t result_size);
-
-
-/**
- * Decrypt a given block with #GNUNET_IDENTITY_PrivateKey and a given
- * #GNUNET_CRYPTO_EcdhePublicKey using ecdh to derive a symmetric key.
- *
- * @param block the data to decrypt, encoded as returned by encrypt
- * @param size the size of the @a block to decrypt
- * @param priv private key to use for ecdh
- * @param result address to store the result at
- *               can be the same or overlap with @c block
- * @returns GNUNET_OK on success.
- */
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_decrypt (const void *block,
-                         size_t size,
-                         const struct GNUNET_IDENTITY_PrivateKey *priv,
-                         void *result,
-                         size_t result_size);
-
-
-/**
- * Creates a (Base32) string representation of the public key.
- * The resulting string encodes a compacted representation of the key.
- * See also #GNUNET_IDENTITY_key_get_length.
- *
- * @param key the key.
- * @return the string representation of the key, or NULL on error.
- */
-char *
-GNUNET_IDENTITY_public_key_to_string (
-  const struct GNUNET_IDENTITY_PublicKey *key);
-
-
-/**
- * Creates a (Base32) string representation of the private key.
- * The resulting string encodes a compacted representation of the key.
- * See also #GNUNET_IDENTITY_key_get_length.
- *
- * @param key the key.
- * @return the string representation of the key, or NULL on error.
- */
-char *
-GNUNET_IDENTITY_private_key_to_string (
-  const struct GNUNET_IDENTITY_PrivateKey *key);
-
-
-/**
- * Parses a (Base32) string representation of the public key.
- * See also #GNUNET_IDENTITY_public_key_to_string.
- *
- * @param str the encoded key.
- * @param key where to write the key.
- * @return GNUNET_SYSERR on error.
- */
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_public_key_from_string (const char*str,
-                                        struct GNUNET_IDENTITY_PublicKey *key);
-
-
-/**
- * Parses a (Base32) string representation of the private key.
- * See also #GNUNET_IDENTITY_private_key_to_string.
- *
- * @param str the encoded key.
- * @param key where to write the key.
- * @return GNUNET_SYSERR on error.
- */
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_private_key_from_string (const char*str,
-                                         struct GNUNET_IDENTITY_PrivateKey 
*key);
-
-
-/**
- * Retrieves the public key representation of a private key.
- *
- * @param privkey the private key.
- * @param key the public key result.
- * @return GNUNET_SYSERR on error.
- */
-enum GNUNET_GenericReturnValue
-GNUNET_IDENTITY_key_get_public (const struct
-                                GNUNET_IDENTITY_PrivateKey *privkey,
-                                struct GNUNET_IDENTITY_PublicKey *key);
-
-
 /* ************* convenience API to lookup an ego ***************** */
 
 /**
@@ -914,7 +351,7 @@ GNUNET_IDENTITY_ego_lookup_cancel (struct 
GNUNET_IDENTITY_EgoLookup *el);
 typedef void
 (*GNUNET_IDENTITY_EgoSuffixCallback) (
   void *cls,
-  const struct GNUNET_IDENTITY_PrivateKey *priv,
+  const struct GNUNET_CRYPTO_PrivateKey *priv,
   const char *ego_name);
 
 
diff --git a/src/include/gnunet_messenger_service.h 
b/src/include/gnunet_messenger_service.h
index 5f4207d2f..90004826a 100644
--- a/src/include/gnunet_messenger_service.h
+++ b/src/include/gnunet_messenger_service.h
@@ -224,7 +224,7 @@ struct GNUNET_MESSENGER_MessageHeader
   /**
    * The signature of the senders private key.
    */
-  struct GNUNET_IDENTITY_Signature signature;
+  struct GNUNET_CRYPTO_Signature signature;
 
   /**
    * The timestamp of the message.
@@ -258,7 +258,7 @@ struct GNUNET_MESSENGER_MessageInfo
   /**
    * The senders key to verify its signatures.
    */
-  struct GNUNET_IDENTITY_PublicKey host_key;
+  struct GNUNET_CRYPTO_PublicKey host_key;
 
   /**
    * The version of GNUnet Messenger API.
@@ -281,7 +281,7 @@ struct GNUNET_MESSENGER_MessageJoin
   /**
    * The senders public key to verify its signatures.
    */
-  struct GNUNET_IDENTITY_PublicKey key;
+  struct GNUNET_CRYPTO_PublicKey key;
 };
 
 /**
@@ -319,7 +319,7 @@ struct GNUNET_MESSENGER_MessageKey
   /**
    * The new public key which replaces the current senders public key.
    */
-  struct GNUNET_IDENTITY_PublicKey key;
+  struct GNUNET_CRYPTO_PublicKey key;
 };
 
 /**
@@ -671,7 +671,7 @@ GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle 
*handle,
  * @param[in] handle Messenger handle to use
  * @return Used ego's public key or NULL
  */
-const struct GNUNET_IDENTITY_PublicKey*
+const struct GNUNET_CRYPTO_PublicKey*
 GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle);
 
 /**
@@ -783,7 +783,7 @@ GNUNET_MESSENGER_contact_get_name (const struct 
GNUNET_MESSENGER_Contact *contac
  * @param[in] contact Contact handle
  * @return Public key of the ego used by <i>contact</i> or NULL
  */
-const struct GNUNET_IDENTITY_PublicKey*
+const struct GNUNET_CRYPTO_PublicKey*
 GNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact 
*contact);
 
 /**
diff --git a/src/include/gnunet_namestore_plugin.h 
b/src/include/gnunet_namestore_plugin.h
index f2bdf7cc6..d8dde5af5 100644
--- a/src/include/gnunet_namestore_plugin.h
+++ b/src/include/gnunet_namestore_plugin.h
@@ -62,7 +62,7 @@ typedef void
 (*GNUNET_NAMESTORE_RecordIterator) (void *cls,
                                     uint64_t serial,
                                     const struct
-                                    GNUNET_IDENTITY_PrivateKey *private_key,
+                                    GNUNET_CRYPTO_PrivateKey *private_key,
                                     const char *label,
                                     unsigned int rd_count,
                                     const struct GNUNET_GNSRECORD_Data *rd);
@@ -91,7 +91,7 @@ struct GNUNET_NAMESTORE_PluginFunctions
    */
   enum GNUNET_GenericReturnValue
   (*store_records)(void *cls,
-                   const struct GNUNET_IDENTITY_PrivateKey *zone,
+                   const struct GNUNET_CRYPTO_PrivateKey *zone,
                    const char *label,
                    unsigned int rd_count,
                    const struct GNUNET_GNSRECORD_Data *rd);
@@ -108,7 +108,7 @@ struct GNUNET_NAMESTORE_PluginFunctions
    */
   enum GNUNET_GenericReturnValue
   (*lookup_records)(void *cls,
-                    const struct GNUNET_IDENTITY_PrivateKey *zone,
+                    const struct GNUNET_CRYPTO_PrivateKey *zone,
                     const char *label,
                     GNUNET_NAMESTORE_RecordIterator iter,
                     void *iter_cls);
@@ -130,7 +130,7 @@ struct GNUNET_NAMESTORE_PluginFunctions
    */
   enum GNUNET_GenericReturnValue
   (*iterate_records)(void *cls,
-                     const struct GNUNET_IDENTITY_PrivateKey *zone,
+                     const struct GNUNET_CRYPTO_PrivateKey *zone,
                      uint64_t serial,
                      uint64_t limit,
                      GNUNET_NAMESTORE_RecordIterator iter,
@@ -150,8 +150,8 @@ struct GNUNET_NAMESTORE_PluginFunctions
    */
   enum GNUNET_GenericReturnValue
   (*zone_to_name)(void *cls,
-                  const struct GNUNET_IDENTITY_PrivateKey *zone,
-                  const struct GNUNET_IDENTITY_PublicKey *value_zone,
+                  const struct GNUNET_CRYPTO_PrivateKey *zone,
+                  const struct GNUNET_CRYPTO_PublicKey *value_zone,
                   GNUNET_NAMESTORE_RecordIterator iter,
                   void *iter_cls);
 
@@ -201,7 +201,7 @@ struct GNUNET_NAMESTORE_PluginFunctions
    */
   enum GNUNET_GenericReturnValue
   (*edit_records)(void *cls,
-                  const struct GNUNET_IDENTITY_PrivateKey *zone,
+                  const struct GNUNET_CRYPTO_PrivateKey *zone,
                   const char *label,
                   GNUNET_NAMESTORE_RecordIterator iter,
                   void *iter_cls);
diff --git a/src/include/gnunet_namestore_service.h 
b/src/include/gnunet_namestore_service.h
index b93a345c7..61691ff55 100644
--- a/src/include/gnunet_namestore_service.h
+++ b/src/include/gnunet_namestore_service.h
@@ -153,7 +153,7 @@ typedef void
  */
 struct GNUNET_NAMESTORE_QueueEntry *
 GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h,
-                                const struct GNUNET_IDENTITY_PrivateKey *pkey,
+                                const struct GNUNET_CRYPTO_PrivateKey *pkey,
                                 const char *label,
                                 unsigned int rd_count,
                                 const struct GNUNET_GNSRECORD_Data *rd,
@@ -187,7 +187,7 @@ GNUNET_NAMESTORE_records_store (struct 
GNUNET_NAMESTORE_Handle *h,
 struct GNUNET_NAMESTORE_QueueEntry *
 GNUNET_NAMESTORE_records_store2 (
   struct GNUNET_NAMESTORE_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *pkey,
+  const struct GNUNET_CRYPTO_PrivateKey *pkey,
   unsigned int rd_set_count,
   const struct GNUNET_NAMESTORE_RecordInfo *record_info,
   unsigned int *rds_sent,
@@ -217,7 +217,7 @@ GNUNET_NAMESTORE_records_store2 (
  */
 struct GNUNET_NAMESTORE_QueueEntry *
 GNUNET_NAMESTORE_records_store_ (struct GNUNET_NAMESTORE_Handle *h,
-                                 const struct GNUNET_IDENTITY_PrivateKey *pkey,
+                                 const struct GNUNET_CRYPTO_PrivateKey *pkey,
                                  const char *label,
                                  unsigned int rd_count,
                                  const struct GNUNET_GNSRECORD_Data *rd,
@@ -240,7 +240,7 @@ GNUNET_NAMESTORE_records_store_ (struct 
GNUNET_NAMESTORE_Handle *h,
 typedef void
 (*GNUNET_NAMESTORE_RecordMonitor) (void *cls,
                                    const struct
-                                   GNUNET_IDENTITY_PrivateKey *zone,
+                                   GNUNET_CRYPTO_PrivateKey *zone,
                                    const char *label,
                                    unsigned int rd_count,
                                    const struct GNUNET_GNSRECORD_Data *rd);
@@ -260,7 +260,7 @@ typedef void
 typedef void
 (*GNUNET_NAMESTORE_RecordSetMonitor) (void *cls,
                                       const struct
-                                      GNUNET_IDENTITY_PrivateKey *zone,
+                                      GNUNET_CRYPTO_PrivateKey *zone,
                                       const char *label,
                                       unsigned int rd_count,
                                       const struct GNUNET_GNSRECORD_Data *rd,
@@ -284,7 +284,7 @@ typedef void
 struct GNUNET_NAMESTORE_QueueEntry *
 GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h,
                                  const struct
-                                 GNUNET_IDENTITY_PrivateKey *pkey,
+                                 GNUNET_CRYPTO_PrivateKey *pkey,
                                  const char *label,
                                  GNUNET_SCHEDULER_TaskCallback error_cb,
                                  void *error_cb_cls,
@@ -309,7 +309,7 @@ GNUNET_NAMESTORE_records_lookup (struct 
GNUNET_NAMESTORE_Handle *h,
 struct GNUNET_NAMESTORE_QueueEntry *
 GNUNET_NAMESTORE_records_lookup2 (struct GNUNET_NAMESTORE_Handle *h,
                                   const struct
-                                  GNUNET_IDENTITY_PrivateKey *pkey,
+                                  GNUNET_CRYPTO_PrivateKey *pkey,
                                   const char *label,
                                   GNUNET_SCHEDULER_TaskCallback error_cb,
                                   void *error_cb_cls,
@@ -338,9 +338,9 @@ GNUNET_NAMESTORE_records_lookup2 (struct 
GNUNET_NAMESTORE_Handle *h,
  */
 struct GNUNET_NAMESTORE_QueueEntry *
 GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h,
-                               const struct GNUNET_IDENTITY_PrivateKey *zone,
+                               const struct GNUNET_CRYPTO_PrivateKey *zone,
                                const struct
-                               GNUNET_IDENTITY_PublicKey *value_zone,
+                               GNUNET_CRYPTO_PublicKey *value_zone,
                                GNUNET_SCHEDULER_TaskCallback error_cb,
                                void *error_cb_cls,
                                GNUNET_NAMESTORE_RecordMonitor proc,
@@ -390,7 +390,7 @@ GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry 
*qe);
 struct GNUNET_NAMESTORE_ZoneIterator *
 GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h,
                                        const struct
-                                       GNUNET_IDENTITY_PrivateKey *zone,
+                                       GNUNET_CRYPTO_PrivateKey *zone,
                                        GNUNET_SCHEDULER_TaskCallback error_cb,
                                        void *error_cb_cls,
                                        GNUNET_NAMESTORE_RecordMonitor proc,
@@ -427,7 +427,7 @@ GNUNET_NAMESTORE_zone_iteration_start (struct 
GNUNET_NAMESTORE_Handle *h,
 struct GNUNET_NAMESTORE_ZoneIterator *
 GNUNET_NAMESTORE_zone_iteration_start2 (struct GNUNET_NAMESTORE_Handle *h,
                                         const struct
-                                        GNUNET_IDENTITY_PrivateKey *zone,
+                                        GNUNET_CRYPTO_PrivateKey *zone,
                                         GNUNET_SCHEDULER_TaskCallback error_cb,
                                         void *error_cb_cls,
                                         GNUNET_NAMESTORE_RecordSetMonitor proc,
@@ -501,7 +501,7 @@ struct GNUNET_NAMESTORE_ZoneMonitor;
 struct GNUNET_NAMESTORE_ZoneMonitor *
 GNUNET_NAMESTORE_zone_monitor_start (
   const struct GNUNET_CONFIGURATION_Handle *cfg,
-  const struct GNUNET_IDENTITY_PrivateKey *zone,
+  const struct GNUNET_CRYPTO_PrivateKey *zone,
   int iterate_first,
   GNUNET_SCHEDULER_TaskCallback error_cb,
   void *error_cb_cls,
@@ -541,7 +541,7 @@ GNUNET_NAMESTORE_zone_monitor_start (
 struct GNUNET_NAMESTORE_ZoneMonitor *
 GNUNET_NAMESTORE_zone_monitor_start2 (
   const struct GNUNET_CONFIGURATION_Handle *cfg,
-  const struct GNUNET_IDENTITY_PrivateKey *zone,
+  const struct GNUNET_CRYPTO_PrivateKey *zone,
   int iterate_first,
   GNUNET_SCHEDULER_TaskCallback error_cb,
   void *error_cb_cls,
@@ -637,7 +637,7 @@ GNUNET_NAMESTORE_transaction_commit (struct 
GNUNET_NAMESTORE_Handle *h,
 struct GNUNET_NAMESTORE_QueueEntry *
 GNUNET_NAMESTORE_records_edit (
   struct GNUNET_NAMESTORE_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *pkey,
+  const struct GNUNET_CRYPTO_PrivateKey *pkey,
   const char *label,
   GNUNET_SCHEDULER_TaskCallback error_cb,
   void *error_cb_cls,
diff --git a/src/include/gnunet_reclaim_service.h 
b/src/include/gnunet_reclaim_service.h
index 49a006e91..a8ab8776e 100644
--- a/src/include/gnunet_reclaim_service.h
+++ b/src/include/gnunet_reclaim_service.h
@@ -74,12 +74,12 @@ struct GNUNET_RECLAIM_Ticket
   /**
    * The ticket issuer (= the user)
    */
-  struct GNUNET_IDENTITY_PublicKey identity;
+  struct GNUNET_CRYPTO_PublicKey identity;
 
   /**
    * The ticket audience (= relying party)
    */
-  struct GNUNET_IDENTITY_PublicKey audience;
+  struct GNUNET_CRYPTO_PublicKey audience;
 
   /**
    * The ticket random identifier
@@ -134,7 +134,7 @@ typedef void (*GNUNET_RECLAIM_ContinuationWithStatus) (void 
*cls,
  * @param attr The attribute
  */
 typedef void (*GNUNET_RECLAIM_AttributeResult) (
-  void *cls, const struct GNUNET_IDENTITY_PublicKey *identity,
+  void *cls, const struct GNUNET_CRYPTO_PublicKey *identity,
   const struct GNUNET_RECLAIM_Attribute *attr);
 
 /**
@@ -146,7 +146,7 @@ typedef void (*GNUNET_RECLAIM_AttributeResult) (
  * @param presentation The presentation for the credential (may be NULL)
  */
 typedef void (*GNUNET_RECLAIM_AttributeTicketResult) (
-  void *cls, const struct GNUNET_IDENTITY_PublicKey *identity,
+  void *cls, const struct GNUNET_CRYPTO_PublicKey *identity,
   const struct GNUNET_RECLAIM_Attribute *attr,
   const struct GNUNET_RECLAIM_Presentation *presentation);
 
@@ -160,7 +160,7 @@ typedef void (*GNUNET_RECLAIM_AttributeTicketResult) (
  * @param attributes the parsed attributes
  */
 typedef void (*GNUNET_RECLAIM_CredentialResult) (
-  void *cls, const struct GNUNET_IDENTITY_PublicKey *identity,
+  void *cls, const struct GNUNET_CRYPTO_PublicKey *identity,
   const struct GNUNET_RECLAIM_Credential *credential);
 
 
@@ -189,7 +189,7 @@ GNUNET_RECLAIM_connect (const struct 
GNUNET_CONFIGURATION_Handle *cfg);
 struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_attribute_store (
   struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *pkey,
+  const struct GNUNET_CRYPTO_PrivateKey *pkey,
   const struct GNUNET_RECLAIM_Attribute *attr,
   const struct GNUNET_TIME_Relative *exp_interval,
   GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls);
@@ -210,7 +210,7 @@ GNUNET_RECLAIM_attribute_store (
 struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_credential_store (
   struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *pkey,
+  const struct GNUNET_CRYPTO_PrivateKey *pkey,
   const struct GNUNET_RECLAIM_Credential *credential,
   const struct GNUNET_TIME_Relative *exp_interval,
   GNUNET_RECLAIM_ContinuationWithStatus cont,
@@ -231,7 +231,7 @@ GNUNET_RECLAIM_credential_store (
 struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_attribute_delete (
   struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *pkey,
+  const struct GNUNET_CRYPTO_PrivateKey *pkey,
   const struct GNUNET_RECLAIM_Attribute *attr,
   GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls);
 
@@ -249,7 +249,7 @@ GNUNET_RECLAIM_attribute_delete (
 struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_credential_delete (
   struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *pkey,
+  const struct GNUNET_CRYPTO_PrivateKey *pkey,
   const struct GNUNET_RECLAIM_Credential *cred,
   GNUNET_RECLAIM_ContinuationWithStatus cont,
   void *cont_cls);
@@ -281,7 +281,7 @@ GNUNET_RECLAIM_credential_delete (
 struct GNUNET_RECLAIM_AttributeIterator *
 GNUNET_RECLAIM_get_attributes_start (
   struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *identity,
+  const struct GNUNET_CRYPTO_PrivateKey *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);
@@ -337,7 +337,7 @@ GNUNET_RECLAIM_get_attributes_stop (
 struct GNUNET_RECLAIM_CredentialIterator *
 GNUNET_RECLAIM_get_credentials_start (
   struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *identity,
+  const struct GNUNET_CRYPTO_PrivateKey *identity,
   GNUNET_SCHEDULER_TaskCallback error_cb,
   void *error_cb_cls,
   GNUNET_RECLAIM_CredentialResult proc,
@@ -385,8 +385,8 @@ GNUNET_RECLAIM_get_credentials_stop (
 struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_ticket_issue (
   struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *iss,
-  const struct GNUNET_IDENTITY_PublicKey *rp,
+  const struct GNUNET_CRYPTO_PrivateKey *iss,
+  const struct GNUNET_CRYPTO_PublicKey *rp,
   const struct GNUNET_RECLAIM_AttributeList *attrs,
   GNUNET_RECLAIM_IssueTicketCallback cb, void *cb_cls);
 
@@ -407,7 +407,7 @@ GNUNET_RECLAIM_ticket_issue (
 struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_ticket_revoke (
   struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *identity,
+  const struct GNUNET_CRYPTO_PrivateKey *identity,
   const struct GNUNET_RECLAIM_Ticket *ticket,
   GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls);
 
@@ -427,7 +427,7 @@ GNUNET_RECLAIM_ticket_revoke (
 struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_ticket_consume (
   struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *identity,
+  const struct GNUNET_CRYPTO_PrivateKey *identity,
   const struct GNUNET_RECLAIM_Ticket *ticket,
   GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls);
 
@@ -452,7 +452,7 @@ GNUNET_RECLAIM_ticket_consume (
 struct GNUNET_RECLAIM_TicketIterator *
 GNUNET_RECLAIM_ticket_iteration_start (
   struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *identity,
+  const struct GNUNET_CRYPTO_PrivateKey *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);
diff --git a/src/include/gnunet_revocation_service.h 
b/src/include/gnunet_revocation_service.h
index 81a90189b..de5eedbb9 100644
--- a/src/include/gnunet_revocation_service.h
+++ b/src/include/gnunet_revocation_service.h
@@ -60,7 +60,7 @@ extern "C"
  * Maximum length of a revocation
  */
 #define GNUNET_REVOCATION_MAX_PROOF_SIZE sizeof(struct GNUNET_REVOCATION_PowP) 
+\
-                                         sizeof(struct 
GNUNET_IDENTITY_PublicKey) +\
+                                         sizeof(struct 
GNUNET_CRYPTO_PublicKey) +\
                                          1024 //FIXME max sig_len
 
 /**
@@ -152,7 +152,7 @@ typedef void (*GNUNET_REVOCATION_Callback) (void *cls,
  */
 struct GNUNET_REVOCATION_Query *
 GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                         const struct GNUNET_IDENTITY_PublicKey *key,
+                         const struct GNUNET_CRYPTO_PublicKey *key,
                          GNUNET_REVOCATION_Callback func, void *func_cls);
 
 
@@ -219,7 +219,7 @@ GNUNET_REVOCATION_check_pow (const struct 
GNUNET_REVOCATION_PowP *pow,
  * @param pow the pow object to work with in the calculation.
  */
 void
-GNUNET_REVOCATION_pow_init (const struct GNUNET_IDENTITY_PrivateKey *key,
+GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_PrivateKey *key,
                             struct GNUNET_REVOCATION_PowP *pow);
 
 
diff --git a/src/json/Makefile.am b/src/json/Makefile.am
index 7743411d4..c67824ee4 100644
--- a/src/json/Makefile.am
+++ b/src/json/Makefile.am
@@ -23,7 +23,7 @@ libgnunetjson_la_SOURCES = \
   json_mhd.c \
   json_pack.c
 libgnunetjson_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   -ljansson \
   $(MHD_LIBS) \
   $(XLIB) \
@@ -41,7 +41,7 @@ test_json_SOURCES = \
 test_json_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS)
 test_json_LDADD = \
   libgnunetjson.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   -ljansson
 
 
@@ -49,7 +49,7 @@ test_json_mhd_SOURCES = \
   test_json_mhd.c
 test_json_mhd_LDADD = \
   libgnunetjson.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   -ljansson \
   $(MHD_LIBS) \
   $(Z_LIBS) \
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
new file mode 100644
index 000000000..0b9a75dad
--- /dev/null
+++ b/src/lib/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS = \
+       util \
+       hello \
+       block \
+       gnsrecord
diff --git a/src/lib/block/Makefile.am b/src/lib/block/Makefile.am
new file mode 100644
index 000000000..f9a5a0347
--- /dev/null
+++ b/src/lib/block/Makefile.am
@@ -0,0 +1,31 @@
+# This Makefile.am is in the public domain
+AM_CPPFLAGS = -I$(top_srcdir)/src/include
+
+plugindir = $(libdir)/gnunet
+
+if USE_COVERAGE
+  AM_CFLAGS = --coverage
+endif
+
+lib_LTLIBRARIES = \
+  libgnunetblock.la \
+  libgnunetblockgroup.la
+
+libgnunetblock_la_SOURCES = \
+  block.c
+libgnunetblock_la_LIBADD = \
+  $(top_builddir)/src/lib/util/libgnunetutil.la
+libgnunetblock_la_LDFLAGS = \
+  $(GN_LIB_LDFLAGS) \
+  $(GN_LIBINTL) \
+  -version-info 0:0:0
+
+libgnunetblockgroup_la_SOURCES = \
+  bg_bf.c
+libgnunetblockgroup_la_LIBADD = \
+  libgnunetblock.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la
+libgnunetblockgroup_la_LDFLAGS = \
+  $(GN_LIB_LDFLAGS) \
+  $(GN_LIBINTL) \
+  -version-info 0:0:0
diff --git a/src/block/bg_bf.c b/src/lib/block/bg_bf.c
similarity index 100%
rename from src/block/bg_bf.c
rename to src/lib/block/bg_bf.c
diff --git a/src/block/block.c b/src/lib/block/block.c
similarity index 100%
rename from src/block/block.c
rename to src/lib/block/block.c
diff --git a/src/block/meson.build b/src/lib/block/meson.build
similarity index 100%
rename from src/block/meson.build
rename to src/lib/block/meson.build
diff --git a/src/gnsrecord/.gitignore b/src/lib/gnsrecord/.gitignore
similarity index 100%
rename from src/gnsrecord/.gitignore
rename to src/lib/gnsrecord/.gitignore
diff --git a/src/gnsrecord/Makefile.am b/src/lib/gnsrecord/Makefile.am
similarity index 71%
rename from src/gnsrecord/Makefile.am
rename to src/lib/gnsrecord/Makefile.am
index 7ef7c327e..9872ff74b 100644
--- a/src/gnsrecord/Makefile.am
+++ b/src/lib/gnsrecord/Makefile.am
@@ -38,8 +38,7 @@ gnunet_gnsrecord_tvg_SOURCES = \
  gnunet-gnsrecord-tvg.c \
  gnsrecord_crypto.h
 gnunet_gnsrecord_tvg_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/identity/libgnunetidentity.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   libgnunetgnsrecord.la \
   $(GN_LIBINTL)
 
@@ -50,8 +49,7 @@ libgnunetgnsrecord_la_SOURCES = \
   gnsrecord_crypto.c \
   gnsrecord_misc.c
 libgnunetgnsrecord_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/identity/libgnunetidentity.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LIBGCRYPT_LIBS) \
   -lsodium \
   $(GN_LIBINTL)
@@ -62,8 +60,7 @@ libgnunetgnsrecord_la_LDFLAGS = \
 libgnunetgnsrecordjson_la_SOURCES = \
   json_gnsrecord.c
 libgnunetgnsrecordjson_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/identity/libgnunetidentity.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   libgnunetgnsrecord.la \
   -ljansson \
   $(GN_LIBINTL)
@@ -71,19 +68,6 @@ libgnunetgnsrecordjson_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)  \
   -version-info 0:0:0
 
-plugin_LTLIBRARIES = \
-  libgnunet_plugin_gnsrecord_dns.la
-
-
-libgnunet_plugin_gnsrecord_dns_la_SOURCES = \
-  plugin_gnsrecord_dns.c
-libgnunet_plugin_gnsrecord_dns_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(LTLIBINTL)
-libgnunet_plugin_gnsrecord_dns_la_LDFLAGS = \
- $(GN_PLUGIN_LDFLAGS)
-
-
 EXTRA_DIST = \
   $(check_SCRIPTS)
 
@@ -91,9 +75,8 @@ test_gnsrecord_lsd0001testvectors_SOURCES = \
  test_gnsrecord_testvectors.c
 test_gnsrecord_lsd0001testvectors_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
-       $(top_builddir)/src/identity/libgnunetidentity.la \
   libgnunetgnsrecord.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 
 test_gnsrecord_serialization_SOURCES = \
@@ -101,29 +84,27 @@ test_gnsrecord_serialization_SOURCES = \
 test_gnsrecord_serialization_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetgnsrecord.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_gnsrecord_block_expiration_SOURCES = \
  test_gnsrecord_block_expiration.c
 test_gnsrecord_block_expiration_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetgnsrecord.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 
 test_gnsrecord_crypto_SOURCES = \
  test_gnsrecord_crypto.c
 test_gnsrecord_crypto_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/identity/libgnunetidentity.la \
   libgnunetgnsrecord.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 
 perf_gnsrecord_crypto_SOURCES = \
  perf_gnsrecord_crypto.c
 perf_gnsrecord_crypto_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/identity/libgnunetidentity.la \
   libgnunetgnsrecord.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
diff --git a/src/gnsrecord/gnsrecord.c b/src/lib/gnsrecord/gnsrecord.c
similarity index 100%
rename from src/gnsrecord/gnsrecord.c
rename to src/lib/gnsrecord/gnsrecord.c
diff --git a/src/gnsrecord/gnsrecord_crypto.c 
b/src/lib/gnsrecord/gnsrecord_crypto.c
similarity index 96%
rename from src/gnsrecord/gnsrecord_crypto.c
rename to src/lib/gnsrecord/gnsrecord_crypto.c
index 384336c97..de0fa3ffd 100644
--- a/src/gnsrecord/gnsrecord_crypto.c
+++ b/src/lib/gnsrecord/gnsrecord_crypto.c
@@ -273,15 +273,15 @@ block_sign_eddsa (const struct
 
 enum GNUNET_GenericReturnValue
 GNUNET_GNSRECORD_block_sign (const struct
-                             GNUNET_IDENTITY_PrivateKey *key,
+                             GNUNET_CRYPTO_PrivateKey *key,
                              const char *label,
                              struct GNUNET_GNSRECORD_Block *block)
 {
-  struct GNUNET_IDENTITY_PublicKey pkey;
+  struct GNUNET_CRYPTO_PublicKey pkey;
   enum GNUNET_GenericReturnValue res = GNUNET_SYSERR;
   char *norm_label;
 
-  GNUNET_IDENTITY_key_get_public (key,
+  GNUNET_CRYPTO_key_get_public (key,
                                   &pkey);
   norm_label = GNUNET_GNSRECORD_string_normalize (label);
 
@@ -510,14 +510,14 @@ block_create_eddsa (const struct 
GNUNET_CRYPTO_EddsaPrivateKey *key,
 
 ssize_t
 GNUNET_GNSRECORD_block_calculate_size (const struct
-                                       GNUNET_IDENTITY_PrivateKey *key,
+                                       GNUNET_CRYPTO_PrivateKey *key,
                                        const struct GNUNET_GNSRECORD_Data *rd,
                                        unsigned int rd_count)
 {
-  struct GNUNET_IDENTITY_PublicKey pkey;
+  struct GNUNET_CRYPTO_PublicKey pkey;
   ssize_t res = -1;
 
-  GNUNET_IDENTITY_key_get_public (key,
+  GNUNET_CRYPTO_key_get_public (key,
                                   &pkey);
   switch (ntohl (key->type))
   {
@@ -536,18 +536,18 @@ GNUNET_GNSRECORD_block_calculate_size (const struct
 
 
 enum GNUNET_GenericReturnValue
-GNUNET_GNSRECORD_block_create (const struct GNUNET_IDENTITY_PrivateKey *key,
+GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_PrivateKey *key,
                                struct GNUNET_TIME_Absolute expire,
                                const char *label,
                                const struct GNUNET_GNSRECORD_Data *rd,
                                unsigned int rd_count,
                                struct GNUNET_GNSRECORD_Block **result)
 {
-  struct GNUNET_IDENTITY_PublicKey pkey;
+  struct GNUNET_CRYPTO_PublicKey pkey;
   enum GNUNET_GenericReturnValue res = GNUNET_SYSERR;
   char *norm_label;
 
-  GNUNET_IDENTITY_key_get_public (key,
+  GNUNET_CRYPTO_key_get_public (key,
                                   &pkey);
   norm_label = GNUNET_GNSRECORD_string_normalize (label);
 
@@ -599,7 +599,7 @@ struct KeyCacheLine
 
 
 static enum GNUNET_GenericReturnValue
-block_create2 (const struct GNUNET_IDENTITY_PrivateKey *pkey,
+block_create2 (const struct GNUNET_CRYPTO_PrivateKey *pkey,
                struct GNUNET_TIME_Absolute expire,
                const char *label,
                const struct GNUNET_GNSRECORD_Data *rd,
@@ -614,7 +614,7 @@ block_create2 (const struct GNUNET_IDENTITY_PrivateKey 
*pkey,
 
   norm_label = GNUNET_GNSRECORD_string_normalize (label);
 
-  if (GNUNET_IDENTITY_TYPE_ECDSA == ntohl (pkey->type))
+  if (GNUNET_PUBLIC_KEY_TYPE_ECDSA == ntohl (pkey->type))
   {
     key = &pkey->ecdsa_key;
 #define CSIZE 64
@@ -641,7 +641,7 @@ block_create2 (const struct GNUNET_IDENTITY_PrivateKey 
*pkey,
                               result,
                               sign);
   }
-  else if (GNUNET_IDENTITY_TYPE_EDDSA == ntohl (pkey->type))
+  else if (GNUNET_PUBLIC_KEY_TYPE_EDDSA == ntohl (pkey->type))
   {
     GNUNET_CRYPTO_eddsa_key_get_public (&pkey->eddsa_key,
                                         &edpubkey);
@@ -661,7 +661,7 @@ block_create2 (const struct GNUNET_IDENTITY_PrivateKey 
*pkey,
 
 enum GNUNET_GenericReturnValue
 GNUNET_GNSRECORD_block_create_unsigned (const struct
-                                        GNUNET_IDENTITY_PrivateKey *pkey,
+                                        GNUNET_CRYPTO_PrivateKey *pkey,
                                         struct GNUNET_TIME_Absolute expire,
                                         const char *label,
                                         const struct GNUNET_GNSRECORD_Data *rd,
@@ -673,7 +673,7 @@ GNUNET_GNSRECORD_block_create_unsigned (const struct
 
 
 enum GNUNET_GenericReturnValue
-GNUNET_GNSRECORD_block_create2 (const struct GNUNET_IDENTITY_PrivateKey *pkey,
+GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_PrivateKey *pkey,
                                 struct GNUNET_TIME_Absolute expire,
                                 const char *label,
                                 const struct GNUNET_GNSRECORD_Data *rd,
@@ -984,7 +984,7 @@ block_decrypt_eddsa (const struct GNUNET_GNSRECORD_Block 
*block,
 enum GNUNET_GenericReturnValue
 GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block,
                                 const struct
-                                GNUNET_IDENTITY_PublicKey *zone_key,
+                                GNUNET_CRYPTO_PublicKey *zone_key,
                                 const char *label,
                                 GNUNET_GNSRECORD_RecordCallback proc,
                                 void *proc_cls)
@@ -995,12 +995,12 @@ GNUNET_GNSRECORD_block_decrypt (const struct 
GNUNET_GNSRECORD_Block *block,
   norm_label = GNUNET_GNSRECORD_string_normalize (label);
   switch (ntohl (zone_key->type))
   {
-  case GNUNET_IDENTITY_TYPE_ECDSA:
+  case GNUNET_PUBLIC_KEY_TYPE_ECDSA:
     res = block_decrypt_ecdsa (block,
                                &zone_key->ecdsa_key, norm_label, proc,
                                proc_cls);
     break;
-  case GNUNET_IDENTITY_TYPE_EDDSA:
+  case GNUNET_PUBLIC_KEY_TYPE_EDDSA:
     res = block_decrypt_eddsa (block,
                                &zone_key->eddsa_key, norm_label, proc,
                                proc_cls);
@@ -1022,12 +1022,12 @@ GNUNET_GNSRECORD_block_decrypt (const struct 
GNUNET_GNSRECORD_Block *block,
  */
 void
 GNUNET_GNSRECORD_query_from_private_key (const struct
-                                         GNUNET_IDENTITY_PrivateKey *zone,
+                                         GNUNET_CRYPTO_PrivateKey *zone,
                                          const char *label,
                                          struct GNUNET_HashCode *query)
 {
   char *norm_label;
-  struct GNUNET_IDENTITY_PublicKey pub;
+  struct GNUNET_CRYPTO_PublicKey pub;
 
   norm_label = GNUNET_GNSRECORD_string_normalize (label);
   switch (ntohl (zone->type))
@@ -1035,7 +1035,7 @@ GNUNET_GNSRECORD_query_from_private_key (const struct
   case GNUNET_GNSRECORD_TYPE_PKEY:
   case GNUNET_GNSRECORD_TYPE_EDKEY:
 
-    GNUNET_IDENTITY_key_get_public (zone,
+    GNUNET_CRYPTO_key_get_public (zone,
                                     &pub);
     GNUNET_GNSRECORD_query_from_public_key (&pub,
                                             norm_label,
@@ -1050,12 +1050,12 @@ GNUNET_GNSRECORD_query_from_private_key (const struct
 
 void
 GNUNET_GNSRECORD_query_from_public_key (const struct
-                                        GNUNET_IDENTITY_PublicKey *pub,
+                                        GNUNET_CRYPTO_PublicKey *pub,
                                         const char *label,
                                         struct GNUNET_HashCode *query)
 {
   char *norm_label;
-  struct GNUNET_IDENTITY_PublicKey pd;
+  struct GNUNET_CRYPTO_PublicKey pd;
 
   norm_label = GNUNET_GNSRECORD_string_normalize (label);
 
diff --git a/src/gnsrecord/gnsrecord_crypto.h 
b/src/lib/gnsrecord/gnsrecord_crypto.h
similarity index 100%
rename from src/gnsrecord/gnsrecord_crypto.h
rename to src/lib/gnsrecord/gnsrecord_crypto.h
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/lib/gnsrecord/gnsrecord_misc.c
similarity index 95%
rename from src/gnsrecord/gnsrecord_misc.c
rename to src/lib/gnsrecord/gnsrecord_misc.c
index 931654c49..888295148 100644
--- a/src/gnsrecord/gnsrecord_misc.c
+++ b/src/lib/gnsrecord/gnsrecord_misc.c
@@ -61,14 +61,14 @@ GNUNET_GNSRECORD_label_check (const char*label, char **emsg)
 
 
 const char *
-GNUNET_GNSRECORD_z2s (const struct GNUNET_IDENTITY_PublicKey *z)
+GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_PublicKey *z)
 {
-  static char buf[sizeof(struct GNUNET_IDENTITY_PublicKey) * 8];
+  static char buf[sizeof(struct GNUNET_CRYPTO_PublicKey) * 8];
   char *end;
 
   end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z,
                                        sizeof(struct
-                                              GNUNET_IDENTITY_PublicKey),
+                                              GNUNET_CRYPTO_PublicKey),
                                        buf, sizeof(buf));
   if (NULL == end)
   {
@@ -228,12 +228,12 @@ GNUNET_GNSRECORD_is_expired (const struct 
GNUNET_GNSRECORD_Data *rd)
  *         key in an encoding suitable for DNS labels.
  */
 const char *
-GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_IDENTITY_PublicKey *pkey)
+GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_PublicKey *pkey)
 {
   static char ret[128];
   char *pkeys;
 
-  pkeys = GNUNET_IDENTITY_public_key_to_string (pkey);
+  pkeys = GNUNET_CRYPTO_public_key_to_string (pkey);
   GNUNET_snprintf (ret,
                    sizeof(ret),
                    "%s",
@@ -254,10 +254,10 @@ GNUNET_GNSRECORD_pkey_to_zkey (const struct 
GNUNET_IDENTITY_PublicKey *pkey)
  */
 int
 GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey,
-                               struct GNUNET_IDENTITY_PublicKey *pkey)
+                               struct GNUNET_CRYPTO_PublicKey *pkey)
 {
   if (GNUNET_OK !=
-      GNUNET_IDENTITY_public_key_from_string (zkey,
+      GNUNET_CRYPTO_public_key_from_string (zkey,
                                               pkey))
     return GNUNET_SYSERR;
   return GNUNET_OK;
@@ -268,7 +268,7 @@ enum GNUNET_GenericReturnValue
 GNUNET_GNSRECORD_identity_from_data (const char *data,
                                      size_t data_size,
                                      uint32_t type,
-                                     struct GNUNET_IDENTITY_PublicKey *key)
+                                     struct GNUNET_CRYPTO_PublicKey *key)
 {
   if (GNUNET_NO == GNUNET_GNSRECORD_is_zonekey_type (type))
     return GNUNET_SYSERR;
@@ -295,14 +295,14 @@ GNUNET_GNSRECORD_identity_from_data (const char *data,
 
 enum GNUNET_GenericReturnValue
 GNUNET_GNSRECORD_data_from_identity (const struct
-                                     GNUNET_IDENTITY_PublicKey *key,
+                                     GNUNET_CRYPTO_PublicKey *key,
                                      char **data,
                                      size_t *data_size,
                                      uint32_t *type)
 {
   char *tmp;
   *type = ntohl (key->type);
-  *data_size = GNUNET_IDENTITY_public_key_get_length (key) - sizeof 
(key->type);
+  *data_size = GNUNET_CRYPTO_public_key_get_length (key) - sizeof (key->type);
   if (0 == *data_size)
     return GNUNET_SYSERR;
   tmp = GNUNET_malloc (*data_size);
@@ -378,7 +378,7 @@ GNUNET_GNSRECORD_query_from_block (const struct 
GNUNET_GNSRECORD_Block *block,
 
 enum GNUNET_GenericReturnValue
 GNUNET_GNSRECORD_record_to_identity_key (const struct GNUNET_GNSRECORD_Data 
*rd,
-                                         struct GNUNET_IDENTITY_PublicKey *key)
+                                         struct GNUNET_CRYPTO_PublicKey *key)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Got record of type %u\n",
diff --git a/src/gnsrecord/gnsrecord_serialization.c 
b/src/lib/gnsrecord/gnsrecord_serialization.c
similarity index 100%
rename from src/gnsrecord/gnsrecord_serialization.c
rename to src/lib/gnsrecord/gnsrecord_serialization.c
diff --git a/src/gnsrecord/gnunet-gnsrecord-tvg.c 
b/src/lib/gnsrecord/gnunet-gnsrecord-tvg.c
similarity index 94%
rename from src/gnsrecord/gnunet-gnsrecord-tvg.c
rename to src/lib/gnsrecord/gnunet-gnsrecord-tvg.c
index eebbedf21..746e95c32 100644
--- a/src/gnsrecord/gnunet-gnsrecord-tvg.c
+++ b/src/lib/gnsrecord/gnunet-gnsrecord-tvg.c
@@ -146,10 +146,10 @@ run_pkey (struct GNUNET_GNSRECORD_Data *rd, int rd_count, 
const char *label)
   struct GNUNET_TIME_Absolute expire;
   struct GNUNET_GNSRECORD_Block *rrblock;
   char *bdata;
-  struct GNUNET_IDENTITY_PrivateKey id_priv;
-  struct GNUNET_IDENTITY_PublicKey id_pub;
-  struct GNUNET_IDENTITY_PrivateKey pkey_data_p;
-  struct GNUNET_IDENTITY_PublicKey pkey_data;
+  struct GNUNET_CRYPTO_PrivateKey id_priv;
+  struct GNUNET_CRYPTO_PublicKey id_pub;
+  struct GNUNET_CRYPTO_PrivateKey pkey_data_p;
+  struct GNUNET_CRYPTO_PublicKey pkey_data;
   struct GNUNET_HashCode query;
   char *rdata;
   char *conv_lbl;
@@ -164,17 +164,17 @@ run_pkey (struct GNUNET_GNSRECORD_Data *rd, int rd_count, 
const char *label)
             (char*) &id_priv.ecdsa_key,
             sizeof (id_priv.ecdsa_key), 1);
 
-  GNUNET_IDENTITY_key_get_public (&id_priv,
+  GNUNET_CRYPTO_key_get_public (&id_priv,
                                   &id_pub);
   printf ("Zone private key (d, big-endian):\n");
   print_bytes_ (&id_priv.ecdsa_key,
                 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey), 8, 1);
   printf ("\n");
   printf ("Zone identifier (ztype|zkey):\n");
-  GNUNET_assert (0 < GNUNET_IDENTITY_public_key_get_length (&id_pub));
-  print_bytes (&id_pub, GNUNET_IDENTITY_public_key_get_length (&id_pub), 8);
+  GNUNET_assert (0 < GNUNET_CRYPTO_public_key_get_length (&id_pub));
+  print_bytes (&id_pub, GNUNET_CRYPTO_public_key_get_length (&id_pub), 8);
   GNUNET_STRINGS_data_to_string (&id_pub,
-                                 GNUNET_IDENTITY_public_key_get_length (
+                                 GNUNET_CRYPTO_public_key_get_length (
                                    &id_pub),
                                  ztld,
                                  sizeof (ztld));
@@ -185,7 +185,7 @@ run_pkey (struct GNUNET_GNSRECORD_Data *rd, int rd_count, 
const char *label)
 
   pkey_data_p.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
   GNUNET_CRYPTO_ecdsa_key_create (&pkey_data_p.ecdsa_key);
-  GNUNET_IDENTITY_key_get_public (&pkey_data_p,
+  GNUNET_CRYPTO_key_get_public (&pkey_data_p,
                                   &pkey_data);
   conv_lbl = GNUNET_GNSRECORD_string_normalize (label);
   printf ("Label:\n");
@@ -285,10 +285,10 @@ run_edkey (struct GNUNET_GNSRECORD_Data *rd, int 
rd_count, const char*label)
   struct GNUNET_TIME_Absolute expire;
   struct GNUNET_GNSRECORD_Block *rrblock;
   char *bdata;
-  struct GNUNET_IDENTITY_PrivateKey id_priv;
-  struct GNUNET_IDENTITY_PublicKey id_pub;
-  struct GNUNET_IDENTITY_PrivateKey pkey_data_p;
-  struct GNUNET_IDENTITY_PublicKey pkey_data;
+  struct GNUNET_CRYPTO_PrivateKey id_priv;
+  struct GNUNET_CRYPTO_PublicKey id_pub;
+  struct GNUNET_CRYPTO_PrivateKey pkey_data_p;
+  struct GNUNET_CRYPTO_PublicKey pkey_data;
   struct GNUNET_HashCode query;
   char *rdata;
   char *conv_lbl;
@@ -300,15 +300,15 @@ run_edkey (struct GNUNET_GNSRECORD_Data *rd, int 
rd_count, const char*label)
 
   id_priv.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
   GNUNET_CRYPTO_ecdsa_key_create (&id_priv.ecdsa_key);
-  GNUNET_IDENTITY_key_get_public (&id_priv,
+  GNUNET_CRYPTO_key_get_public (&id_priv,
                                   &id_pub);
 
-  id_priv.type = htonl (GNUNET_IDENTITY_TYPE_EDDSA);
+  id_priv.type = htonl (GNUNET_PUBLIC_KEY_TYPE_EDDSA);
   GNUNET_CRYPTO_eddsa_key_create (&id_priv.eddsa_key);
   parsehex (d_edkey,
             (char*) &id_priv.eddsa_key,
             sizeof (id_priv.eddsa_key), 0);
-  GNUNET_IDENTITY_key_get_public (&id_priv,
+  GNUNET_CRYPTO_key_get_public (&id_priv,
                                   &id_pub);
   fprintf (stdout,
            "Zone private key (d):\n");
@@ -316,10 +316,10 @@ run_edkey (struct GNUNET_GNSRECORD_Data *rd, int 
rd_count, const char*label)
                                            GNUNET_CRYPTO_EddsaPrivateKey), 8);
   printf ("\n");
   printf ("Zone identifier (ztype|zkey):\n");
-  GNUNET_assert (0 < GNUNET_IDENTITY_public_key_get_length (&id_pub));
-  print_bytes (&id_pub, GNUNET_IDENTITY_public_key_get_length (&id_pub), 8);
+  GNUNET_assert (0 < GNUNET_CRYPTO_public_key_get_length (&id_pub));
+  print_bytes (&id_pub, GNUNET_CRYPTO_public_key_get_length (&id_pub), 8);
   GNUNET_STRINGS_data_to_string (&id_pub,
-                                 GNUNET_IDENTITY_public_key_get_length (
+                                 GNUNET_CRYPTO_public_key_get_length (
                                    &id_pub),
                                  ztld,
                                  sizeof (ztld));
@@ -330,7 +330,7 @@ run_edkey (struct GNUNET_GNSRECORD_Data *rd, int rd_count, 
const char*label)
 
   pkey_data_p.type = htonl (GNUNET_GNSRECORD_TYPE_EDKEY);
   GNUNET_CRYPTO_eddsa_key_create (&pkey_data_p.eddsa_key);
-  GNUNET_IDENTITY_key_get_public (&pkey_data_p,
+  GNUNET_CRYPTO_key_get_public (&pkey_data_p,
                                   &pkey_data);
   conv_lbl = GNUNET_GNSRECORD_string_normalize (label);
   printf ("Label:\n");
diff --git a/src/gnsrecord/json_gnsrecord.c b/src/lib/gnsrecord/json_gnsrecord.c
similarity index 100%
rename from src/gnsrecord/json_gnsrecord.c
rename to src/lib/gnsrecord/json_gnsrecord.c
diff --git a/src/gnsrecord/meson.build b/src/lib/gnsrecord/meson.build
similarity index 100%
rename from src/gnsrecord/meson.build
rename to src/lib/gnsrecord/meson.build
diff --git a/src/gnsrecord/perf_gnsrecord_crypto.c 
b/src/lib/gnsrecord/perf_gnsrecord_crypto.c
similarity index 98%
rename from src/gnsrecord/perf_gnsrecord_crypto.c
rename to src/lib/gnsrecord/perf_gnsrecord_crypto.c
index 6b5f84235..1f9a3d4d4 100644
--- a/src/gnsrecord/perf_gnsrecord_crypto.c
+++ b/src/lib/gnsrecord/perf_gnsrecord_crypto.c
@@ -73,7 +73,7 @@ run (void *cls,
   struct GNUNET_GNSRECORD_Data *s_rd;
   const char *s_name;
   struct GNUNET_TIME_Absolute start_time;
-  struct GNUNET_IDENTITY_PrivateKey privkey;
+  struct GNUNET_CRYPTO_PrivateKey privkey;
   struct GNUNET_TIME_Absolute expire;
 
   (void) cls;
diff --git a/src/gnsrecord/test_gnsrecord_block_expiration.c 
b/src/lib/gnsrecord/test_gnsrecord_block_expiration.c
similarity index 100%
rename from src/gnsrecord/test_gnsrecord_block_expiration.c
rename to src/lib/gnsrecord/test_gnsrecord_block_expiration.c
diff --git a/src/gnsrecord/test_gnsrecord_crypto.c 
b/src/lib/gnsrecord/test_gnsrecord_crypto.c
similarity index 96%
rename from src/gnsrecord/test_gnsrecord_crypto.c
rename to src/lib/gnsrecord/test_gnsrecord_crypto.c
index 92a7a9f1f..ed5394e60 100644
--- a/src/gnsrecord/test_gnsrecord_crypto.c
+++ b/src/lib/gnsrecord/test_gnsrecord_crypto.c
@@ -93,10 +93,10 @@ rd_decrypt_cb (void *cls,
 
 
 static void
-test_with_type (struct GNUNET_IDENTITY_PrivateKey *privkey)
+test_with_type (struct GNUNET_CRYPTO_PrivateKey *privkey)
 {
   struct GNUNET_GNSRECORD_Block *block;
-  struct GNUNET_IDENTITY_PublicKey pubkey;
+  struct GNUNET_CRYPTO_PublicKey pubkey;
   struct GNUNET_HashCode query_pub;
   struct GNUNET_HashCode query_priv;
   struct GNUNET_HashCode query_block;
@@ -104,7 +104,7 @@ test_with_type (struct GNUNET_IDENTITY_PrivateKey *privkey)
 
 
   /* get public key */
-  GNUNET_IDENTITY_key_get_public (privkey,
+  GNUNET_CRYPTO_key_get_public (privkey,
                                   &pubkey);
 
   /* test query derivation */
@@ -155,8 +155,8 @@ run (void *cls,
      const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
-  struct GNUNET_IDENTITY_PrivateKey privkey;
-  struct GNUNET_IDENTITY_PrivateKey privkey_ed;
+  struct GNUNET_CRYPTO_PrivateKey privkey;
+  struct GNUNET_CRYPTO_PrivateKey privkey_ed;
   struct GNUNET_TIME_Absolute start;
   struct GNUNET_TIME_Absolute end;
 
diff --git a/src/gnsrecord/test_gnsrecord_serialization.c 
b/src/lib/gnsrecord/test_gnsrecord_serialization.c
similarity index 100%
rename from src/gnsrecord/test_gnsrecord_serialization.c
rename to src/lib/gnsrecord/test_gnsrecord_serialization.c
diff --git a/src/gnsrecord/test_gnsrecord_testvectors.c 
b/src/lib/gnsrecord/test_gnsrecord_testvectors.c
similarity index 97%
rename from src/gnsrecord/test_gnsrecord_testvectors.c
rename to src/lib/gnsrecord/test_gnsrecord_testvectors.c
index e0d959f0e..04fd7f8bd 100644
--- a/src/gnsrecord/test_gnsrecord_testvectors.c
+++ b/src/lib/gnsrecord/test_gnsrecord_testvectors.c
@@ -528,7 +528,7 @@ res_checker (void *cls,
 enum GNUNET_GenericReturnValue
 check_derivations_edkey (const char*label,
                          struct GNUNET_TIME_Absolute expire,
-                         struct GNUNET_IDENTITY_PublicKey *pub,
+                         struct GNUNET_CRYPTO_PublicKey *pub,
                          struct GnsTv *tv)
 {
   unsigned char nonce[crypto_secretbox_NONCEBYTES];
@@ -566,7 +566,7 @@ check_derivations_edkey (const char*label,
 enum GNUNET_GenericReturnValue
 check_derivations_pkey (const char*label,
                         struct GNUNET_TIME_Absolute expire,
-                        struct GNUNET_IDENTITY_PublicKey *pub,
+                        struct GNUNET_CRYPTO_PublicKey *pub,
                         struct GnsTv *tv)
 {
   unsigned char ctr[GNUNET_CRYPTO_AES_KEY_LENGTH / 2];
@@ -602,9 +602,9 @@ check_derivations_pkey (const char*label,
 int
 main ()
 {
-  struct GNUNET_IDENTITY_PrivateKey priv;
-  struct GNUNET_IDENTITY_PublicKey pub;
-  struct GNUNET_IDENTITY_PublicKey pub_parsed;
+  struct GNUNET_CRYPTO_PrivateKey priv;
+  struct GNUNET_CRYPTO_PublicKey pub;
+  struct GNUNET_CRYPTO_PublicKey pub_parsed;
   struct GNUNET_GNSRECORD_Block *rrblock;
   struct GNUNET_HashCode query;
   struct GNUNET_HashCode expected_query;
@@ -624,8 +624,8 @@ main ()
     parsehex (tvs[i].d,(char*) &priv.ecdsa_key, sizeof (priv.ecdsa_key),
               (GNUNET_GNSRECORD_TYPE_PKEY == ntohl (pub_parsed.type)) ? 1 : 0);
     priv.type = pub_parsed.type;
-    GNUNET_IDENTITY_key_get_public (&priv, &pub);
-    if (0 != memcmp (&pub, &pub_parsed, GNUNET_IDENTITY_public_key_get_length (
+    GNUNET_CRYPTO_key_get_public (&priv, &pub);
+    if (0 != memcmp (&pub, &pub_parsed, GNUNET_CRYPTO_public_key_get_length (
                        &pub)))
     {
       printf ("Wrong pubkey.\n");
@@ -635,7 +635,7 @@ main ()
       break;
     }
     GNUNET_STRINGS_data_to_string (&pub,
-                                   GNUNET_IDENTITY_public_key_get_length (
+                                   GNUNET_CRYPTO_public_key_get_length (
                                      &pub),
                                    ztld,
                                    sizeof (ztld));
diff --git a/src/hello/.gitignore b/src/lib/hello/.gitignore
similarity index 100%
rename from src/hello/.gitignore
rename to src/lib/hello/.gitignore
diff --git a/src/hello/Makefile.am b/src/lib/hello/Makefile.am
similarity index 69%
rename from src/hello/Makefile.am
rename to src/lib/hello/Makefile.am
index 5b923055b..4435dba42 100644
--- a/src/hello/Makefile.am
+++ b/src/lib/hello/Makefile.am
@@ -13,15 +13,12 @@ libgnunethello_la_SOURCES = \
   hello-ng.c \
   hello-uri.c
 libgnunethello_la_LIBADD = \
- $(top_builddir)/src/util/libgnunetutil.la $(XLIB) \
+ $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIB) \
  $(LTLIBINTL)
 libgnunethello_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS) \
   -version-info 1:0:1
 
-#noinst_PROGRAMS = \
-# gnunet-hello
-
 check_PROGRAMS = \
  test_hello \
  test_hello-uri \
@@ -37,19 +34,19 @@ test_hello_SOURCES = \
  test_hello.c
 test_hello_LDADD = \
  libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_hello_ng_SOURCES = \
  test_hello-ng.c
 test_hello_ng_LDADD = \
  libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_hello_uri_SOURCES = \
  test_hello-uri.c
 test_hello_uri_LDADD = \
  libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  -lgcrypt
 
 
@@ -57,13 +54,4 @@ test_friend_hello_SOURCES = \
  test_friend_hello.c
 test_friend_hello_LDADD = \
  libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
-# Not TNG ready
-#gnunet_hello_SOURCES = \
-# gnunet-hello.c
-#gnunet_hello_LDADD = \
-# libgnunethello.la \
-# $(top_builddir)/src/util/libgnunetutil.la
-#gnunet_hello_LDFLAGS = \
-#  $(GN_LIBINTL)
+ $(top_builddir)/src/lib/util/libgnunetutil.la
diff --git a/src/hello/address.c b/src/lib/hello/address.c
similarity index 100%
rename from src/hello/address.c
rename to src/lib/hello/address.c
diff --git a/src/hello/hello-ng.c b/src/lib/hello/hello-ng.c
similarity index 100%
rename from src/hello/hello-ng.c
rename to src/lib/hello/hello-ng.c
diff --git a/src/hello/hello-uri.c b/src/lib/hello/hello-uri.c
similarity index 100%
rename from src/hello/hello-uri.c
rename to src/lib/hello/hello-uri.c
diff --git a/src/hello/hello.c b/src/lib/hello/hello.c
similarity index 100%
rename from src/hello/hello.c
rename to src/lib/hello/hello.c
diff --git a/src/hello/meson.build b/src/lib/hello/meson.build
similarity index 100%
rename from src/hello/meson.build
rename to src/lib/hello/meson.build
diff --git a/src/hello/test_friend_hello.c b/src/lib/hello/test_friend_hello.c
similarity index 100%
rename from src/hello/test_friend_hello.c
rename to src/lib/hello/test_friend_hello.c
diff --git a/src/hello/test_hello-ng.c b/src/lib/hello/test_hello-ng.c
similarity index 100%
rename from src/hello/test_hello-ng.c
rename to src/lib/hello/test_hello-ng.c
diff --git a/src/hello/test_hello-uri.c b/src/lib/hello/test_hello-uri.c
similarity index 100%
rename from src/hello/test_hello-uri.c
rename to src/lib/hello/test_hello-uri.c
diff --git a/src/hello/test_hello.c b/src/lib/hello/test_hello.c
similarity index 100%
rename from src/hello/test_hello.c
rename to src/lib/hello/test_hello.c
diff --git a/src/util/.gitignore b/src/lib/util/.gitignore
similarity index 88%
rename from src/util/.gitignore
rename to src/lib/util/.gitignore
index 6151c4f7a..bfb947ae6 100644
--- a/src/util/.gitignore
+++ b/src/lib/util/.gitignore
@@ -1,13 +1,4 @@
 test_common_logging_dummy
-gnunet-config
-gnunet-config-diff
-gnunet-crypto-tvg
-gnunet-ecc
-gnunet-qr
-gnunet-resolver
-gnunet-scrypt
-gnunet-service-resolver
-gnunet-uri
 test_bio
 test_client.nc
 test_client_unix.nc
@@ -54,7 +45,6 @@ test_os_start_process
 test_peer
 test_plugin
 test_program
-test_resolver_api.nc
 test_scheduler
 test_scheduler_delay
 test_server.nc
@@ -79,11 +69,9 @@ test_hexcoder
 test_regex
 test_tun
 test_uri
-gnunet-timeout
 python27_location
 perf_malloc
 perf_mq
 perf_scheduler
-gnunet-base32
 test_crypto_cs
 test_crypto_ecc
diff --git a/src/util/Makefile.am b/src/lib/util/Makefile.am
similarity index 85%
rename from src/util/Makefile.am
rename to src/lib/util/Makefile.am
index 3647ca08e..5d92dfdd6 100644
--- a/src/util/Makefile.am
+++ b/src/lib/util/Makefile.am
@@ -28,11 +28,6 @@ endif
 DLOG = crypto_ecc_dlog.c
 DLOG_TEST = test_crypto_ecc_dlog
 
-gnunet_config_diff_SOURCES = \
- gnunet-config-diff.c
-gnunet_config_diff_LDADD = \
- libgnunetutil.la
-
 test_common_logging_dummy_SOURCES = \
  test_common_logging_dummy.c
 test_common_logging_dummy_LDADD = \
@@ -73,6 +68,7 @@ libgnunetutil_la_SOURCES = \
   crypto_kdf.c \
   crypto_mpi.c \
   crypto_paillier.c \
+  crypto_pkey.c \
   crypto_pow.c \
   crypto_random.c \
   crypto_rsa.c \
@@ -152,103 +148,16 @@ libgnunetutil_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS) \
   -version-info 15:0:0
 
-GNUNET_ECC = gnunet-ecc
-GNUNET_SCRYPT = gnunet-scrypt
-
 lib_LTLIBRARIES = libgnunetutil.la
 
-libexec_PROGRAMS = \
- gnunet-service-resolver \
- gnunet-timeout
-
-bin_PROGRAMS = \
- gnunet-base32 \
- gnunet-config \
- gnunet-resolver \
- $(GNUNET_ECC) \
- $(GNUNET_SCRYPT) \
- gnunet-uri
-if HAVE_ZBAR
-bin_PROGRAMS += gnunet-qr
-endif
-
 noinst_PROGRAMS = \
- gnunet-config-diff \
- test_common_logging_dummy \
- gnunet-crypto-tvg
+ test_common_logging_dummy
 
 if ENABLE_TEST_RUN
 AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
 TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
 endif
 
-gnunet_timeout_SOURCES = \
- gnunet-timeout.c
-
-gnunet_service_resolver_SOURCES = \
- gnunet-service-resolver.c
-gnunet_service_resolver_LDADD = \
-  libgnunetutil.la \
-  $(GN_LIBINTL)
-if HAVE_GETADDRINFO_A
-gnunet_service_resolver_LDADD += -lanl
-endif
-
-
-gnunet_resolver_SOURCES = \
- gnunet-resolver.c
-gnunet_resolver_LDADD = \
-  libgnunetutil.la \
-  $(GN_LIBINTL)
-
-gnunet_crypto_tvg_SOURCES = \
- gnunet-crypto-tvg.c
-gnunet_crypto_tvg_LDADD = \
-  libgnunetutil.la \
-  $(GN_LIBINTL) -lgcrypt -ljansson
-
-gnunet_ecc_SOURCES = \
- gnunet-ecc.c
-gnunet_ecc_LDADD = \
-  libgnunetutil.la \
-  $(GN_LIBINTL) -lgcrypt
-
-gnunet_base32_SOURCES = \
- gnunet-base32.c
-gnunet_base32_LDADD = \
-  libgnunetutil.la \
-  $(GN_LIBINTL)
-
-gnunet_scrypt_SOURCES = \
- gnunet-scrypt.c
-gnunet_scrypt_LDADD = \
-  libgnunetutil.la \
-  $(GN_LIBINTL) -lgcrypt
-
-
-gnunet_config_SOURCES = \
- gnunet-config.c
-gnunet_config_LDADD = \
-  libgnunetutil.la \
-  $(GN_LIBINTL)
-
-gnunet_uri_SOURCES = \
- gnunet-uri.c
-gnunet_uri_LDADD = \
-  libgnunetutil.la \
-  $(GN_LIBINTL)
-
-
-gnunet_qr_SOURCES = \
-  gnunet-qr.c
-gnunet_qr_LDADD = \
-  libgnunetutil.la \
-  $(GN_LIBINTL)
-gnunet_qr_LDFLAGS= -lzbar
-if HAVE_PNG
-gnunet_qr_LDFLAGS += -lpng
-endif
-
 plugin_LTLIBRARIES = \
   libgnunet_plugin_utiltest.la
 
@@ -275,9 +184,6 @@ if HAVE_SSH_KEY
 # SSH_USING_TESTS = test_socks.nc
 endif
 
-check_SCRIPTS = \
- test_crypto_vectors.sh
-
 check_PROGRAMS = \
  test_bio \
  test_child_management \
@@ -319,7 +225,6 @@ check_PROGRAMS = \
  test_plugin \
  test_program \
  test_regex \
- test_resolver_api.nc \
  test_scheduler \
  test_scheduler_delay \
  test_scheduler_hogging_cancel \
@@ -574,11 +479,6 @@ test_program_SOURCES = \
 test_program_LDADD = \
  libgnunetutil.la
 
-test_resolver_api_nc_SOURCES = \
- test_resolver_api.c
-test_resolver_api_nc_LDADD = \
- libgnunetutil.la
-
 test_scheduler_SOURCES = \
  test_scheduler.c
 test_scheduler_LDADD = \
@@ -688,9 +588,6 @@ EXTRA_DIST = \
   test_client_unix.conf \
   test_configuration_data.conf \
   test_program_data.conf \
-  test_resolver_api_data.conf \
   test_service_data.conf \
   test_speedup_data.conf \
-  child_management_test.sh \
-  test_crypto_vectors.sh \
-  crypto-test-vectors.json
+  child_management_test.sh
diff --git a/src/util/bandwidth.c b/src/lib/util/bandwidth.c
similarity index 100%
rename from src/util/bandwidth.c
rename to src/lib/util/bandwidth.c
diff --git a/src/util/benchmark.c b/src/lib/util/benchmark.c
similarity index 100%
rename from src/util/benchmark.c
rename to src/lib/util/benchmark.c
diff --git a/src/util/benchmark.h b/src/lib/util/benchmark.h
similarity index 100%
rename from src/util/benchmark.h
rename to src/lib/util/benchmark.h
diff --git a/src/util/bio.c b/src/lib/util/bio.c
similarity index 100%
rename from src/util/bio.c
rename to src/lib/util/bio.c
diff --git a/src/util/buffer.c b/src/lib/util/buffer.c
similarity index 100%
rename from src/util/buffer.c
rename to src/lib/util/buffer.c
diff --git a/src/util/child_management.c b/src/lib/util/child_management.c
similarity index 100%
rename from src/util/child_management.c
rename to src/lib/util/child_management.c
diff --git a/src/util/child_management_test.sh 
b/src/lib/util/child_management_test.sh
similarity index 100%
rename from src/util/child_management_test.sh
rename to src/lib/util/child_management_test.sh
diff --git a/src/util/client.c b/src/lib/util/client.c
similarity index 100%
rename from src/util/client.c
rename to src/lib/util/client.c
diff --git a/src/util/common_allocation.c b/src/lib/util/common_allocation.c
similarity index 100%
rename from src/util/common_allocation.c
rename to src/lib/util/common_allocation.c
diff --git a/src/util/common_endian.c b/src/lib/util/common_endian.c
similarity index 100%
rename from src/util/common_endian.c
rename to src/lib/util/common_endian.c
diff --git a/src/util/common_logging.c b/src/lib/util/common_logging.c
similarity index 100%
rename from src/util/common_logging.c
rename to src/lib/util/common_logging.c
diff --git a/src/util/compress.c b/src/lib/util/compress.c
similarity index 100%
rename from src/util/compress.c
rename to src/lib/util/compress.c
diff --git a/src/util/configuration.c b/src/lib/util/configuration.c
similarity index 100%
rename from src/util/configuration.c
rename to src/lib/util/configuration.c
diff --git a/src/util/configuration_helper.c 
b/src/lib/util/configuration_helper.c
similarity index 100%
rename from src/util/configuration_helper.c
rename to src/lib/util/configuration_helper.c
diff --git a/src/util/consttime_memcmp.c b/src/lib/util/consttime_memcmp.c
similarity index 100%
rename from src/util/consttime_memcmp.c
rename to src/lib/util/consttime_memcmp.c
diff --git a/src/util/container_bloomfilter.c 
b/src/lib/util/container_bloomfilter.c
similarity index 100%
rename from src/util/container_bloomfilter.c
rename to src/lib/util/container_bloomfilter.c
diff --git a/src/util/container_heap.c b/src/lib/util/container_heap.c
similarity index 100%
rename from src/util/container_heap.c
rename to src/lib/util/container_heap.c
diff --git a/src/util/container_multihashmap.c 
b/src/lib/util/container_multihashmap.c
similarity index 100%
rename from src/util/container_multihashmap.c
rename to src/lib/util/container_multihashmap.c
diff --git a/src/util/container_multihashmap32.c 
b/src/lib/util/container_multihashmap32.c
similarity index 100%
rename from src/util/container_multihashmap32.c
rename to src/lib/util/container_multihashmap32.c
diff --git a/src/util/container_multipeermap.c 
b/src/lib/util/container_multipeermap.c
similarity index 100%
rename from src/util/container_multipeermap.c
rename to src/lib/util/container_multipeermap.c
diff --git a/src/util/container_multishortmap.c 
b/src/lib/util/container_multishortmap.c
similarity index 100%
rename from src/util/container_multishortmap.c
rename to src/lib/util/container_multishortmap.c
diff --git a/src/util/container_multiuuidmap.c 
b/src/lib/util/container_multiuuidmap.c
similarity index 100%
rename from src/util/container_multiuuidmap.c
rename to src/lib/util/container_multiuuidmap.c
diff --git a/src/util/crypto_crc.c b/src/lib/util/crypto_crc.c
similarity index 100%
rename from src/util/crypto_crc.c
rename to src/lib/util/crypto_crc.c
diff --git a/src/util/crypto_cs.c b/src/lib/util/crypto_cs.c
similarity index 100%
rename from src/util/crypto_cs.c
rename to src/lib/util/crypto_cs.c
diff --git a/src/util/crypto_ecc.c b/src/lib/util/crypto_ecc.c
similarity index 100%
rename from src/util/crypto_ecc.c
rename to src/lib/util/crypto_ecc.c
diff --git a/src/util/crypto_ecc_dlog.c b/src/lib/util/crypto_ecc_dlog.c
similarity index 100%
rename from src/util/crypto_ecc_dlog.c
rename to src/lib/util/crypto_ecc_dlog.c
diff --git a/src/util/crypto_ecc_gnsrecord.c 
b/src/lib/util/crypto_ecc_gnsrecord.c
similarity index 100%
rename from src/util/crypto_ecc_gnsrecord.c
rename to src/lib/util/crypto_ecc_gnsrecord.c
diff --git a/src/util/crypto_ecc_setup.c b/src/lib/util/crypto_ecc_setup.c
similarity index 100%
rename from src/util/crypto_ecc_setup.c
rename to src/lib/util/crypto_ecc_setup.c
diff --git a/src/util/crypto_edx25519.c b/src/lib/util/crypto_edx25519.c
similarity index 100%
rename from src/util/crypto_edx25519.c
rename to src/lib/util/crypto_edx25519.c
diff --git a/src/util/crypto_hash.c b/src/lib/util/crypto_hash.c
similarity index 100%
rename from src/util/crypto_hash.c
rename to src/lib/util/crypto_hash.c
diff --git a/src/util/crypto_hash_file.c b/src/lib/util/crypto_hash_file.c
similarity index 100%
rename from src/util/crypto_hash_file.c
rename to src/lib/util/crypto_hash_file.c
diff --git a/src/util/crypto_hkdf.c b/src/lib/util/crypto_hkdf.c
similarity index 100%
rename from src/util/crypto_hkdf.c
rename to src/lib/util/crypto_hkdf.c
diff --git a/src/util/crypto_kdf.c b/src/lib/util/crypto_kdf.c
similarity index 100%
rename from src/util/crypto_kdf.c
rename to src/lib/util/crypto_kdf.c
diff --git a/src/util/crypto_mpi.c b/src/lib/util/crypto_mpi.c
similarity index 100%
rename from src/util/crypto_mpi.c
rename to src/lib/util/crypto_mpi.c
diff --git a/src/util/crypto_paillier.c b/src/lib/util/crypto_paillier.c
similarity index 100%
rename from src/util/crypto_paillier.c
rename to src/lib/util/crypto_paillier.c
diff --git a/src/lib/util/crypto_pkey.c b/src/lib/util/crypto_pkey.c
new file mode 100644
index 000000000..0a55b3b65
--- /dev/null
+++ b/src/lib/util/crypto_pkey.c
@@ -0,0 +1,618 @@
+/*
+     This file is part of GNUnet.
+     Copyright (C) 2013, 2016, 2021 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 util/crypto_pkey.c
+ * @brief api to interact handle generic public keys
+ * @author Martin Schanzenbach
+ */
+
+#include "platform.h"
+#include "gnunet_util_lib.h"
+
+
+static enum GNUNET_GenericReturnValue
+check_key_type (uint32_t type)
+{
+  switch (type)
+  {
+  case GNUNET_PUBLIC_KEY_TYPE_ECDSA:
+  case GNUNET_PUBLIC_KEY_TYPE_EDDSA:
+    return GNUNET_OK;
+  default:
+    return GNUNET_SYSERR;
+  }
+  return GNUNET_SYSERR;
+}
+
+
+ssize_t
+GNUNET_CRYPTO_private_key_get_length (const struct
+                                        GNUNET_CRYPTO_PrivateKey *key)
+{
+  switch (ntohl (key->type))
+  {
+  case GNUNET_PUBLIC_KEY_TYPE_ECDSA:
+    return sizeof (key->type) + sizeof (key->ecdsa_key);
+    break;
+  case GNUNET_PUBLIC_KEY_TYPE_EDDSA:
+    return sizeof (key->type) + sizeof (key->eddsa_key);
+    break;
+  default:
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Got key type %u\n", ntohl (key->type));
+    GNUNET_break (0);
+  }
+  return -1;
+}
+
+
+ssize_t
+GNUNET_CRYPTO_public_key_get_length (const struct
+                                       GNUNET_CRYPTO_PublicKey *key)
+{
+  switch (ntohl (key->type))
+  {
+  case GNUNET_PUBLIC_KEY_TYPE_ECDSA:
+    return sizeof (key->type) + sizeof (key->ecdsa_key);
+  case GNUNET_PUBLIC_KEY_TYPE_EDDSA:
+    return sizeof (key->type) + sizeof (key->eddsa_key);
+  default:
+    GNUNET_break (0);
+  }
+  return -1;
+}
+
+
+ssize_t
+GNUNET_CRYPTO_private_key_length_by_type (enum GNUNET_CRYPTO_KeyType kt)
+{
+  switch (kt)
+  {
+  case GNUNET_PUBLIC_KEY_TYPE_ECDSA:
+    return sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
+    break;
+  case GNUNET_PUBLIC_KEY_TYPE_EDDSA:
+    return sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
+    break;
+  default:
+    GNUNET_break (0);
+  }
+  return -1;
+}
+
+
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_read_public_key_from_buffer (const void *buffer,
+                                             size_t len,
+                                             struct GNUNET_CRYPTO_PublicKey *
+                                             key,
+                                             size_t *kb_read)
+{
+  if (len < sizeof (key->type))
+    return GNUNET_SYSERR;
+  GNUNET_memcpy (&key->type,
+                 buffer,
+                 sizeof (key->type));
+  ssize_t length = GNUNET_CRYPTO_public_key_get_length (key);
+  if (len < length)
+    return GNUNET_SYSERR;
+  if (length < 0)
+    return GNUNET_SYSERR;
+  GNUNET_memcpy (&key->ecdsa_key,
+                 buffer + sizeof (key->type),
+                 length - sizeof (key->type));
+  *kb_read = length;
+  return GNUNET_OK;
+}
+
+
+ssize_t
+GNUNET_CRYPTO_write_public_key_to_buffer (const struct
+                                            GNUNET_CRYPTO_PublicKey *key,
+                                            void*buffer,
+                                            size_t len)
+{
+  const ssize_t length = GNUNET_CRYPTO_public_key_get_length (key);
+  if (len < length)
+    return -1;
+  if (length < 0)
+    return -2;
+  GNUNET_memcpy (buffer, &(key->type), sizeof (key->type));
+  GNUNET_memcpy (buffer + sizeof (key->type), &(key->ecdsa_key), length
+                 - sizeof (key->type));
+  return length;
+}
+
+
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_read_private_key_from_buffer (const void *buffer,
+                                              size_t len,
+                                              struct
+                                              GNUNET_CRYPTO_PrivateKey *key,
+                                              size_t *kb_read)
+{
+  if (len < sizeof (key->type))
+    return GNUNET_SYSERR;
+  GNUNET_memcpy (&key->type,
+                 buffer,
+                 sizeof (key->type));
+  ssize_t length = GNUNET_CRYPTO_private_key_get_length (key);
+  if (len < length)
+    return GNUNET_SYSERR;
+  if (length < 0)
+    return GNUNET_SYSERR;
+  GNUNET_memcpy (&key->ecdsa_key,
+                 buffer + sizeof (key->type),
+                 length - sizeof (key->type));
+  *kb_read = length;
+  return GNUNET_OK;
+}
+
+
+ssize_t
+GNUNET_CRYPTO_write_private_key_to_buffer (const struct
+                                             GNUNET_CRYPTO_PrivateKey *key,
+                                             void *buffer,
+                                             size_t len)
+{
+  const ssize_t length = GNUNET_CRYPTO_private_key_get_length (key);
+  if (len < length)
+    return -1;
+  if (length < 0)
+    return -2;
+  GNUNET_memcpy (buffer, &(key->type), sizeof (key->type));
+  GNUNET_memcpy (buffer + sizeof (key->type), &(key->ecdsa_key), length
+                 - sizeof (key->type));
+  return length;
+}
+
+
+ssize_t
+GNUNET_CRYPTO_signature_get_length (const struct
+                                      GNUNET_CRYPTO_Signature *sig)
+{
+  switch (ntohl (sig->type))
+  {
+  case GNUNET_PUBLIC_KEY_TYPE_ECDSA:
+    return sizeof (sig->type) + sizeof (sig->ecdsa_signature);
+    break;
+  case GNUNET_PUBLIC_KEY_TYPE_EDDSA:
+    return sizeof (sig->type) + sizeof (sig->eddsa_signature);
+    break;
+  default:
+    GNUNET_break (0);
+  }
+  return -1;
+}
+
+
+ssize_t
+GNUNET_CRYPTO_signature_get_raw_length_by_type (uint32_t type)
+{
+  switch (ntohl (type))
+  {
+  case GNUNET_PUBLIC_KEY_TYPE_ECDSA:
+    return sizeof (struct GNUNET_CRYPTO_EcdsaSignature);
+    break;
+  case GNUNET_PUBLIC_KEY_TYPE_EDDSA:
+    return sizeof (struct GNUNET_CRYPTO_EddsaSignature);
+    break;
+  default:
+    GNUNET_break (0);
+  }
+  return -1;
+}
+
+
+ssize_t
+GNUNET_CRYPTO_read_signature_from_buffer (struct
+                                            GNUNET_CRYPTO_Signature *sig,
+                                            const void*buffer,
+                                            size_t len)
+{
+  if (len < sizeof (sig->type))
+    return -1;
+  GNUNET_memcpy (&(sig->type), buffer, sizeof (sig->type));
+  const ssize_t length = GNUNET_CRYPTO_signature_get_length (sig);
+  if (len < length)
+    return -1;
+  if (length < 0)
+    return -2;
+  GNUNET_memcpy (&(sig->ecdsa_signature), buffer + sizeof (sig->type), length
+                 - sizeof (sig->type));
+  return length;
+}
+
+
+ssize_t
+GNUNET_CRYPTO_write_signature_to_buffer (const struct
+                                           GNUNET_CRYPTO_Signature *sig,
+                                           void*buffer,
+                                           size_t len)
+{
+  const ssize_t length = GNUNET_CRYPTO_signature_get_length (sig);
+  if (len < length)
+    return -1;
+  if (length < 0)
+    return -2;
+  GNUNET_memcpy (buffer, &(sig->type), sizeof (sig->type));
+  GNUNET_memcpy (buffer + sizeof (sig->type), &(sig->ecdsa_signature), length
+                 - sizeof (sig->type));
+  return length;
+}
+
+
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_sign_raw_ (const struct
+                           GNUNET_CRYPTO_PrivateKey *priv,
+                           const struct
+                           GNUNET_CRYPTO_EccSignaturePurpose *purpose,
+                           unsigned char *sig)
+{
+  switch (ntohl (priv->type))
+  {
+  case GNUNET_PUBLIC_KEY_TYPE_ECDSA:
+    return GNUNET_CRYPTO_ecdsa_sign_ (&(priv->ecdsa_key), purpose,
+                                      (struct
+                                       GNUNET_CRYPTO_EcdsaSignature*) sig);
+    break;
+  case GNUNET_PUBLIC_KEY_TYPE_EDDSA:
+    return GNUNET_CRYPTO_eddsa_sign_ (&(priv->eddsa_key), purpose,
+                                      (struct
+                                       GNUNET_CRYPTO_EddsaSignature*) sig);
+    break;
+  default:
+    GNUNET_break (0);
+  }
+
+  return GNUNET_SYSERR;
+}
+
+
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_sign_ (const struct
+                       GNUNET_CRYPTO_PrivateKey *priv,
+                       const struct
+                       GNUNET_CRYPTO_EccSignaturePurpose *purpose,
+                       struct GNUNET_CRYPTO_Signature *sig)
+{
+  sig->type = priv->type;
+  switch (ntohl (priv->type))
+  {
+  case GNUNET_PUBLIC_KEY_TYPE_ECDSA:
+    return GNUNET_CRYPTO_ecdsa_sign_ (&(priv->ecdsa_key), purpose,
+                                      &(sig->ecdsa_signature));
+    break;
+  case GNUNET_PUBLIC_KEY_TYPE_EDDSA:
+    return GNUNET_CRYPTO_eddsa_sign_ (&(priv->eddsa_key), purpose,
+                                      &(sig->eddsa_signature));
+    break;
+  default:
+    GNUNET_break (0);
+  }
+
+  return GNUNET_SYSERR;
+}
+
+
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_signature_verify_ (uint32_t purpose,
+                                   const struct
+                                   GNUNET_CRYPTO_EccSignaturePurpose *validate,
+                                   const struct GNUNET_CRYPTO_Signature *sig,
+                                   const struct GNUNET_CRYPTO_PublicKey *pub)
+{
+  /* check type matching of 'sig' and 'pub' */
+  GNUNET_assert (ntohl (pub->type) == ntohl (sig->type));
+  switch (ntohl (pub->type))
+  {
+  case GNUNET_PUBLIC_KEY_TYPE_ECDSA:
+    return GNUNET_CRYPTO_ecdsa_verify_ (purpose, validate,
+                                        &(sig->ecdsa_signature),
+                                        &(pub->ecdsa_key));
+    break;
+  case GNUNET_PUBLIC_KEY_TYPE_EDDSA:
+    return GNUNET_CRYPTO_eddsa_verify_ (purpose, validate,
+                                        &(sig->eddsa_signature),
+                                        &(pub->eddsa_key));
+    break;
+  default:
+    GNUNET_break (0);
+  }
+
+  return GNUNET_SYSERR;
+}
+
+
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_signature_verify_raw_ (uint32_t purpose,
+                                       const struct
+                                       GNUNET_CRYPTO_EccSignaturePurpose *
+                                       validate,
+                                       const unsigned char *sig,
+                                       const struct
+                                       GNUNET_CRYPTO_PublicKey *pub)
+{
+  switch (ntohl (pub->type))
+  {
+  case GNUNET_PUBLIC_KEY_TYPE_ECDSA:
+    return GNUNET_CRYPTO_ecdsa_verify_ (purpose, validate,
+                                        (struct
+                                         GNUNET_CRYPTO_EcdsaSignature*) sig,
+                                        &(pub->ecdsa_key));
+    break;
+  case GNUNET_PUBLIC_KEY_TYPE_EDDSA:
+    return GNUNET_CRYPTO_eddsa_verify_ (purpose, validate,
+                                        (struct
+                                         GNUNET_CRYPTO_EddsaSignature*) sig,
+                                        &(pub->eddsa_key));
+    break;
+  default:
+    GNUNET_break (0);
+  }
+
+  return GNUNET_SYSERR;
+}
+
+
+ssize_t
+GNUNET_CRYPTO_encrypt_old (const void *block,
+                             size_t size,
+                             const struct GNUNET_CRYPTO_PublicKey *pub,
+                             struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
+                             void *result)
+{
+  struct GNUNET_CRYPTO_EcdhePrivateKey pk;
+  GNUNET_CRYPTO_ecdhe_key_create (&pk);
+  struct GNUNET_HashCode hash;
+  switch (ntohl (pub->type))
+  {
+  case GNUNET_PUBLIC_KEY_TYPE_ECDSA:
+    if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdh_ecdsa (&pk, &(pub->ecdsa_key),
+                                                   &hash))
+      return -1;
+    break;
+  case GNUNET_PUBLIC_KEY_TYPE_EDDSA:
+    if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdh_eddsa (&pk, &(pub->eddsa_key),
+                                                   &hash))
+      return -1;
+    break;
+  default:
+    return -1;
+  }
+  GNUNET_CRYPTO_ecdhe_key_get_public (&pk, ecc);
+  GNUNET_CRYPTO_ecdhe_key_clear (&pk);
+  struct GNUNET_CRYPTO_SymmetricSessionKey key;
+  struct GNUNET_CRYPTO_SymmetricInitializationVector iv;
+  GNUNET_CRYPTO_hash_to_aes_key (&hash, &key, &iv);
+  GNUNET_CRYPTO_zero_keys (&hash, sizeof(hash));
+  const ssize_t encrypted = GNUNET_CRYPTO_symmetric_encrypt (block, size, &key,
+                                                             &iv, result);
+  GNUNET_CRYPTO_zero_keys (&key, sizeof(key));
+  GNUNET_CRYPTO_zero_keys (&iv, sizeof(iv));
+  return encrypted;
+}
+
+
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_encrypt (const void *pt,
+                         size_t pt_size,
+                         const struct GNUNET_CRYPTO_PublicKey *pub,
+                         void *ct_buf,
+                         size_t ct_size)
+{
+  struct GNUNET_HashCode k;
+  struct GNUNET_CRYPTO_FoKemC kemc;
+  struct GNUNET_CRYPTO_FoKemC *kemc_buf = (struct GNUNET_CRYPTO_FoKemC*) 
ct_buf;
+  unsigned char *encrypted_data = (unsigned char*) &kemc_buf[1];
+  unsigned char nonce[crypto_secretbox_NONCEBYTES];
+  unsigned char key[crypto_secretbox_KEYBYTES];
+
+  if (ct_size < pt_size + GNUNET_CRYPTO_ENCRYPT_OVERHEAD_BYTES)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Output buffer size for ciphertext too small: Got %lu, want 
>=%lu\n",
+                ct_size, pt_size + GNUNET_CRYPTO_ENCRYPT_OVERHEAD_BYTES);
+    return GNUNET_SYSERR;
+  }
+  switch (ntohl (pub->type))
+  {
+  case GNUNET_PUBLIC_KEY_TYPE_ECDSA:
+    if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdsa_fo_kem_encaps (&(pub->ecdsa_key),
+                                                            &kemc,
+                                                            &k))
+      return GNUNET_SYSERR;
+    break;
+  case GNUNET_PUBLIC_KEY_TYPE_EDDSA:
+    if (GNUNET_SYSERR == GNUNET_CRYPTO_eddsa_fo_kem_encaps (&pub->eddsa_key,
+                                                            &kemc,
+                                                            &k))
+      return GNUNET_SYSERR;
+    break;
+  default:
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unsupported key type\n");
+    return GNUNET_SYSERR;
+  }
+  memcpy (key, &k, crypto_secretbox_KEYBYTES);
+  memcpy (nonce, ((char* ) &k) + crypto_secretbox_KEYBYTES,
+          crypto_secretbox_NONCEBYTES);
+  if (crypto_secretbox_easy (encrypted_data, pt, pt_size, nonce, key))
+    return GNUNET_SYSERR;
+  memcpy (kemc_buf, &kemc, sizeof (kemc));
+  return GNUNET_OK;
+}
+
+
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_decrypt (const void *ct_buf,
+                         size_t ct_size,
+                         const struct GNUNET_CRYPTO_PrivateKey *priv,
+                         void *pt,
+                         size_t pt_size)
+{
+  struct GNUNET_HashCode k;
+  struct GNUNET_CRYPTO_FoKemC *kemc = (struct GNUNET_CRYPTO_FoKemC*) ct_buf;
+  unsigned char *encrypted_data = (unsigned char*) &kemc[1];
+  unsigned char nonce[crypto_secretbox_NONCEBYTES];
+  unsigned char key[crypto_secretbox_KEYBYTES];
+  size_t expected_pt_len = ct_size - GNUNET_CRYPTO_ENCRYPT_OVERHEAD_BYTES;
+
+  if (pt_size < expected_pt_len)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Output buffer size for plaintext too small: Got %lu, want 
>=%lu\n",
+                pt_size, expected_pt_len);
+    return GNUNET_SYSERR;
+  }
+  switch (ntohl (priv->type))
+  {
+  case GNUNET_PUBLIC_KEY_TYPE_ECDSA:
+    if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdsa_fo_kem_decaps (&(priv->ecdsa_key),
+                                                            kemc,
+                                                            &k))
+      return GNUNET_SYSERR;
+    break;
+  case GNUNET_PUBLIC_KEY_TYPE_EDDSA:
+    if (GNUNET_SYSERR == GNUNET_CRYPTO_eddsa_fo_kem_decaps (&(priv->eddsa_key),
+                                                            kemc,
+                                                            &k))
+      return GNUNET_SYSERR;
+    break;
+  default:
+    return GNUNET_SYSERR;
+  }
+  memcpy (key, &k, crypto_secretbox_KEYBYTES);
+  memcpy (nonce, ((char* ) &k) + crypto_secretbox_KEYBYTES,
+          crypto_secretbox_NONCEBYTES);
+  if (crypto_secretbox_open_easy (pt, encrypted_data, ct_size - sizeof (*kemc),
+                                  nonce, key))
+    return GNUNET_SYSERR;
+  return GNUNET_OK;
+}
+
+
+ssize_t
+GNUNET_CRYPTO_decrypt_old (const void *block,
+                             size_t size,
+                             const struct GNUNET_CRYPTO_PrivateKey *priv,
+                             const struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
+                             void *result)
+{
+  struct GNUNET_HashCode hash;
+  switch (ntohl (priv->type))
+  {
+  case GNUNET_PUBLIC_KEY_TYPE_ECDSA:
+    if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdsa_ecdh (&(priv->ecdsa_key), ecc,
+                                                   &hash))
+      return -1;
+    break;
+  case GNUNET_PUBLIC_KEY_TYPE_EDDSA:
+    if (GNUNET_SYSERR == GNUNET_CRYPTO_eddsa_ecdh (&(priv->eddsa_key), ecc,
+                                                   &hash))
+      return -1;
+    break;
+  default:
+    return -1;
+  }
+  struct GNUNET_CRYPTO_SymmetricSessionKey key;
+  struct GNUNET_CRYPTO_SymmetricInitializationVector iv;
+  GNUNET_CRYPTO_hash_to_aes_key (&hash, &key, &iv);
+  GNUNET_CRYPTO_zero_keys (&hash, sizeof(hash));
+  const ssize_t decrypted = GNUNET_CRYPTO_symmetric_decrypt (block, size, &key,
+                                                             &iv, result);
+  GNUNET_CRYPTO_zero_keys (&key, sizeof(key));
+  GNUNET_CRYPTO_zero_keys (&iv, sizeof(iv));
+  return decrypted;
+}
+
+
+char *
+GNUNET_CRYPTO_public_key_to_string (const struct
+                                      GNUNET_CRYPTO_PublicKey *key)
+{
+  size_t size = GNUNET_CRYPTO_public_key_get_length (key);
+  return GNUNET_STRINGS_data_to_string_alloc (key,
+                                              size);
+}
+
+
+char *
+GNUNET_CRYPTO_private_key_to_string (const struct
+                                       GNUNET_CRYPTO_PrivateKey *key)
+{
+  size_t size = GNUNET_CRYPTO_private_key_get_length (key);
+  return GNUNET_STRINGS_data_to_string_alloc (key,
+                                              size);
+}
+
+
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_public_key_from_string (const char *str,
+                                        struct GNUNET_CRYPTO_PublicKey *key)
+{
+  enum GNUNET_GenericReturnValue ret;
+  ret = GNUNET_STRINGS_string_to_data (str,
+                                       strlen (str),
+                                       key,
+                                       sizeof (*key));
+  if (GNUNET_OK != ret)
+    return GNUNET_SYSERR;
+  return check_key_type (ntohl (key->type));
+
+}
+
+
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_private_key_from_string (const char *str,
+                                         struct GNUNET_CRYPTO_PrivateKey *key)
+{
+  enum GNUNET_GenericReturnValue ret;
+  ret = GNUNET_STRINGS_string_to_data (str,
+                                       strlen (str),
+                                       key,
+                                       sizeof (*key));
+  if (GNUNET_OK != ret)
+    return GNUNET_SYSERR;
+  return check_key_type (ntohl (key->type));
+}
+
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_key_get_public (const struct
+                                GNUNET_CRYPTO_PrivateKey *privkey,
+                                struct GNUNET_CRYPTO_PublicKey *key)
+{
+  key->type = privkey->type;
+  switch (ntohl (privkey->type))
+  {
+  case GNUNET_PUBLIC_KEY_TYPE_ECDSA:
+    GNUNET_CRYPTO_ecdsa_key_get_public (&privkey->ecdsa_key,
+                                        &key->ecdsa_key);
+    break;
+  case GNUNET_PUBLIC_KEY_TYPE_EDDSA:
+    GNUNET_CRYPTO_eddsa_key_get_public (&privkey->eddsa_key,
+                                        &key->eddsa_key);
+    break;
+  default:
+    GNUNET_break (0);
+    return GNUNET_SYSERR;
+  }
+  return GNUNET_OK;
+}
diff --git a/src/util/crypto_pow.c b/src/lib/util/crypto_pow.c
similarity index 100%
rename from src/util/crypto_pow.c
rename to src/lib/util/crypto_pow.c
diff --git a/src/util/crypto_random.c b/src/lib/util/crypto_random.c
similarity index 100%
rename from src/util/crypto_random.c
rename to src/lib/util/crypto_random.c
diff --git a/src/util/crypto_rsa.c b/src/lib/util/crypto_rsa.c
similarity index 100%
rename from src/util/crypto_rsa.c
rename to src/lib/util/crypto_rsa.c
diff --git a/src/util/crypto_symmetric.c b/src/lib/util/crypto_symmetric.c
similarity index 100%
rename from src/util/crypto_symmetric.c
rename to src/lib/util/crypto_symmetric.c
diff --git a/src/util/disk.c b/src/lib/util/disk.c
similarity index 100%
rename from src/util/disk.c
rename to src/lib/util/disk.c
diff --git a/src/util/disk.h b/src/lib/util/disk.h
similarity index 100%
rename from src/util/disk.h
rename to src/lib/util/disk.h
diff --git a/src/util/dnsparser.c b/src/lib/util/dnsparser.c
similarity index 100%
rename from src/util/dnsparser.c
rename to src/lib/util/dnsparser.c
diff --git a/src/util/dnsstub.c b/src/lib/util/dnsstub.c
similarity index 100%
rename from src/util/dnsstub.c
rename to src/lib/util/dnsstub.c
diff --git a/src/util/getopt.c b/src/lib/util/getopt.c
similarity index 100%
rename from src/util/getopt.c
rename to src/lib/util/getopt.c
diff --git a/src/util/getopt_helpers.c b/src/lib/util/getopt_helpers.c
similarity index 100%
rename from src/util/getopt_helpers.c
rename to src/lib/util/getopt_helpers.c
diff --git a/src/util/gnunet_error_codes.c b/src/lib/util/gnunet_error_codes.c
similarity index 100%
rename from src/util/gnunet_error_codes.c
rename to src/lib/util/gnunet_error_codes.c
diff --git a/src/util/helper.c b/src/lib/util/helper.c
similarity index 100%
rename from src/util/helper.c
rename to src/lib/util/helper.c
diff --git a/src/util/load.c b/src/lib/util/load.c
similarity index 100%
rename from src/util/load.c
rename to src/lib/util/load.c
diff --git a/src/util/meson.build b/src/lib/util/meson.build
similarity index 100%
rename from src/util/meson.build
rename to src/lib/util/meson.build
diff --git a/src/util/mq.c b/src/lib/util/mq.c
similarity index 100%
rename from src/util/mq.c
rename to src/lib/util/mq.c
diff --git a/src/util/mst.c b/src/lib/util/mst.c
similarity index 100%
rename from src/util/mst.c
rename to src/lib/util/mst.c
diff --git a/src/util/nc.c b/src/lib/util/nc.c
similarity index 100%
rename from src/util/nc.c
rename to src/lib/util/nc.c
diff --git a/src/util/network.c b/src/lib/util/network.c
similarity index 100%
rename from src/util/network.c
rename to src/lib/util/network.c
diff --git a/src/util/nt.c b/src/lib/util/nt.c
similarity index 100%
rename from src/util/nt.c
rename to src/lib/util/nt.c
diff --git a/src/util/op.c b/src/lib/util/op.c
similarity index 100%
rename from src/util/op.c
rename to src/lib/util/op.c
diff --git a/src/util/os_installation.c b/src/lib/util/os_installation.c
similarity index 100%
rename from src/util/os_installation.c
rename to src/lib/util/os_installation.c
diff --git a/src/util/os_network.c b/src/lib/util/os_network.c
similarity index 100%
rename from src/util/os_network.c
rename to src/lib/util/os_network.c
diff --git a/src/util/os_priority.c b/src/lib/util/os_priority.c
similarity index 100%
rename from src/util/os_priority.c
rename to src/lib/util/os_priority.c
diff --git a/src/util/peer.c b/src/lib/util/peer.c
similarity index 100%
rename from src/util/peer.c
rename to src/lib/util/peer.c
diff --git a/src/util/perf_crypto_asymmetric.c 
b/src/lib/util/perf_crypto_asymmetric.c
similarity index 100%
rename from src/util/perf_crypto_asymmetric.c
rename to src/lib/util/perf_crypto_asymmetric.c
diff --git a/src/util/perf_crypto_cs.c b/src/lib/util/perf_crypto_cs.c
similarity index 100%
rename from src/util/perf_crypto_cs.c
rename to src/lib/util/perf_crypto_cs.c
diff --git a/src/util/perf_crypto_ecc_dlog.c 
b/src/lib/util/perf_crypto_ecc_dlog.c
similarity index 100%
rename from src/util/perf_crypto_ecc_dlog.c
rename to src/lib/util/perf_crypto_ecc_dlog.c
diff --git a/src/util/perf_crypto_hash.c b/src/lib/util/perf_crypto_hash.c
similarity index 100%
rename from src/util/perf_crypto_hash.c
rename to src/lib/util/perf_crypto_hash.c
diff --git a/src/util/perf_crypto_paillier.c 
b/src/lib/util/perf_crypto_paillier.c
similarity index 100%
rename from src/util/perf_crypto_paillier.c
rename to src/lib/util/perf_crypto_paillier.c
diff --git a/src/util/perf_crypto_rsa.c b/src/lib/util/perf_crypto_rsa.c
similarity index 100%
rename from src/util/perf_crypto_rsa.c
rename to src/lib/util/perf_crypto_rsa.c
diff --git a/src/util/perf_crypto_symmetric.c 
b/src/lib/util/perf_crypto_symmetric.c
similarity index 100%
rename from src/util/perf_crypto_symmetric.c
rename to src/lib/util/perf_crypto_symmetric.c
diff --git a/src/util/perf_malloc.c b/src/lib/util/perf_malloc.c
similarity index 100%
rename from src/util/perf_malloc.c
rename to src/lib/util/perf_malloc.c
diff --git a/src/util/perf_mq.c b/src/lib/util/perf_mq.c
similarity index 100%
rename from src/util/perf_mq.c
rename to src/lib/util/perf_mq.c
diff --git a/src/util/perf_scheduler.c b/src/lib/util/perf_scheduler.c
similarity index 100%
rename from src/util/perf_scheduler.c
rename to src/lib/util/perf_scheduler.c
diff --git a/src/util/plugin.c b/src/lib/util/plugin.c
similarity index 100%
rename from src/util/plugin.c
rename to src/lib/util/plugin.c
diff --git a/src/util/proc_compat.c b/src/lib/util/proc_compat.c
similarity index 100%
rename from src/util/proc_compat.c
rename to src/lib/util/proc_compat.c
diff --git a/src/util/program.c b/src/lib/util/program.c
similarity index 100%
rename from src/util/program.c
rename to src/lib/util/program.c
diff --git a/src/util/regex.c b/src/lib/util/regex.c
similarity index 100%
rename from src/util/regex.c
rename to src/lib/util/regex.c
diff --git a/src/util/resolver.conf.in b/src/lib/util/resolver.conf
similarity index 85%
copy from src/util/resolver.conf.in
copy to src/lib/util/resolver.conf
index 6e2b9a869..aae876952 100644
--- a/src/util/resolver.conf.in
+++ b/src/lib/util/resolver.conf
@@ -1,6 +1,6 @@
 [resolver]
-START_ON_DEMAND = @START_ON_DEMAND@
-@JAVAPORT@PORT = 2089
+START_ON_DEMAND = YES
+#PORT = 2089
 HOSTNAME = localhost
 BINARY = gnunet-service-resolver
 ACCEPT_FROM = 127.0.0.1;
diff --git a/src/util/resolver.conf.in b/src/lib/util/resolver.conf.in
similarity index 100%
rename from src/util/resolver.conf.in
rename to src/lib/util/resolver.conf.in
diff --git a/src/util/resolver.h b/src/lib/util/resolver.h
similarity index 100%
rename from src/util/resolver.h
rename to src/lib/util/resolver.h
diff --git a/src/util/resolver_api.c b/src/lib/util/resolver_api.c
similarity index 100%
rename from src/util/resolver_api.c
rename to src/lib/util/resolver_api.c
diff --git a/src/util/scheduler.c b/src/lib/util/scheduler.c
similarity index 100%
rename from src/util/scheduler.c
rename to src/lib/util/scheduler.c
diff --git a/src/util/service.c b/src/lib/util/service.c
similarity index 100%
rename from src/util/service.c
rename to src/lib/util/service.c
diff --git a/src/util/signal.c b/src/lib/util/signal.c
similarity index 100%
rename from src/util/signal.c
rename to src/lib/util/signal.c
diff --git a/src/util/socks.c b/src/lib/util/socks.c
similarity index 100%
rename from src/util/socks.c
rename to src/lib/util/socks.c
diff --git a/src/util/speedup.c b/src/lib/util/speedup.c
similarity index 100%
rename from src/util/speedup.c
rename to src/lib/util/speedup.c
diff --git a/src/util/speedup.h b/src/lib/util/speedup.h
similarity index 100%
rename from src/util/speedup.h
rename to src/lib/util/speedup.h
diff --git a/src/util/strings.c b/src/lib/util/strings.c
similarity index 100%
rename from src/util/strings.c
rename to src/lib/util/strings.c
diff --git a/src/util/test_bio.c b/src/lib/util/test_bio.c
similarity index 100%
rename from src/util/test_bio.c
rename to src/lib/util/test_bio.c
diff --git a/src/util/test_child_management.c 
b/src/lib/util/test_child_management.c
similarity index 100%
rename from src/util/test_child_management.c
rename to src/lib/util/test_child_management.c
diff --git a/src/util/test_client.c b/src/lib/util/test_client.c
similarity index 100%
rename from src/util/test_client.c
rename to src/lib/util/test_client.c
diff --git a/src/util/test_client_data.conf b/src/lib/util/test_client_data.conf
similarity index 100%
rename from src/util/test_client_data.conf
rename to src/lib/util/test_client_data.conf
diff --git a/src/util/test_client_unix.conf b/src/lib/util/test_client_unix.conf
similarity index 100%
rename from src/util/test_client_unix.conf
rename to src/lib/util/test_client_unix.conf
diff --git a/src/util/test_common_allocation.c 
b/src/lib/util/test_common_allocation.c
similarity index 100%
rename from src/util/test_common_allocation.c
rename to src/lib/util/test_common_allocation.c
diff --git a/src/util/test_common_endian.c b/src/lib/util/test_common_endian.c
similarity index 100%
rename from src/util/test_common_endian.c
rename to src/lib/util/test_common_endian.c
diff --git a/src/util/test_common_logging.c b/src/lib/util/test_common_logging.c
similarity index 100%
rename from src/util/test_common_logging.c
rename to src/lib/util/test_common_logging.c
diff --git a/src/util/test_common_logging_dummy.c 
b/src/lib/util/test_common_logging_dummy.c
similarity index 100%
rename from src/util/test_common_logging_dummy.c
rename to src/lib/util/test_common_logging_dummy.c
diff --git a/src/util/test_common_logging_runtime_loglevels.c 
b/src/lib/util/test_common_logging_runtime_loglevels.c
similarity index 100%
rename from src/util/test_common_logging_runtime_loglevels.c
rename to src/lib/util/test_common_logging_runtime_loglevels.c
diff --git a/src/util/test_configuration.c b/src/lib/util/test_configuration.c
similarity index 100%
rename from src/util/test_configuration.c
rename to src/lib/util/test_configuration.c
diff --git a/src/util/test_configuration_data.conf 
b/src/lib/util/test_configuration_data.conf
similarity index 100%
rename from src/util/test_configuration_data.conf
rename to src/lib/util/test_configuration_data.conf
diff --git a/src/util/test_container_bloomfilter.c 
b/src/lib/util/test_container_bloomfilter.c
similarity index 100%
rename from src/util/test_container_bloomfilter.c
rename to src/lib/util/test_container_bloomfilter.c
diff --git a/src/util/test_container_dll.c b/src/lib/util/test_container_dll.c
similarity index 100%
rename from src/util/test_container_dll.c
rename to src/lib/util/test_container_dll.c
diff --git a/src/util/test_container_heap.c b/src/lib/util/test_container_heap.c
similarity index 100%
rename from src/util/test_container_heap.c
rename to src/lib/util/test_container_heap.c
diff --git a/src/util/test_container_multihashmap.c 
b/src/lib/util/test_container_multihashmap.c
similarity index 100%
rename from src/util/test_container_multihashmap.c
rename to src/lib/util/test_container_multihashmap.c
diff --git a/src/util/test_container_multihashmap32.c 
b/src/lib/util/test_container_multihashmap32.c
similarity index 100%
rename from src/util/test_container_multihashmap32.c
rename to src/lib/util/test_container_multihashmap32.c
diff --git a/src/util/test_container_multipeermap.c 
b/src/lib/util/test_container_multipeermap.c
similarity index 100%
rename from src/util/test_container_multipeermap.c
rename to src/lib/util/test_container_multipeermap.c
diff --git a/src/util/test_crypto_crc.c b/src/lib/util/test_crypto_crc.c
similarity index 100%
rename from src/util/test_crypto_crc.c
rename to src/lib/util/test_crypto_crc.c
diff --git a/src/util/test_crypto_cs.c b/src/lib/util/test_crypto_cs.c
similarity index 100%
rename from src/util/test_crypto_cs.c
rename to src/lib/util/test_crypto_cs.c
diff --git a/src/util/test_crypto_ecc_dlog.c 
b/src/lib/util/test_crypto_ecc_dlog.c
similarity index 100%
rename from src/util/test_crypto_ecc_dlog.c
rename to src/lib/util/test_crypto_ecc_dlog.c
diff --git a/src/util/test_crypto_ecdh_ecdsa.c 
b/src/lib/util/test_crypto_ecdh_ecdsa.c
similarity index 100%
rename from src/util/test_crypto_ecdh_ecdsa.c
rename to src/lib/util/test_crypto_ecdh_ecdsa.c
diff --git a/src/util/test_crypto_ecdh_eddsa.c 
b/src/lib/util/test_crypto_ecdh_eddsa.c
similarity index 100%
rename from src/util/test_crypto_ecdh_eddsa.c
rename to src/lib/util/test_crypto_ecdh_eddsa.c
diff --git a/src/util/test_crypto_ecdhe.c b/src/lib/util/test_crypto_ecdhe.c
similarity index 100%
rename from src/util/test_crypto_ecdhe.c
rename to src/lib/util/test_crypto_ecdhe.c
diff --git a/src/util/test_crypto_ecdsa.c b/src/lib/util/test_crypto_ecdsa.c
similarity index 100%
rename from src/util/test_crypto_ecdsa.c
rename to src/lib/util/test_crypto_ecdsa.c
diff --git a/src/util/test_crypto_eddsa.c b/src/lib/util/test_crypto_eddsa.c
similarity index 100%
rename from src/util/test_crypto_eddsa.c
rename to src/lib/util/test_crypto_eddsa.c
diff --git a/src/util/test_crypto_edx25519.c 
b/src/lib/util/test_crypto_edx25519.c
similarity index 100%
rename from src/util/test_crypto_edx25519.c
rename to src/lib/util/test_crypto_edx25519.c
diff --git a/src/util/test_crypto_hash.c b/src/lib/util/test_crypto_hash.c
similarity index 100%
rename from src/util/test_crypto_hash.c
rename to src/lib/util/test_crypto_hash.c
diff --git a/src/util/test_crypto_hash_context.c 
b/src/lib/util/test_crypto_hash_context.c
similarity index 100%
rename from src/util/test_crypto_hash_context.c
rename to src/lib/util/test_crypto_hash_context.c
diff --git a/src/util/test_crypto_hkdf.c b/src/lib/util/test_crypto_hkdf.c
similarity index 100%
rename from src/util/test_crypto_hkdf.c
rename to src/lib/util/test_crypto_hkdf.c
diff --git a/src/util/test_crypto_kdf.c b/src/lib/util/test_crypto_kdf.c
similarity index 100%
rename from src/util/test_crypto_kdf.c
rename to src/lib/util/test_crypto_kdf.c
diff --git a/src/util/test_crypto_paillier.c 
b/src/lib/util/test_crypto_paillier.c
similarity index 100%
rename from src/util/test_crypto_paillier.c
rename to src/lib/util/test_crypto_paillier.c
diff --git a/src/util/test_crypto_random.c b/src/lib/util/test_crypto_random.c
similarity index 100%
rename from src/util/test_crypto_random.c
rename to src/lib/util/test_crypto_random.c
diff --git a/src/util/test_crypto_rsa.c b/src/lib/util/test_crypto_rsa.c
similarity index 100%
rename from src/util/test_crypto_rsa.c
rename to src/lib/util/test_crypto_rsa.c
diff --git a/src/util/test_crypto_symmetric.c 
b/src/lib/util/test_crypto_symmetric.c
similarity index 100%
rename from src/util/test_crypto_symmetric.c
rename to src/lib/util/test_crypto_symmetric.c
diff --git a/src/util/test_disk.c b/src/lib/util/test_disk.c
similarity index 100%
rename from src/util/test_disk.c
rename to src/lib/util/test_disk.c
diff --git a/src/util/test_getopt.c b/src/lib/util/test_getopt.c
similarity index 100%
rename from src/util/test_getopt.c
rename to src/lib/util/test_getopt.c
diff --git a/src/util/test_hexcoder.c b/src/lib/util/test_hexcoder.c
similarity index 100%
rename from src/util/test_hexcoder.c
rename to src/lib/util/test_hexcoder.c
diff --git a/src/util/test_mq.c b/src/lib/util/test_mq.c
similarity index 100%
rename from src/util/test_mq.c
rename to src/lib/util/test_mq.c
diff --git a/src/util/test_os_network.c b/src/lib/util/test_os_network.c
similarity index 100%
rename from src/util/test_os_network.c
rename to src/lib/util/test_os_network.c
diff --git a/src/util/test_os_start_process.c 
b/src/lib/util/test_os_start_process.c
similarity index 100%
rename from src/util/test_os_start_process.c
rename to src/lib/util/test_os_start_process.c
diff --git a/src/util/test_peer.c b/src/lib/util/test_peer.c
similarity index 100%
rename from src/util/test_peer.c
rename to src/lib/util/test_peer.c
diff --git a/src/util/test_plugin.c b/src/lib/util/test_plugin.c
similarity index 100%
rename from src/util/test_plugin.c
rename to src/lib/util/test_plugin.c
diff --git a/src/util/test_plugin_plug.c b/src/lib/util/test_plugin_plug.c
similarity index 100%
rename from src/util/test_plugin_plug.c
rename to src/lib/util/test_plugin_plug.c
diff --git a/src/util/test_program.c b/src/lib/util/test_program.c
similarity index 100%
rename from src/util/test_program.c
rename to src/lib/util/test_program.c
diff --git a/src/util/test_program_data.conf 
b/src/lib/util/test_program_data.conf
similarity index 100%
rename from src/util/test_program_data.conf
rename to src/lib/util/test_program_data.conf
diff --git a/src/util/test_regex.c b/src/lib/util/test_regex.c
similarity index 100%
rename from src/util/test_regex.c
rename to src/lib/util/test_regex.c
diff --git a/src/util/test_scheduler.c b/src/lib/util/test_scheduler.c
similarity index 100%
rename from src/util/test_scheduler.c
rename to src/lib/util/test_scheduler.c
diff --git a/src/util/test_scheduler_delay.c 
b/src/lib/util/test_scheduler_delay.c
similarity index 100%
rename from src/util/test_scheduler_delay.c
rename to src/lib/util/test_scheduler_delay.c
diff --git a/src/util/test_scheduler_hogging_cancel.c 
b/src/lib/util/test_scheduler_hogging_cancel.c
similarity index 100%
rename from src/util/test_scheduler_hogging_cancel.c
rename to src/lib/util/test_scheduler_hogging_cancel.c
diff --git a/src/util/test_scheduler_hogging_priority.c 
b/src/lib/util/test_scheduler_hogging_priority.c
similarity index 100%
rename from src/util/test_scheduler_hogging_priority.c
rename to src/lib/util/test_scheduler_hogging_priority.c
diff --git a/src/util/test_service.c b/src/lib/util/test_service.c
similarity index 100%
rename from src/util/test_service.c
rename to src/lib/util/test_service.c
diff --git a/src/util/test_service_data.conf 
b/src/lib/util/test_service_data.conf
similarity index 100%
rename from src/util/test_service_data.conf
rename to src/lib/util/test_service_data.conf
diff --git a/src/util/test_socks.c b/src/lib/util/test_socks.c
similarity index 100%
rename from src/util/test_socks.c
rename to src/lib/util/test_socks.c
diff --git a/src/util/test_speedup.c b/src/lib/util/test_speedup.c
similarity index 100%
rename from src/util/test_speedup.c
rename to src/lib/util/test_speedup.c
diff --git a/src/util/test_speedup_data.conf 
b/src/lib/util/test_speedup_data.conf
similarity index 100%
rename from src/util/test_speedup_data.conf
rename to src/lib/util/test_speedup_data.conf
diff --git a/src/util/test_strings.c b/src/lib/util/test_strings.c
similarity index 100%
rename from src/util/test_strings.c
rename to src/lib/util/test_strings.c
diff --git a/src/util/test_strings_to_data.c 
b/src/lib/util/test_strings_to_data.c
similarity index 100%
rename from src/util/test_strings_to_data.c
rename to src/lib/util/test_strings_to_data.c
diff --git a/src/util/test_time.c b/src/lib/util/test_time.c
similarity index 100%
rename from src/util/test_time.c
rename to src/lib/util/test_time.c
diff --git a/src/util/test_tun.c b/src/lib/util/test_tun.c
similarity index 100%
rename from src/util/test_tun.c
rename to src/lib/util/test_tun.c
diff --git a/src/util/test_uri.c b/src/lib/util/test_uri.c
similarity index 100%
rename from src/util/test_uri.c
rename to src/lib/util/test_uri.c
diff --git a/src/util/time.c b/src/lib/util/time.c
similarity index 100%
rename from src/util/time.c
rename to src/lib/util/time.c
diff --git a/src/util/tun.c b/src/lib/util/tun.c
similarity index 100%
rename from src/util/tun.c
rename to src/lib/util/tun.c
diff --git a/src/util/uri.c b/src/lib/util/uri.c
similarity index 100%
rename from src/util/uri.c
rename to src/lib/util/uri.c
diff --git a/src/util/util.conf b/src/lib/util/util.conf
similarity index 100%
rename from src/util/util.conf
rename to src/lib/util/util.conf
diff --git a/src/util/util.supp b/src/lib/util/util.supp
similarity index 100%
rename from src/util/util.supp
rename to src/lib/util/util.supp
diff --git a/src/messenger/Makefile.am b/src/messenger/Makefile.am
index 656017548..1af950b01 100644
--- a/src/messenger/Makefile.am
+++ b/src/messenger/Makefile.am
@@ -17,7 +17,7 @@ plugin_LTLIBRARIES = \
 libgnunet_plugin_gnsrecord_messenger_la_SOURCES = \
   plugin_gnsrecord_messenger.c
 libgnunet_plugin_gnsrecord_messenger_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunet_plugin_gnsrecord_messenger_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -52,7 +52,7 @@ libgnunetmessenger_la_SOURCES = \
   messenger_api_handle.c messenger_api_handle.h \
   messenger_api_room.c messenger_api_room.h
 libgnunetmessenger_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/cadet/libgnunetcadet.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(XLIB) \
@@ -65,7 +65,7 @@ gnunet_messenger_SOURCES = \
  gnunet-messenger.c
 gnunet_messenger_LDADD = \
  libgnunetmessenger.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 gnunet_messenger_LDFLAGS = \
   $(GN_LIBINTL)
 
@@ -92,7 +92,7 @@ gnunet_service_messenger_SOURCES = \
   gnunet-service-messenger_tunnel.c gnunet-service-messenger_tunnel.h
 gnunet_service_messenger_LDADD = \
   libgnunetmessenger.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/cadet/libgnunetcadet.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(GN_LIBINTL)
@@ -110,14 +110,14 @@ test_messenger_api_SOURCES = \
 test_messenger_api_LDADD = \
   libgnunetmessenger.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_messenger_anonymous_SOURCES = \
   test_messenger_anonymous.c
 test_messenger_anonymous_LDADD = \
   libgnunetmessenger.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 EXTRA_DIST = \
   test_messenger_api.conf
diff --git a/src/messenger/gnunet-service-messenger.c 
b/src/messenger/gnunet-service-messenger.c
index f0bb853d7..fedaa2f60 100644
--- a/src/messenger/gnunet-service-messenger.c
+++ b/src/messenger/gnunet-service-messenger.c
@@ -213,14 +213,14 @@ check_send_message (void *cls,
 
   const uint16_t length = full_length - sizeof(*msg);
   const char *buffer = ((const char*) msg) + sizeof(*msg);
-  struct GNUNET_IDENTITY_PublicKey public_key;
+  struct GNUNET_CRYPTO_PublicKey public_key;
 
 
   size_t key_length = 0;
 
   if ((flags & GNUNET_MESSENGER_FLAG_PRIVATE))
     if (GNUNET_SYSERR ==
-        GNUNET_IDENTITY_read_public_key_from_buffer (buffer, length,
+        GNUNET_CRYPTO_read_public_key_from_buffer (buffer, length,
                                                      &public_key,
                                                      &key_length))
       return GNUNET_NO;
@@ -259,12 +259,12 @@ handle_send_message (void *cls,
   const uint16_t length = ntohs (msg->header.size) - sizeof(*msg);
   size_t key_length = 0;
 
-  struct GNUNET_IDENTITY_PublicKey public_key;
+  struct GNUNET_CRYPTO_PublicKey public_key;
 
   if (flags & GNUNET_MESSENGER_FLAG_PRIVATE)
   {
     GNUNET_assert (GNUNET_SYSERR !=
-                   GNUNET_IDENTITY_read_public_key_from_buffer (buffer,
+                   GNUNET_CRYPTO_read_public_key_from_buffer (buffer,
                                                                 length,
                                                                 &public_key,
                                                                 &key_length));
diff --git a/src/messenger/gnunet-service-messenger_ego_store.c 
b/src/messenger/gnunet-service-messenger_ego_store.c
index 3eb313b08..a1ffdddab 100644
--- a/src/messenger/gnunet-service-messenger_ego_store.c
+++ b/src/messenger/gnunet-service-messenger_ego_store.c
@@ -139,7 +139,7 @@ iterate_create_ego (void *cls,
 
 static void
 callback_ego_create (void *cls,
-                     const struct GNUNET_IDENTITY_PrivateKey *key,
+                     const struct GNUNET_CRYPTO_PrivateKey *key,
                      enum GNUNET_ErrorCode ec)
 {
   struct GNUNET_MESSENGER_EgoOperation *element = cls;
@@ -190,7 +190,7 @@ create_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
       store->identity,
       identifier,
       NULL,
-      GNUNET_IDENTITY_TYPE_ECDSA,
+      GNUNET_PUBLIC_KEY_TYPE_ECDSA,
       callback_ego_create,
       element
   );
@@ -310,7 +310,7 @@ lookup_store_ego(struct GNUNET_MESSENGER_EgoStore *store,
 struct GNUNET_MESSENGER_Ego*
 update_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
                   const char *identifier,
-                  const struct GNUNET_IDENTITY_PrivateKey *key)
+                  const struct GNUNET_CRYPTO_PrivateKey *key)
 {
   GNUNET_assert ((store) && (identifier) && (key));
 
@@ -329,7 +329,7 @@ update_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
 
   GNUNET_memcpy(&(ego->priv), key, sizeof(*key));
 
-  if (GNUNET_OK != GNUNET_IDENTITY_key_get_public (key, &(ego->pub)))
+  if (GNUNET_OK != GNUNET_CRYPTO_key_get_public (key, &(ego->pub)))
     GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Updating invalid ego key 
failed!\n");
 
   return ego;
diff --git a/src/messenger/gnunet-service-messenger_ego_store.h 
b/src/messenger/gnunet-service-messenger_ego_store.h
index a5f8a69d8..bf901bf5e 100644
--- a/src/messenger/gnunet-service-messenger_ego_store.h
+++ b/src/messenger/gnunet-service-messenger_ego_store.h
@@ -165,7 +165,7 @@ lookup_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
 struct GNUNET_MESSENGER_Ego*
 update_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
                   const char *identifier,
-                  const struct GNUNET_IDENTITY_PrivateKey *key);
+                  const struct GNUNET_CRYPTO_PrivateKey *key);
 
 /**
  * Deletes the registration of an EGO in a <i>store</i> under
diff --git a/src/messenger/gnunet-service-messenger_handle.c 
b/src/messenger/gnunet-service-messenger_handle.c
index 17692761d..764331c4a 100644
--- a/src/messenger/gnunet-service-messenger_handle.c
+++ b/src/messenger/gnunet-service-messenger_handle.c
@@ -217,7 +217,7 @@ change_handle_ego (struct GNUNET_MESSENGER_SrvHandle 
*handle,
 
   ego = get_srv_handle_ego (handle);
 
-  const uint16_t length = GNUNET_IDENTITY_public_key_get_length(&(ego->pub));
+  const uint16_t length = GNUNET_CRYPTO_public_key_get_length(&(ego->pub));
 
   struct GNUNET_MESSENGER_KeyMessage *msg;
   struct GNUNET_MQ_Envelope *env;
@@ -226,7 +226,7 @@ change_handle_ego (struct GNUNET_MESSENGER_SrvHandle 
*handle,
 
   char *extra = ((char*) msg) + sizeof(*msg);
 
-  if (GNUNET_IDENTITY_write_public_key_to_buffer(&(ego->pub), extra, length) < 
0)
+  if (GNUNET_CRYPTO_write_public_key_to_buffer(&(ego->pub), extra, length) < 0)
     GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Could not write key to buffer.\n");
 
   GNUNET_MQ_send (handle->mq, env);
@@ -540,7 +540,7 @@ notify_srv_handle_message (struct 
GNUNET_MESSENGER_SrvHandle *handle,
     return;
   }
 
-  const struct GNUNET_IDENTITY_PublicKey *pubkey = 
get_contact_key(session->contact);
+  const struct GNUNET_CRYPTO_PublicKey *pubkey = 
get_contact_key(session->contact);
 
   struct GNUNET_HashCode sender;
   GNUNET_CRYPTO_hash(pubkey, sizeof(*pubkey), &sender);
diff --git a/src/messenger/gnunet-service-messenger_member.c 
b/src/messenger/gnunet-service-messenger_member.c
index 444148831..96b26cfb9 100644
--- a/src/messenger/gnunet-service-messenger_member.c
+++ b/src/messenger/gnunet-service-messenger_member.c
@@ -274,7 +274,7 @@ sync_member_contacts (struct GNUNET_MESSENGER_Member 
*member)
 
 struct GNUNET_MESSENGER_MemberSession*
 get_member_session (const struct GNUNET_MESSENGER_Member *member,
-                    const struct GNUNET_IDENTITY_PublicKey *public_key)
+                    const struct GNUNET_CRYPTO_PublicKey *public_key)
 {
   GNUNET_assert ((member) && (public_key));
 
@@ -308,7 +308,7 @@ iterate_search_session (void *cls,
 
 static struct GNUNET_MESSENGER_MemberSession*
 try_member_session (struct GNUNET_MESSENGER_Member *member,
-                    const struct GNUNET_IDENTITY_PublicKey *public_key)
+                    const struct GNUNET_CRYPTO_PublicKey *public_key)
 {
   struct GNUNET_MESSENGER_MemberSession* session = get_member_session(member, 
public_key);
 
@@ -356,7 +356,7 @@ add_member_session (struct GNUNET_MESSENGER_Member *member,
 
   GNUNET_assert((member) && (session->member == member));
 
-  const struct GNUNET_IDENTITY_PublicKey *public_key = 
get_member_session_public_key(session);
+  const struct GNUNET_CRYPTO_PublicKey *public_key = 
get_member_session_public_key(session);
 
   struct GNUNET_HashCode hash;
   GNUNET_CRYPTO_hash(public_key, sizeof(*public_key), &hash);
@@ -374,7 +374,7 @@ remove_member_session (struct GNUNET_MESSENGER_Member 
*member,
 {
   GNUNET_assert ((member) && (session) && (session->member == member));
 
-  const struct GNUNET_IDENTITY_PublicKey *public_key = 
get_member_session_public_key(session);
+  const struct GNUNET_CRYPTO_PublicKey *public_key = 
get_member_session_public_key(session);
 
   struct GNUNET_HashCode hash;
   GNUNET_CRYPTO_hash(public_key, sizeof(*public_key), &hash);
diff --git a/src/messenger/gnunet-service-messenger_member.h 
b/src/messenger/gnunet-service-messenger_member.h
index 0c5870fd3..c06be1df7 100644
--- a/src/messenger/gnunet-service-messenger_member.h
+++ b/src/messenger/gnunet-service-messenger_member.h
@@ -125,7 +125,7 @@ sync_member_contacts (struct GNUNET_MESSENGER_Member 
*member);
  */
 struct GNUNET_MESSENGER_MemberSession*
 get_member_session (const struct GNUNET_MESSENGER_Member *member,
-                    const struct GNUNET_IDENTITY_PublicKey *public_key);
+                    const struct GNUNET_CRYPTO_PublicKey *public_key);
 
 /**
  * Returns the member session of a <i>member</i> using a public key which can 
verify
diff --git a/src/messenger/gnunet-service-messenger_member_session.c 
b/src/messenger/gnunet-service-messenger_member_session.c
index 519ac6f05..8ae1244c4 100644
--- a/src/messenger/gnunet-service-messenger_member_session.c
+++ b/src/messenger/gnunet-service-messenger_member_session.c
@@ -33,7 +33,7 @@
 
 struct GNUNET_MESSENGER_MemberSession*
 create_member_session (struct GNUNET_MESSENGER_Member *member,
-                       const struct GNUNET_IDENTITY_PublicKey *pubkey)
+                       const struct GNUNET_CRYPTO_PublicKey *pubkey)
 {
   if ((!member) || (!pubkey) || (!(member->store)))
     return NULL;
@@ -354,7 +354,7 @@ get_member_session_id (const struct 
GNUNET_MESSENGER_MemberSession* session)
   return get_member_id(session->member);
 }
 
-const struct GNUNET_IDENTITY_PublicKey*
+const struct GNUNET_CRYPTO_PublicKey*
 get_member_session_public_key (const struct GNUNET_MESSENGER_MemberSession* 
session)
 {
   GNUNET_assert(session);
@@ -536,9 +536,9 @@ load_member_session (struct GNUNET_MESSENGER_Member *member,
     if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string(cfg, "session", 
"key", &key_data))
       goto destroy_config;
 
-    struct GNUNET_IDENTITY_PublicKey key;
+    struct GNUNET_CRYPTO_PublicKey key;
 
-    enum GNUNET_GenericReturnValue key_return = 
GNUNET_IDENTITY_public_key_from_string(key_data, &key);
+    enum GNUNET_GenericReturnValue key_return = 
GNUNET_CRYPTO_public_key_from_string(key_data, &key);
 
     GNUNET_free(key_data);
 
@@ -625,9 +625,9 @@ load_member_session_next (struct 
GNUNET_MESSENGER_MemberSession *session,
     if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string(cfg, "session", 
"next_key", &key_data))
       goto destroy_config;
 
-    struct GNUNET_IDENTITY_PublicKey next_key;
+    struct GNUNET_CRYPTO_PublicKey next_key;
 
-    enum GNUNET_GenericReturnValue key_return = 
GNUNET_IDENTITY_public_key_from_string(key_data, &next_key);
+    enum GNUNET_GenericReturnValue key_return = 
GNUNET_CRYPTO_public_key_from_string(key_data, &next_key);
 
     GNUNET_free(key_data);
 
@@ -710,7 +710,7 @@ save_member_session (struct GNUNET_MESSENGER_MemberSession 
*session,
 
   struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create ();
 
-  char *key_data = 
GNUNET_IDENTITY_public_key_to_string(get_member_session_public_key(session));
+  char *key_data = 
GNUNET_CRYPTO_public_key_to_string(get_member_session_public_key(session));
 
   if (key_data)
   {
@@ -732,7 +732,7 @@ save_member_session (struct GNUNET_MESSENGER_MemberSession 
*session,
       GNUNET_free(next_id_data);
     }
 
-    key_data = 
GNUNET_IDENTITY_public_key_to_string(get_member_session_public_key(session->next));
+    key_data = 
GNUNET_CRYPTO_public_key_to_string(get_member_session_public_key(session->next));
 
     if (key_data)
     {
diff --git a/src/messenger/gnunet-service-messenger_member_session.h 
b/src/messenger/gnunet-service-messenger_member_session.h
index 9b4065d05..fad1ab041 100644
--- a/src/messenger/gnunet-service-messenger_member_session.h
+++ b/src/messenger/gnunet-service-messenger_member_session.h
@@ -38,7 +38,7 @@
 struct GNUNET_MESSENGER_MemberSession {
   struct GNUNET_MESSENGER_Member *member;
 
-  struct GNUNET_IDENTITY_PublicKey public_key;
+  struct GNUNET_CRYPTO_PublicKey public_key;
   struct GNUNET_HashCode context;
 
   struct GNUNET_MESSENGER_Contact *contact;
@@ -67,7 +67,7 @@ struct GNUNET_MESSENGER_MemberSession {
  */
 struct GNUNET_MESSENGER_MemberSession*
 create_member_session (struct GNUNET_MESSENGER_Member *member,
-                       const struct GNUNET_IDENTITY_PublicKey *pubkey);
+                       const struct GNUNET_CRYPTO_PublicKey *pubkey);
 
 /**
  * Creates and allocates a new member session closing and replacing a given
@@ -174,7 +174,7 @@ get_member_session_id (const struct 
GNUNET_MESSENGER_MemberSession* session);
  * @param[in] session Member session
  * @return Public key of EGO
  */
-const struct GNUNET_IDENTITY_PublicKey*
+const struct GNUNET_CRYPTO_PublicKey*
 get_member_session_public_key (const struct GNUNET_MESSENGER_MemberSession* 
session);
 
 /**
diff --git a/src/messenger/gnunet-service-messenger_member_store.h 
b/src/messenger/gnunet-service-messenger_member_store.h
index 05b00f39a..337ddcf78 100644
--- a/src/messenger/gnunet-service-messenger_member_store.h
+++ b/src/messenger/gnunet-service-messenger_member_store.h
@@ -45,7 +45,7 @@ struct GNUNET_MESSENGER_MemberStore
 
 typedef int (*GNUNET_MESSENGER_MemberIteratorCallback) (
     void *cls,
-    const struct GNUNET_IDENTITY_PublicKey *public_key,
+    const struct GNUNET_CRYPTO_PublicKey *public_key,
     struct GNUNET_MESSENGER_MemberSession *session);
 
 /**
diff --git a/src/messenger/gnunet-service-messenger_message_kind.c 
b/src/messenger/gnunet-service-messenger_message_kind.c
index 828e84d4f..d2923a5e3 100644
--- a/src/messenger/gnunet-service-messenger_message_kind.c
+++ b/src/messenger/gnunet-service-messenger_message_kind.c
@@ -84,7 +84,7 @@ create_message_name (const char *name)
 }
 
 struct GNUNET_MESSENGER_Message*
-create_message_key (const struct GNUNET_IDENTITY_PrivateKey *key)
+create_message_key (const struct GNUNET_CRYPTO_PrivateKey *key)
 {
   if (!key)
     return NULL;
@@ -94,7 +94,7 @@ create_message_key (const struct GNUNET_IDENTITY_PrivateKey 
*key)
   if (!message)
     return NULL;
 
-  GNUNET_IDENTITY_key_get_public (key, &(message->body.key.key));
+  GNUNET_CRYPTO_key_get_public (key, &(message->body.key.key));
   return message;
 }
 
diff --git a/src/messenger/gnunet-service-messenger_message_kind.h 
b/src/messenger/gnunet-service-messenger_message_kind.h
index 102a70e33..d50317844 100644
--- a/src/messenger/gnunet-service-messenger_message_kind.h
+++ b/src/messenger/gnunet-service-messenger_message_kind.h
@@ -82,7 +82,7 @@ create_message_name (const char *name);
  * @return New message
  */
 struct GNUNET_MESSENGER_Message*
-create_message_key (const struct GNUNET_IDENTITY_PrivateKey *key);
+create_message_key (const struct GNUNET_CRYPTO_PrivateKey *key);
 
 /**
  * Creates and allocates a new peer message containing a services peer 
identity.
diff --git a/src/messenger/gnunet-service-messenger_message_recv.c 
b/src/messenger/gnunet-service-messenger_message_recv.c
index 94202fdca..ea309f893 100644
--- a/src/messenger/gnunet-service-messenger_message_recv.c
+++ b/src/messenger/gnunet-service-messenger_message_recv.c
@@ -58,7 +58,7 @@ forward_about_members (struct GNUNET_MESSENGER_SrvRoom *room,
 
 static int
 iterate_forward_members (void *cls,
-                         const struct GNUNET_IDENTITY_PublicKey *public_key,
+                         const struct GNUNET_CRYPTO_PublicKey *public_key,
                          struct GNUNET_MESSENGER_MemberSession *session)
 {
   struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls;
diff --git a/src/messenger/gnunet-service-messenger_room.c 
b/src/messenger/gnunet-service-messenger_room.c
index 4b734cb40..f2f841c20 100644
--- a/src/messenger/gnunet-service-messenger_room.c
+++ b/src/messenger/gnunet-service-messenger_room.c
@@ -276,7 +276,7 @@ notify_about_members (struct GNUNET_MESSENGER_MemberNotify 
*notify,
 
 static int
 iterate_notify_about_members (void *cls,
-                              const struct GNUNET_IDENTITY_PublicKey 
*public_key,
+                              const struct GNUNET_CRYPTO_PublicKey *public_key,
                               struct GNUNET_MESSENGER_MemberSession *session)
 {
   struct GNUNET_MESSENGER_MemberNotify *notify = cls;
@@ -872,7 +872,7 @@ idle_request_room_messages (void *cls)
 
 void
 solve_srv_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room,
-                                  const struct GNUNET_IDENTITY_PublicKey 
*public_key,
+                                  const struct GNUNET_CRYPTO_PublicKey 
*public_key,
                                   const struct GNUNET_ShortHashCode *member_id,
                                   struct GNUNET_TIME_Absolute timestamp)
 {
@@ -1057,7 +1057,7 @@ struct GNUNET_MESSENGER_MemberUpdate
 
 static int
 iterate_update_member_sessions (void *cls,
-                                const struct GNUNET_IDENTITY_PublicKey 
*public_key,
+                                const struct GNUNET_CRYPTO_PublicKey 
*public_key,
                                 struct GNUNET_MESSENGER_MemberSession *session)
 {
   struct GNUNET_MESSENGER_MemberUpdate *update = cls;
@@ -1248,7 +1248,7 @@ remove_room_member_session (struct 
GNUNET_MESSENGER_SrvRoom *room,
 
   remove_member_session (session->member, session);
 
-  const struct GNUNET_IDENTITY_PublicKey *public_key = 
get_member_session_public_key(session);
+  const struct GNUNET_CRYPTO_PublicKey *public_key = 
get_member_session_public_key(session);
 
   struct GNUNET_HashCode hash;
   GNUNET_CRYPTO_hash(public_key, sizeof(*public_key), &hash);
diff --git a/src/messenger/gnunet-service-messenger_room.h 
b/src/messenger/gnunet-service-messenger_room.h
index 2e9382595..fb2a88aea 100644
--- a/src/messenger/gnunet-service-messenger_room.h
+++ b/src/messenger/gnunet-service-messenger_room.h
@@ -336,7 +336,7 @@ request_srv_room_message (struct GNUNET_MESSENGER_SrvRoom 
*room,
  */
 void
 solve_srv_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room,
-                                  const struct GNUNET_IDENTITY_PublicKey 
*public_key,
+                                  const struct GNUNET_CRYPTO_PublicKey 
*public_key,
                                   const struct GNUNET_ShortHashCode *member_id,
                                   struct GNUNET_TIME_Absolute timestamp);
 
diff --git a/src/messenger/messenger_api.c b/src/messenger/messenger_api.c
index 610c979c4..3604d0569 100644
--- a/src/messenger/messenger_api.c
+++ b/src/messenger/messenger_api.c
@@ -105,10 +105,10 @@ check_get_key (void *cls,
   const uint16_t length = full_length - sizeof(*msg);
   const char *buffer = ((const char*) msg) + sizeof(*msg);
 
-  struct GNUNET_IDENTITY_PublicKey pubkey;
+  struct GNUNET_CRYPTO_PublicKey pubkey;
   size_t read;
   if (GNUNET_SYSERR ==
-      GNUNET_IDENTITY_read_public_key_from_buffer(buffer, length,
+      GNUNET_CRYPTO_read_public_key_from_buffer(buffer, length,
                                                   &pubkey, &read))
     return GNUNET_NO;
 
@@ -124,14 +124,14 @@ handle_get_key (void *cls,
   const uint16_t length = ntohs (msg->header.size) - sizeof(*msg);
   const char *buffer = ((const char*) msg) + sizeof(*msg);
 
-  struct GNUNET_IDENTITY_PublicKey pubkey;
+  struct GNUNET_CRYPTO_PublicKey pubkey;
   size_t read;
   if (GNUNET_SYSERR ==
-      GNUNET_IDENTITY_read_public_key_from_buffer(buffer, length,
+      GNUNET_CRYPTO_read_public_key_from_buffer(buffer, length,
                                                   &pubkey, &read))
     return;
 
-  char* str = GNUNET_IDENTITY_public_key_to_string (&pubkey);
+  char* str = GNUNET_CRYPTO_public_key_to_string (&pubkey);
   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Set key of handle: %s\n", str);
   GNUNET_free(str);
 
@@ -534,8 +534,8 @@ GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle 
*handle,
   return GNUNET_YES;
 }
 
-static const struct GNUNET_IDENTITY_PublicKey*
-get_non_anonymous_key (const struct GNUNET_IDENTITY_PublicKey* public_key)
+static const struct GNUNET_CRYPTO_PublicKey*
+get_non_anonymous_key (const struct GNUNET_CRYPTO_PublicKey* public_key)
 {
   if (0 == GNUNET_memcmp(public_key, get_anonymous_public_key()))
     return NULL;
@@ -543,7 +543,7 @@ get_non_anonymous_key (const struct 
GNUNET_IDENTITY_PublicKey* public_key)
   return public_key;
 }
 
-const struct GNUNET_IDENTITY_PublicKey*
+const struct GNUNET_CRYPTO_PublicKey*
 GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle)
 {
   if (!handle)
@@ -688,7 +688,7 @@ GNUNET_MESSENGER_contact_get_name (const struct 
GNUNET_MESSENGER_Contact *contac
   return get_contact_name (contact);
 }
 
-const struct GNUNET_IDENTITY_PublicKey*
+const struct GNUNET_CRYPTO_PublicKey*
 GNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact 
*contact)
 {
   if (!contact)
@@ -721,12 +721,12 @@ GNUNET_MESSENGER_send_message (struct 
GNUNET_MESSENGER_Room *room,
 
   if (contact)
   {
-    const struct GNUNET_IDENTITY_PublicKey *public_key = get_non_anonymous_key 
(
+    const struct GNUNET_CRYPTO_PublicKey *public_key = get_non_anonymous_key (
         get_contact_key(contact)
     );
 
     if (public_key)
-      key_length = GNUNET_IDENTITY_public_key_get_length(public_key);
+      key_length = GNUNET_CRYPTO_public_key_get_length(public_key);
     else
       key_length = -1;
   }
@@ -759,7 +759,7 @@ GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room 
*room,
   char *msg_buffer = buffer + key_length;
 
   if (key_length > 0)
-    GNUNET_IDENTITY_write_public_key_to_buffer(get_contact_key(contact), 
buffer, key_length);
+    GNUNET_CRYPTO_write_public_key_to_buffer(get_contact_key(contact), buffer, 
key_length);
 
   encode_message (message, msg_length, msg_buffer, GNUNET_NO);
 
diff --git a/src/messenger/messenger_api_contact.c 
b/src/messenger/messenger_api_contact.c
index a284c3b08..a11190c2c 100644
--- a/src/messenger/messenger_api_contact.c
+++ b/src/messenger/messenger_api_contact.c
@@ -27,7 +27,7 @@
 #include "messenger_api_contact.h"
 
 struct GNUNET_MESSENGER_Contact*
-create_contact (const struct GNUNET_IDENTITY_PublicKey *key)
+create_contact (const struct GNUNET_CRYPTO_PublicKey *key)
 {
   GNUNET_assert(key);
 
@@ -72,7 +72,7 @@ set_contact_name (struct GNUNET_MESSENGER_Contact *contact,
   contact->name = name ? GNUNET_strdup(name) : NULL;
 }
 
-const struct GNUNET_IDENTITY_PublicKey*
+const struct GNUNET_CRYPTO_PublicKey*
 get_contact_key (const struct GNUNET_MESSENGER_Contact *contact)
 {
   GNUNET_assert(contact);
diff --git a/src/messenger/messenger_api_contact.h 
b/src/messenger/messenger_api_contact.h
index e2919bcc3..4463aa746 100644
--- a/src/messenger/messenger_api_contact.h
+++ b/src/messenger/messenger_api_contact.h
@@ -35,7 +35,7 @@ struct GNUNET_MESSENGER_Contact
   char *name;
   size_t rc;
 
-  struct GNUNET_IDENTITY_PublicKey public_key;
+  struct GNUNET_CRYPTO_PublicKey public_key;
 };
 
 /**
@@ -45,7 +45,7 @@ struct GNUNET_MESSENGER_Contact
  * @return New contact
  */
 struct GNUNET_MESSENGER_Contact*
-create_contact (const struct GNUNET_IDENTITY_PublicKey *key);
+create_contact (const struct GNUNET_CRYPTO_PublicKey *key);
 
 /**
  * Destroys a contact and frees its memory fully.
@@ -80,7 +80,7 @@ set_contact_name (struct GNUNET_MESSENGER_Contact *contact,
  * @param[in] contact Contact
  * @return Public key of the contact
  */
-const struct GNUNET_IDENTITY_PublicKey*
+const struct GNUNET_CRYPTO_PublicKey*
 get_contact_key (const struct GNUNET_MESSENGER_Contact *contact);
 
 /**
diff --git a/src/messenger/messenger_api_contact_store.c 
b/src/messenger/messenger_api_contact_store.c
index d42155e20..b0e0d026b 100644
--- a/src/messenger/messenger_api_contact_store.c
+++ b/src/messenger/messenger_api_contact_store.c
@@ -65,7 +65,7 @@ select_store_contact_map (struct 
GNUNET_MESSENGER_ContactStore *store,
                           const struct GNUNET_HashCode *context,
                           struct GNUNET_HashCode *hash)
 {
-  const struct GNUNET_IDENTITY_PublicKey *anonymous = get_anonymous_public_key 
();
+  const struct GNUNET_CRYPTO_PublicKey *anonymous = get_anonymous_public_key 
();
 
   struct GNUNET_HashCode anonHash;
   GNUNET_CRYPTO_hash (anonymous, sizeof(*anonymous), &anonHash);
@@ -99,7 +99,7 @@ get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore 
*store,
 struct GNUNET_MESSENGER_Contact*
 get_store_contact (struct GNUNET_MESSENGER_ContactStore *store,
                    const struct GNUNET_HashCode *context,
-                   const struct GNUNET_IDENTITY_PublicKey *pubkey)
+                   const struct GNUNET_CRYPTO_PublicKey *pubkey)
 {
   GNUNET_assert ((store) && (store->contacts) && (context) && (pubkey));
 
@@ -116,7 +116,7 @@ get_store_contact (struct GNUNET_MESSENGER_ContactStore 
*store,
   {
     if (0 != GNUNET_memcmp(pubkey, get_contact_key(contact)))
     {
-      char* str = GNUNET_IDENTITY_public_key_to_string 
(get_contact_key(contact));
+      char* str = GNUNET_CRYPTO_public_key_to_string 
(get_contact_key(contact));
       GNUNET_log (GNUNET_ERROR_TYPE_INVALID, "Contact in store uses wrong key: 
%s\n", str);
       GNUNET_free (str);
       return NULL;
@@ -140,11 +140,11 @@ update_store_contact (struct 
GNUNET_MESSENGER_ContactStore *store,
                       struct GNUNET_MESSENGER_Contact* contact,
                       const struct GNUNET_HashCode *context,
                       const struct GNUNET_HashCode *next_context,
-                      const struct GNUNET_IDENTITY_PublicKey *pubkey)
+                      const struct GNUNET_CRYPTO_PublicKey *pubkey)
 {
   GNUNET_assert ((store) && (store->contacts) && (contact) && (pubkey));
 
-  const struct GNUNET_IDENTITY_PublicKey* oldkey = get_contact_key (contact);
+  const struct GNUNET_CRYPTO_PublicKey* oldkey = get_contact_key (contact);
 
   struct GNUNET_HashCode hash;
   GNUNET_CRYPTO_hash (oldkey, sizeof(*oldkey), &hash);
@@ -177,7 +177,7 @@ remove_store_contact (struct GNUNET_MESSENGER_ContactStore 
*store,
 {
   GNUNET_assert ((store) && (store->contacts) && (contact));
 
-  const struct GNUNET_IDENTITY_PublicKey* pubkey = get_contact_key(contact);
+  const struct GNUNET_CRYPTO_PublicKey* pubkey = get_contact_key(contact);
 
   struct GNUNET_HashCode hash;
   GNUNET_CRYPTO_hash (pubkey, sizeof(*pubkey), &hash);
diff --git a/src/messenger/messenger_api_contact_store.h 
b/src/messenger/messenger_api_contact_store.h
index c74a67740..e012e42c1 100644
--- a/src/messenger/messenger_api_contact_store.h
+++ b/src/messenger/messenger_api_contact_store.h
@@ -89,7 +89,7 @@ get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore 
*store,
 struct GNUNET_MESSENGER_Contact*
 get_store_contact (struct GNUNET_MESSENGER_ContactStore *store,
                    const struct GNUNET_HashCode *context,
-                   const struct GNUNET_IDENTITY_PublicKey *pubkey);
+                   const struct GNUNET_CRYPTO_PublicKey *pubkey);
 
 /**
  * Moves a <i>contact</i> from the <i>store</i> to another location
@@ -108,7 +108,7 @@ update_store_contact (struct GNUNET_MESSENGER_ContactStore 
*store,
                       struct GNUNET_MESSENGER_Contact* contact,
                       const struct GNUNET_HashCode *context,
                       const struct GNUNET_HashCode *next_context,
-                      const struct GNUNET_IDENTITY_PublicKey *pubkey);
+                      const struct GNUNET_CRYPTO_PublicKey *pubkey);
 
 /**
  * Removes a <i>contact</i> from the <i>store</i> which uses
diff --git a/src/messenger/messenger_api_ego.h 
b/src/messenger/messenger_api_ego.h
index b52b895f2..1d84c524f 100644
--- a/src/messenger/messenger_api_ego.h
+++ b/src/messenger/messenger_api_ego.h
@@ -31,8 +31,8 @@
 
 struct GNUNET_MESSENGER_Ego
 {
-  struct GNUNET_IDENTITY_PrivateKey priv;
-  struct GNUNET_IDENTITY_PublicKey pub;
+  struct GNUNET_CRYPTO_PrivateKey priv;
+  struct GNUNET_CRYPTO_PublicKey pub;
 };
 
 #endif //GNUNET_MESSENGER_API_EGO_H
diff --git a/src/messenger/messenger_api_handle.c 
b/src/messenger/messenger_api_handle.c
index ec8d3dc7a..fddf73ad5 100644
--- a/src/messenger/messenger_api_handle.c
+++ b/src/messenger/messenger_api_handle.c
@@ -124,17 +124,17 @@ get_handle_name (const struct GNUNET_MESSENGER_Handle 
*handle)
 
 void
 set_handle_key (struct GNUNET_MESSENGER_Handle *handle,
-                const struct GNUNET_IDENTITY_PublicKey *pubkey)
+                const struct GNUNET_CRYPTO_PublicKey *pubkey)
 {
   GNUNET_assert(handle);
 
   if (!handle->pubkey)
-    handle->pubkey = GNUNET_new(struct GNUNET_IDENTITY_PublicKey);
+    handle->pubkey = GNUNET_new(struct GNUNET_CRYPTO_PublicKey);
 
   GNUNET_memcpy(handle->pubkey, pubkey, sizeof(*pubkey));
 }
 
-const struct GNUNET_IDENTITY_PublicKey*
+const struct GNUNET_CRYPTO_PublicKey*
 get_handle_key (const struct GNUNET_MESSENGER_Handle *handle)
 {
   GNUNET_assert(handle);
diff --git a/src/messenger/messenger_api_handle.h 
b/src/messenger/messenger_api_handle.h
index d246855ff..09f44be8a 100644
--- a/src/messenger/messenger_api_handle.h
+++ b/src/messenger/messenger_api_handle.h
@@ -49,7 +49,7 @@ struct GNUNET_MESSENGER_Handle
   void *msg_cls;
 
   char *name;
-  struct GNUNET_IDENTITY_PublicKey *pubkey;
+  struct GNUNET_CRYPTO_PublicKey *pubkey;
 
   struct GNUNET_TIME_Relative reconnect_time;
   struct GNUNET_SCHEDULER_Task *reconnect_task;
@@ -110,7 +110,7 @@ get_handle_name (const struct GNUNET_MESSENGER_Handle 
*handle);
  */
 void
 set_handle_key (struct GNUNET_MESSENGER_Handle *handle,
-                const struct GNUNET_IDENTITY_PublicKey *pubkey);
+                const struct GNUNET_CRYPTO_PublicKey *pubkey);
 
 /**
  * Returns the public key of a given <i>handle</i>.
@@ -118,7 +118,7 @@ set_handle_key (struct GNUNET_MESSENGER_Handle *handle,
  * @param[in] handle Handle
  * @return Public key of the handle
  */
-const struct GNUNET_IDENTITY_PublicKey*
+const struct GNUNET_CRYPTO_PublicKey*
 get_handle_key (const struct GNUNET_MESSENGER_Handle *handle);
 
 /**
diff --git a/src/messenger/messenger_api_message.c 
b/src/messenger/messenger_api_message.c
index 31d0c94b8..1f7e8dbf2 100644
--- a/src/messenger/messenger_api_message.c
+++ b/src/messenger/messenger_api_message.c
@@ -276,16 +276,16 @@ get_message_body_size (enum GNUNET_MESSENGER_MessageKind 
kind,
   switch (kind)
   {
   case GNUNET_MESSENGER_KIND_INFO:
-    length += GNUNET_IDENTITY_public_key_get_length (&(body->info.host_key));
+    length += GNUNET_CRYPTO_public_key_get_length (&(body->info.host_key));
     break;
   case GNUNET_MESSENGER_KIND_JOIN:
-    length += GNUNET_IDENTITY_public_key_get_length (&(body->join.key));
+    length += GNUNET_CRYPTO_public_key_get_length (&(body->join.key));
     break;
   case GNUNET_MESSENGER_KIND_NAME:
     length += (body->name.name ? strlen (body->name.name) : 0);
     break;
   case GNUNET_MESSENGER_KIND_KEY:
-    length += GNUNET_IDENTITY_public_key_get_length (&(body->key.key));
+    length += GNUNET_CRYPTO_public_key_get_length (&(body->key.key));
     break;
   case GNUNET_MESSENGER_KIND_TEXT:
     length += strlen (body->text.text);
@@ -313,7 +313,7 @@ get_message_size (const struct GNUNET_MESSENGER_Message 
*message,
   uint16_t length = 0;
 
   if (GNUNET_YES == include_header)
-    length += GNUNET_IDENTITY_signature_get_length (
+    length += GNUNET_CRYPTO_signature_get_length (
       &(message->header.signature));
 
   length += get_message_kind_size (message->header.kind, include_header);
@@ -399,7 +399,7 @@ calc_padded_length (uint16_t length)
 } while (0)
 
 #define encode_step_key(dst, offset, src, length) do {  \
-    ssize_t result = GNUNET_IDENTITY_write_public_key_to_buffer ( \
+    ssize_t result = GNUNET_CRYPTO_write_public_key_to_buffer ( \
       src, dst + offset, length - offset                \
       );                                                    \
     if (result < 0)                                       \
@@ -409,7 +409,7 @@ calc_padded_length (uint16_t length)
 } while (0)
 
 #define encode_step_signature(dst, offset, src, length) do {  \
-    ssize_t result = GNUNET_IDENTITY_write_signature_to_buffer ( \
+    ssize_t result = GNUNET_CRYPTO_write_signature_to_buffer ( \
       src, dst + offset, length - offset                      \
       );                                                          \
     if (result < 0)                                             \
@@ -581,7 +581,7 @@ encode_short_message (const struct 
GNUNET_MESSENGER_ShortMessage *message,
 #define decode_step_key(src, offset, dst, length) do {   \
     enum GNUNET_GenericReturnValue result;                 \
     size_t read;                                           \
-    result = GNUNET_IDENTITY_read_public_key_from_buffer (  \
+    result = GNUNET_CRYPTO_read_public_key_from_buffer (  \
       src + offset, length - offset, dst, &read            \
       );                                                     \
     if (GNUNET_SYSERR == result)                                        \
@@ -695,7 +695,7 @@ decode_message (struct GNUNET_MESSENGER_Message *message,
 
   if (GNUNET_YES == include_header)
   {
-    ssize_t result = GNUNET_IDENTITY_read_signature_from_buffer (
+    ssize_t result = GNUNET_CRYPTO_read_signature_from_buffer (
       &(message->header.signature), buffer, length - offset
       );
 
@@ -788,7 +788,7 @@ hash_message (const struct GNUNET_MESSENGER_Message 
*message,
 {
   GNUNET_assert ((message) && (buffer) && (hash));
 
-  const ssize_t offset = GNUNET_IDENTITY_signature_get_length (
+  const ssize_t offset = GNUNET_CRYPTO_signature_get_length (
     &(message->header.signature)
     );
 
@@ -811,7 +811,7 @@ sign_message (struct GNUNET_MESSENGER_Message *message,
   signature.purpose.size = htonl (sizeof(signature));
 
   GNUNET_memcpy (&(signature.hash), hash, sizeof(struct GNUNET_HashCode));
-  GNUNET_IDENTITY_sign (&(ego->priv), &signature, 
&(message->header.signature));
+  GNUNET_CRYPTO_sign (&(ego->priv), &signature, &(message->header.signature));
 
   uint16_t offset = 0;
   encode_step_signature (buffer, offset, &(message->header.signature), length);
@@ -821,7 +821,7 @@ sign_message (struct GNUNET_MESSENGER_Message *message,
 int
 verify_message (const struct GNUNET_MESSENGER_Message *message,
                 const struct GNUNET_HashCode *hash,
-                const struct GNUNET_IDENTITY_PublicKey *key)
+                const struct GNUNET_CRYPTO_PublicKey *key)
 {
   GNUNET_assert ((message) && (hash) && (key));
 
@@ -835,7 +835,7 @@ verify_message (const struct GNUNET_MESSENGER_Message 
*message,
 
   GNUNET_memcpy (&(signature.hash), hash, sizeof(struct GNUNET_HashCode));
 
-  return GNUNET_IDENTITY_signature_verify (
+  return GNUNET_CRYPTO_signature_verify (
     GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE, &signature,
     &(message->header.signature), key);
 }
@@ -843,7 +843,7 @@ verify_message (const struct GNUNET_MESSENGER_Message 
*message,
 
 int
 encrypt_message (struct GNUNET_MESSENGER_Message *message,
-                 const struct GNUNET_IDENTITY_PublicKey *key)
+                 const struct GNUNET_CRYPTO_PublicKey *key)
 {
   GNUNET_assert ((message) && (key));
 
@@ -853,7 +853,7 @@ encrypt_message (struct GNUNET_MESSENGER_Message *message,
 
   const uint16_t length = get_short_message_size (&shortened, GNUNET_YES);
   const uint16_t padded_length = calc_padded_length (
-    length + GNUNET_IDENTITY_ENCRYPT_OVERHEAD_BYTES
+    length + GNUNET_CRYPTO_ENCRYPT_OVERHEAD_BYTES
     );
 
   message->header.kind = GNUNET_MESSENGER_KIND_PRIVATE;
@@ -861,12 +861,12 @@ encrypt_message (struct GNUNET_MESSENGER_Message *message,
   message->body.privacy.length = padded_length;
 
   const uint16_t encoded_length = (
-    padded_length - GNUNET_IDENTITY_ENCRYPT_OVERHEAD_BYTES
+    padded_length - GNUNET_CRYPTO_ENCRYPT_OVERHEAD_BYTES
     );
 
   encode_short_message (&shortened, encoded_length, 
message->body.privacy.data);
 
-  if (GNUNET_OK != GNUNET_IDENTITY_encrypt (message->body.privacy.data,
+  if (GNUNET_OK != GNUNET_CRYPTO_encrypt (message->body.privacy.data,
                                             encoded_length,
                                             key,
                                             message->body.privacy.data,
@@ -885,13 +885,13 @@ encrypt_message (struct GNUNET_MESSENGER_Message *message,
 
 int
 decrypt_message (struct GNUNET_MESSENGER_Message *message,
-                 const struct GNUNET_IDENTITY_PrivateKey *key)
+                 const struct GNUNET_CRYPTO_PrivateKey *key)
 {
   GNUNET_assert ((message) && (key));
 
   const uint16_t padded_length = message->body.privacy.length;
 
-  if (padded_length < GNUNET_IDENTITY_ENCRYPT_OVERHEAD_BYTES)
+  if (padded_length < GNUNET_CRYPTO_ENCRYPT_OVERHEAD_BYTES)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 "Message length too short to decrypt!\n");
@@ -900,10 +900,10 @@ decrypt_message (struct GNUNET_MESSENGER_Message *message,
   }
 
   const uint16_t encoded_length = (
-    padded_length - GNUNET_IDENTITY_ENCRYPT_OVERHEAD_BYTES
+    padded_length - GNUNET_CRYPTO_ENCRYPT_OVERHEAD_BYTES
     );
 
-  if (GNUNET_OK != GNUNET_IDENTITY_decrypt (message->body.privacy.data,
+  if (GNUNET_OK != GNUNET_CRYPTO_decrypt (message->body.privacy.data,
                                             padded_length,
                                             key,
                                             message->body.privacy.data,
diff --git a/src/messenger/messenger_api_message.h 
b/src/messenger/messenger_api_message.h
index 688c72994..0c2d4acf2 100644
--- a/src/messenger/messenger_api_message.h
+++ b/src/messenger/messenger_api_message.h
@@ -188,7 +188,7 @@ sign_message (struct GNUNET_MESSENGER_Message *message,
 int
 verify_message (const struct GNUNET_MESSENGER_Message *message,
                 const struct GNUNET_HashCode *hash,
-                const struct GNUNET_IDENTITY_PublicKey *key);
+                const struct GNUNET_CRYPTO_PublicKey *key);
 
 /**
  * Encrypts a <i>message</i> using a given public <i>key</i> and replaces its 
body
@@ -201,7 +201,7 @@ verify_message (const struct GNUNET_MESSENGER_Message 
*message,
  */
 int
 encrypt_message (struct GNUNET_MESSENGER_Message *message,
-                 const struct GNUNET_IDENTITY_PublicKey *key);
+                 const struct GNUNET_CRYPTO_PublicKey *key);
 
 /**
  * Decrypts a private <i>message</i> using a given private <i>key</i> and 
replaces its body
@@ -214,7 +214,7 @@ encrypt_message (struct GNUNET_MESSENGER_Message *message,
  */
 int
 decrypt_message (struct GNUNET_MESSENGER_Message *message,
-                 const struct GNUNET_IDENTITY_PrivateKey *key);
+                 const struct GNUNET_CRYPTO_PrivateKey *key);
 
 #define GNUNET_MESSENGER_PACK_MODE_ENVELOPE 0x1
 #define GNUNET_MESSENGER_PACK_MODE_UNKNOWN 0x0
diff --git a/src/messenger/messenger_api_util.c 
b/src/messenger/messenger_api_util.c
index f56e2e201..9d23e2262 100644
--- a/src/messenger/messenger_api_util.c
+++ b/src/messenger/messenger_api_util.c
@@ -70,10 +70,10 @@ generate_free_member_id (struct GNUNET_ShortHashCode *id,
   return GNUNET_NO;
 }
 
-const struct GNUNET_IDENTITY_PublicKey*
+const struct GNUNET_CRYPTO_PublicKey*
 get_anonymous_public_key ()
 {
-  static struct GNUNET_IDENTITY_PublicKey public_key;
+  static struct GNUNET_CRYPTO_PublicKey public_key;
   static struct GNUNET_IDENTITY_Ego* ego = NULL;
 
   if (!ego)
diff --git a/src/messenger/messenger_api_util.h 
b/src/messenger/messenger_api_util.h
index 3d68505a8..bad001da3 100644
--- a/src/messenger/messenger_api_util.h
+++ b/src/messenger/messenger_api_util.h
@@ -58,7 +58,7 @@ generate_free_member_id (struct GNUNET_ShortHashCode *id,
  *
  * @return anonymous public key
  */
-const struct GNUNET_IDENTITY_PublicKey*
+const struct GNUNET_CRYPTO_PublicKey*
 get_anonymous_public_key ();
 
 /**
diff --git a/src/messenger/test_messenger.c b/src/messenger/test_messenger.c
index 8758ce562..660e6473c 100644
--- a/src/messenger/test_messenger.c
+++ b/src/messenger/test_messenger.c
@@ -117,7 +117,7 @@ on_identity (void *cls,
     return;
   }
 
-  const struct GNUNET_IDENTITY_PublicKey *key = GNUNET_MESSENGER_get_key 
(handle);
+  const struct GNUNET_CRYPTO_PublicKey *key = GNUNET_MESSENGER_get_key 
(handle);
 
   if (((!identity_counter) && (key)) || ((identity_counter) && (!key)))
   {
diff --git a/src/messenger/test_messenger_anonymous.c 
b/src/messenger/test_messenger_anonymous.c
index 13f2b6f0e..367d1c3b7 100644
--- a/src/messenger/test_messenger_anonymous.c
+++ b/src/messenger/test_messenger_anonymous.c
@@ -119,7 +119,7 @@ on_identity (void *cls,
     return;
   }
 
-  const struct GNUNET_IDENTITY_PublicKey *key = GNUNET_MESSENGER_get_key 
(handle);
+  const struct GNUNET_CRYPTO_PublicKey *key = GNUNET_MESSENGER_get_key 
(handle);
 
   if (key)
   {
diff --git a/src/namecache/Makefile.am b/src/namecache/Makefile.am
index f283d3f64..9ece350de 100644
--- a/src/namecache/Makefile.am
+++ b/src/namecache/Makefile.am
@@ -63,9 +63,9 @@ libgnunetnamecache_la_SOURCES = \
   namecache_api.c \
   namecache.h
 libgnunetnamecache_la_LIBADD = \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 libgnunetnamecache_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)  \
@@ -81,9 +81,9 @@ bin_PROGRAMS = \
 gnunet_namecache_SOURCES = \
  gnunet-namecache.c
 gnunet_namecache_LDADD = \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   libgnunetnamecache.la \
   $(GN_LIBINTL)
 
@@ -91,10 +91,10 @@ gnunet_service_namecache_SOURCES = \
  gnunet-service-namecache.c
 
 gnunet_service_namecache_LDADD = \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   libgnunetnamecache.la \
   $(GN_LIBINTL)
 
@@ -109,9 +109,9 @@ libgnunet_plugin_namecache_flat_la_SOURCES = \
 libgnunet_plugin_namecache_flat_la_LIBADD = \
   libgnunetnamecache.la  \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \
   $(LTLIBINTL)
 libgnunet_plugin_namecache_flat_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -122,9 +122,9 @@ libgnunet_plugin_namecache_sqlite_la_LIBADD = \
   libgnunetnamecache.la  \
   $(top_builddir)/src/sq/libgnunetsq.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3 \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lsqlite3 \
   $(LTLIBINTL)
 libgnunet_plugin_namecache_sqlite_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -136,9 +136,9 @@ libgnunet_plugin_namecache_postgres_la_LIBADD = \
   libgnunetnamecache.la  \
   $(top_builddir)/src/pq/libgnunetpq.la  \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lpq \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lpq \
   $(LTLIBINTL)
 libgnunet_plugin_namecache_postgres_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS) $(POSTGRESQL_LDFLAGS)
@@ -146,30 +146,30 @@ libgnunet_plugin_namecache_postgres_la_LDFLAGS = \
 test_namecache_api_cache_block_SOURCES = \
  test_namecache_api_cache_block.c
 test_namecache_api_cache_block_LDADD = \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   libgnunetnamecache.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 
 test_plugin_namecache_flat_SOURCES = \
  test_plugin_namecache.c
 test_plugin_namecache_flat_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_plugin_namecache_sqlite_SOURCES = \
  test_plugin_namecache.c
 test_plugin_namecache_sqlite_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_plugin_namecache_postgres_SOURCES = \
  test_plugin_namecache.c
 test_plugin_namecache_postgres_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 EXTRA_DIST = \
   test_namecache_api.conf \
diff --git a/src/namecache/gnunet-namecache.c b/src/namecache/gnunet-namecache.c
index e58d3f960..0236609aa 100644
--- a/src/namecache/gnunet-namecache.c
+++ b/src/namecache/gnunet-namecache.c
@@ -50,7 +50,7 @@ static char *name;
 /**
  * Public key of the zone to look in.
  */
-static struct GNUNET_IDENTITY_PublicKey pubkey;
+static struct GNUNET_CRYPTO_PublicKey pubkey;
 
 /**
  * Public key of the zone to look in, in ASCII.
@@ -176,7 +176,7 @@ run (void *cls,
   }
 
   if (GNUNET_OK !=
-      GNUNET_IDENTITY_public_key_from_string (pkey, &pubkey))
+      GNUNET_CRYPTO_public_key_from_string (pkey, &pubkey))
   {
     fprintf (stderr, _ ("Invalid public key for zone `%s'\n"), pkey);
     GNUNET_SCHEDULER_shutdown ();
diff --git a/src/namecache/test_namecache_api_cache_block.c 
b/src/namecache/test_namecache_api_cache_block.c
index d83758e7d..3a18a72e1 100644
--- a/src/namecache/test_namecache_api_cache_block.c
+++ b/src/namecache/test_namecache_api_cache_block.c
@@ -38,9 +38,9 @@ static struct GNUNET_NAMECACHE_Handle *nsh;
 
 static struct GNUNET_SCHEDULER_Task *endbadly_task;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey;
+static struct GNUNET_CRYPTO_PrivateKey privkey;
 
-static struct GNUNET_IDENTITY_PublicKey pubkey;
+static struct GNUNET_CRYPTO_PublicKey pubkey;
 
 static int res;
 
@@ -177,7 +177,7 @@ run (void *cls,
                                                 &endbadly, NULL);
   privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
   GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
-  GNUNET_IDENTITY_key_get_public (&privkey, &pubkey);
+  GNUNET_CRYPTO_key_get_public (&privkey, &pubkey);
 
 
   rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 10000000000;
diff --git a/src/namestore/Makefile.am b/src/namestore/Makefile.am
index 98ee228e1..8edc3b658 100644
--- a/src/namestore/Makefile.am
+++ b/src/namestore/Makefile.am
@@ -111,9 +111,9 @@ libgnunet_plugin_rest_namestore_la_LIBADD = \
   $(top_builddir)/src/rest/libgnunetrest.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(top_builddir)/src/json/libgnunetjson.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecordjson.la \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecordjson.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \
   $(LTLIBINTL) -ljansson $(MHD_LIBS)
 libgnunet_plugin_rest_namestore_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -125,10 +125,10 @@ libgnunetnamestore_la_SOURCES = \
   namestore_api_monitor.c \
   namestore.h
 libgnunetnamestore_la_LIBADD = \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la  \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la  \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 libgnunetnamestore_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)  \
@@ -139,8 +139,8 @@ gnunet_namestore_zonefile_SOURCES = \
 gnunet_namestore_zonefile_LDADD = \
   libgnunetnamestore.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la  \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la  \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 gnunet_zoneimport_SOURCES = \
@@ -149,23 +149,23 @@ gnunet_zoneimport_LDADD = \
   libgnunetnamestore.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 gnunet_namestore_SOURCES = \
  gnunet-namestore.c
 gnunet_namestore_LDADD = \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   libgnunetnamestore.la \
   $(GN_LIBINTL)
 
 gnunet_namestore_dbtool_SOURCES = \
  gnunet-namestore-dbtool.c
 gnunet_namestore_dbtool_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   libgnunetnamestore.la \
   $(GN_LIBINTL)
 
@@ -174,10 +174,10 @@ gnunet_namestore_dbtool_LDADD = \
 gnunet_namestore_fcfsd_SOURCES = \
  gnunet-namestore-fcfsd.c
 gnunet_namestore_fcfsd_LDADD = $(MHD_LIBS) \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   libgnunetnamestore.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/json/libgnunetjson.la \
   $(GN_LIBINTL) -ljansson
 gnunet_namestore_fcfsd_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS)
@@ -187,10 +187,10 @@ gnunet_service_namestore_SOURCES = \
  gnunet-service-namestore.c
 gnunet_service_namestore_LDADD = \
   $(top_builddir)/src/namecache/libgnunetnamecache.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   libgnunetnamestore.la \
   $(GN_LIBINTL)
 
@@ -199,11 +199,11 @@ gnunet_service_namestore_LDADD = \
 libgnunet_plugin_namestore_sqlite_la_SOURCES = \
   plugin_namestore_sqlite.c
 libgnunet_plugin_namestore_sqlite_la_LIBADD = \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la  \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la  \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(top_builddir)/src/sq/libgnunetsq.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3 \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lsqlite3 \
   $(LTLIBINTL)
 libgnunet_plugin_namestore_sqlite_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -211,11 +211,11 @@ libgnunet_plugin_namestore_sqlite_la_LDFLAGS = \
 libgnunet_plugin_namestore_postgres_la_SOURCES = \
   plugin_namestore_postgres.c
 libgnunet_plugin_namestore_postgres_la_LIBADD = \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la  \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la  \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(top_builddir)/src/pq/libgnunetpq.la  \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lpq \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lpq \
   $(LTLIBINTL)
 libgnunet_plugin_namestore_postgres_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS) $(POSTGRESQL_LDFLAGS)
@@ -224,8 +224,8 @@ test_namestore_api_store_sqlite_SOURCES = \
  test_namestore_api_store.c
 test_namestore_api_store_sqlite_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   libgnunetnamestore.la
 
@@ -233,8 +233,8 @@ test_namestore_api_store_postgres_SOURCES = \
  test_namestore_api_store.c
 test_namestore_api_store_postgres_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   libgnunetnamestore.la
 
@@ -242,9 +242,9 @@ test_namestore_api_store_update_sqlite_SOURCES = \
  test_namestore_api_store_update.c
 test_namestore_api_store_update_sqlite_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/namecache/libgnunetnamecache.la \
   libgnunetnamestore.la
 
@@ -252,9 +252,9 @@ test_namestore_api_store_update_postgres_SOURCES = \
  test_namestore_api_store_update.c
 test_namestore_api_store_update_postgres_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/namecache/libgnunetnamecache.la \
   libgnunetnamestore.la
 
@@ -262,9 +262,9 @@ test_namestore_api_lookup_nick_sqlite_SOURCES = \
  test_namestore_api_lookup_nick.c
 test_namestore_api_lookup_nick_sqlite_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/namecache/libgnunetnamecache.la \
   libgnunetnamestore.la
 
@@ -272,9 +272,9 @@ test_namestore_api_lookup_nick_postgres_SOURCES = \
  test_namestore_api_lookup_nick.c
 test_namestore_api_lookup_nick_postgres_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/namecache/libgnunetnamecache.la \
   libgnunetnamestore.la
 
@@ -283,8 +283,8 @@ test_namestore_api_remove_sqlite_SOURCES = \
 test_namestore_api_remove_sqlite_LDADD = \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
 test_namestore_api_remove_postgres_SOURCES = \
@@ -292,17 +292,17 @@ test_namestore_api_remove_postgres_SOURCES = \
 test_namestore_api_remove_postgres_LDADD = \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
 test_namestore_api_remove_not_existing_record_sqlite_SOURCES = \
  test_namestore_api_remove_not_existing_record.c
 test_namestore_api_remove_not_existing_record_sqlite_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
 test_namestore_api_remove_not_existing_record_postgres_SOURCES = \
@@ -310,8 +310,8 @@ 
test_namestore_api_remove_not_existing_record_postgres_SOURCES = \
 test_namestore_api_remove_not_existing_record_postgres_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
 test_namestore_api_zone_to_name_sqlite_SOURCES = \
@@ -319,7 +319,7 @@ test_namestore_api_zone_to_name_sqlite_SOURCES = \
 test_namestore_api_zone_to_name_sqlite_LDADD = \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   libgnunetnamestore.la
 
 test_namestore_api_zone_to_name_postgres_SOURCES = \
@@ -327,7 +327,7 @@ test_namestore_api_zone_to_name_postgres_SOURCES = \
 test_namestore_api_zone_to_name_postgres_LDADD = \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   libgnunetnamestore.la
 
 test_namestore_api_monitoring_sqlite_SOURCES = \
@@ -336,8 +336,8 @@ test_namestore_api_monitoring_sqlite_LDADD = \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetnamestore.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_namestore_api_monitoring_postgres_SOURCES = \
  test_namestore_api_monitoring.c
@@ -345,8 +345,8 @@ test_namestore_api_monitoring_postgres_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   libgnunetnamestore.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_namestore_api_monitoring_existing_sqlite_SOURCES = \
  test_namestore_api_monitoring_existing.c
@@ -354,17 +354,17 @@ test_namestore_api_monitoring_existing_sqlite_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   libgnunetnamestore.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_namestore_api_monitoring_existing_postgres_SOURCES = \
  test_namestore_api_monitoring_existing.c
 test_namestore_api_monitoring_existing_postgres_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetnamestore.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_namestore_api_tx_rollback_sqlite_SOURCES = \
  test_namestore_api_tx_rollback.c
@@ -372,8 +372,8 @@ test_namestore_api_tx_rollback_sqlite_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   libgnunetnamestore.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_namestore_api_tx_rollback_postgres_SOURCES = \
  test_namestore_api_tx_rollback.c
@@ -381,8 +381,8 @@ test_namestore_api_tx_rollback_postgres_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   libgnunetnamestore.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 if HAVE_EXPERIMENTAL
 test_namestore_api_edit_records_postgres_SOURCES = \
@@ -391,8 +391,8 @@ test_namestore_api_edit_records_postgres_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   libgnunetnamestore.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 endif
 
 test_namestore_api_zone_iteration_sqlite_SOURCES = \
@@ -400,8 +400,8 @@ test_namestore_api_zone_iteration_sqlite_SOURCES = \
 test_namestore_api_zone_iteration_sqlite_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
 test_namestore_api_zone_iteration_postgres_SOURCES = \
@@ -409,35 +409,35 @@ test_namestore_api_zone_iteration_postgres_SOURCES = \
 test_namestore_api_zone_iteration_postgres_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
 perf_namestore_api_zone_iteration_postgres_SOURCES = \
  perf_namestore_api_zone_iteration.c
 perf_namestore_api_zone_iteration_postgres_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
 perf_namestore_api_import_sqlite_SOURCES = \
  perf_namestore_api_import.c
 perf_namestore_api_import_sqlite_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
 perf_namestore_api_import_postgres_SOURCES = \
  perf_namestore_api_import.c
 perf_namestore_api_import_postgres_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
 
@@ -446,8 +446,8 @@ perf_namestore_api_zone_iteration_sqlite_SOURCES = \
 perf_namestore_api_zone_iteration_sqlite_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
 test_namestore_api_zone_iteration_nick_sqlite_SOURCES = \
@@ -455,8 +455,8 @@ test_namestore_api_zone_iteration_nick_sqlite_SOURCES = \
 test_namestore_api_zone_iteration_nick_sqlite_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
 test_namestore_api_zone_iteration_nick_postgres_SOURCES = \
@@ -464,8 +464,8 @@ test_namestore_api_zone_iteration_nick_postgres_SOURCES = \
 test_namestore_api_zone_iteration_nick_postgres_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
 test_namestore_api_zone_iteration_specific_zone_sqlite_SOURCES = \
@@ -473,8 +473,8 @@ 
test_namestore_api_zone_iteration_specific_zone_sqlite_SOURCES = \
 test_namestore_api_zone_iteration_specific_zone_sqlite_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
 test_namestore_api_zone_iteration_specific_zone_postgres_SOURCES = \
@@ -482,8 +482,8 @@ 
test_namestore_api_zone_iteration_specific_zone_postgres_SOURCES = \
 test_namestore_api_zone_iteration_specific_zone_postgres_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
 test_namestore_api_zone_iteration_stop_sqlite_SOURCES = \
@@ -491,8 +491,8 @@ test_namestore_api_zone_iteration_stop_sqlite_SOURCES = \
 test_namestore_api_zone_iteration_stop_sqlite_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
 test_namestore_api_zone_iteration_stop_postgres_SOURCES = \
@@ -500,8 +500,8 @@ test_namestore_api_zone_iteration_stop_postgres_SOURCES = \
 test_namestore_api_zone_iteration_stop_postgres_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
 test_plugin_namestore_sqlite_SOURCES = \
@@ -509,14 +509,14 @@ test_plugin_namestore_sqlite_SOURCES = \
 test_plugin_namestore_sqlite_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_plugin_namestore_postgres_SOURCES = \
   test_plugin_namestore.c
 test_plugin_namestore_postgres_LDADD = \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 check_SCRIPTS = \
   test_namestore_put.sh \
diff --git a/src/namestore/gnunet-namestore-fcfsd.c 
b/src/namestore/gnunet-namestore-fcfsd.c
index 857b16def..4948ae441 100644
--- a/src/namestore/gnunet-namestore-fcfsd.c
+++ b/src/namestore/gnunet-namestore-fcfsd.c
@@ -110,7 +110,7 @@ struct RequestData
   /**
    * Key to be associated with the requested name.
    */
-  struct GNUNET_IDENTITY_PublicKey key;
+  struct GNUNET_CRYPTO_PublicKey key;
 };
 
 /**
@@ -136,7 +136,7 @@ static struct GNUNET_IDENTITY_Handle *identity = NULL;
 /**
  * Private key of the zone.
  */
-static const struct GNUNET_IDENTITY_PrivateKey *zone_key = NULL;
+static const struct GNUNET_CRYPTO_PrivateKey *zone_key = NULL;
 
 /**
  * The HTTP daemon.
@@ -389,7 +389,7 @@ search_error_cb (void *cls)
  */
 static void
 search_done_cb (void *cls,
-                const struct GNUNET_IDENTITY_PrivateKey *zone,
+                const struct GNUNET_CRYPTO_PrivateKey *zone,
                 const char *label,
                 unsigned int count,
                 const struct GNUNET_GNSRECORD_Data *d)
@@ -478,7 +478,7 @@ register_done_cb (void *cls,
  */
 static void
 register_do_cb (void *cls,
-                const struct GNUNET_IDENTITY_PrivateKey *key,
+                const struct GNUNET_CRYPTO_PrivateKey *key,
                 const char *label,
                 unsigned int count,
                 const struct GNUNET_GNSRECORD_Data *d)
@@ -577,7 +577,7 @@ iterate_error_cb (void *cls)
  */
 static void
 iterate_do_cb (void *cls,
-               const struct GNUNET_IDENTITY_PrivateKey *key,
+               const struct GNUNET_CRYPTO_PrivateKey *key,
                const char *label,
                unsigned int count,
                const struct GNUNET_GNSRECORD_Data *d)
@@ -838,7 +838,7 @@ create_response (void *cls,
         return MHD_YES;
       }
 
-      if (GNUNET_OK != GNUNET_IDENTITY_public_key_from_string 
(rd->register_key,
+      if (GNUNET_OK != GNUNET_CRYPTO_public_key_from_string (rd->register_key,
                                                                &(rd->key)))
       {
         GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
diff --git a/src/namestore/gnunet-namestore-zonefile.c 
b/src/namestore/gnunet-namestore-zonefile.c
index d9331aa32..dfd438e94 100644
--- a/src/namestore/gnunet-namestore-zonefile.c
+++ b/src/namestore/gnunet-namestore-zonefile.c
@@ -94,7 +94,7 @@ static struct GNUNET_IDENTITY_EgoLookup *el;
 /**
  * Private key for the our zone.
  */
-static struct GNUNET_IDENTITY_PrivateKey zone_pkey;
+static struct GNUNET_CRYPTO_PrivateKey zone_pkey;
 
 /**
  * Queue entry for the 'add' operation.
@@ -282,7 +282,7 @@ parse_origin (char *token, char *origin)
 }
 
 static void
-origin_create_cb (void *cls, const struct GNUNET_IDENTITY_PrivateKey *pk,
+origin_create_cb (void *cls, const struct GNUNET_CRYPTO_PrivateKey *pk,
                   enum GNUNET_ErrorCode ec)
 {
   id_op = NULL;
@@ -309,7 +309,7 @@ origin_lookup_cb (void *cls, struct GNUNET_IDENTITY_Ego 
*ego)
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "$ORIGIN %s does not exist, creating...\n", ego_name);
     id_op = GNUNET_IDENTITY_create (id, ego_name, NULL,
-                                    GNUNET_IDENTITY_TYPE_ECDSA, // FIXME make 
configurable
+                                    GNUNET_PUBLIC_KEY_TYPE_ECDSA, // FIXME 
make configurable
                                     origin_create_cb,
                                     NULL);
     return;
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index 0329c9c63..baa036ac7 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -79,7 +79,7 @@ struct MarkedRecord
   /**
    * The zone key
    */
-  struct GNUNET_IDENTITY_PrivateKey key;
+  struct GNUNET_CRYPTO_PrivateKey key;
 };
 
 /**
@@ -116,7 +116,7 @@ static struct GNUNET_NAMESTORE_Handle *ns;
 /**
  * Private key for the our zone.
  */
-static struct GNUNET_IDENTITY_PrivateKey zone_pkey;
+static struct GNUNET_CRYPTO_PrivateKey zone_pkey;
 
 /**
  * Identity service handle
@@ -765,7 +765,7 @@ zone_iteration_error_cb (void *cls)
 
 static void
 collect_zone_records_to_purge (const struct
-                               GNUNET_IDENTITY_PrivateKey *zone_key,
+                               GNUNET_CRYPTO_PrivateKey *zone_key,
                                const char *rname,
                                unsigned int rd_len,
                                const struct GNUNET_GNSRECORD_Data *rd)
@@ -782,7 +782,7 @@ collect_zone_records_to_purge (const struct
 
 
 static void
-collect_orphans (const struct GNUNET_IDENTITY_PrivateKey *zone_key,
+collect_orphans (const struct GNUNET_CRYPTO_PrivateKey *zone_key,
                  const char *rname,
                  unsigned int rd_len,
                  const struct GNUNET_GNSRECORD_Data *rd)
@@ -820,7 +820,7 @@ collect_orphans (const struct GNUNET_IDENTITY_PrivateKey 
*zone_key,
  * @param rd array of records with data to store
  */
 static void
-display_record (const struct GNUNET_IDENTITY_PrivateKey *zone_key,
+display_record (const struct GNUNET_CRYPTO_PrivateKey *zone_key,
                 const char *rname,
                 unsigned int rd_len,
                 const struct GNUNET_GNSRECORD_Data *rd)
@@ -864,7 +864,7 @@ display_record (const struct GNUNET_IDENTITY_PrivateKey 
*zone_key,
     return;
   if (! list_orphaned && is_orphaned)
     return;
-  orphaned_str = GNUNET_IDENTITY_private_key_to_string (zone_key);
+  orphaned_str = GNUNET_CRYPTO_private_key_to_string (zone_key);
   fprintf (stdout, "%s.%s:\n", rname, is_orphaned ? orphaned_str :
            ego->identifier);
   GNUNET_free (orphaned_str);
@@ -931,7 +931,7 @@ display_record (const struct GNUNET_IDENTITY_PrivateKey 
*zone_key,
 
 static void
 purge_zone_iterator (void *cls,
-                     const struct GNUNET_IDENTITY_PrivateKey *zone_key,
+                     const struct GNUNET_CRYPTO_PrivateKey *zone_key,
                      const char *rname,
                      unsigned int rd_len,
                      const struct GNUNET_GNSRECORD_Data *rd,
@@ -947,7 +947,7 @@ purge_zone_iterator (void *cls,
 
 static void
 purge_orphans_iterator (void *cls,
-                        const struct GNUNET_IDENTITY_PrivateKey *zone_key,
+                        const struct GNUNET_CRYPTO_PrivateKey *zone_key,
                         const char *rname,
                         unsigned int rd_len,
                         const struct GNUNET_GNSRECORD_Data *rd,
@@ -972,7 +972,7 @@ purge_orphans_iterator (void *cls,
  */
 static void
 display_record_iterator (void *cls,
-                         const struct GNUNET_IDENTITY_PrivateKey *zone_key,
+                         const struct GNUNET_CRYPTO_PrivateKey *zone_key,
                          const char *rname,
                          unsigned int rd_len,
                          const struct GNUNET_GNSRECORD_Data *rd,
@@ -997,7 +997,7 @@ display_record_iterator (void *cls,
  */
 static void
 display_record_monitor (void *cls,
-                        const struct GNUNET_IDENTITY_PrivateKey *zone_key,
+                        const struct GNUNET_CRYPTO_PrivateKey *zone_key,
                         const char *rname,
                         unsigned int rd_len,
                         const struct GNUNET_GNSRECORD_Data *rd,
@@ -1022,7 +1022,7 @@ display_record_monitor (void *cls,
  */
 static void
 display_record_lookup (void *cls,
-                       const struct GNUNET_IDENTITY_PrivateKey *zone_key,
+                       const struct GNUNET_CRYPTO_PrivateKey *zone_key,
                        const char *rname,
                        unsigned int rd_len,
                        const struct GNUNET_GNSRECORD_Data *rd)
@@ -1102,7 +1102,7 @@ add_error_cb (void *cls)
  */
 static void
 get_existing_record (void *cls,
-                     const struct GNUNET_IDENTITY_PrivateKey *zone_key,
+                     const struct GNUNET_CRYPTO_PrivateKey *zone_key,
                      const char *rec_name,
                      unsigned int rd_count,
                      const struct GNUNET_GNSRECORD_Data *rd)
@@ -1194,7 +1194,7 @@ reverse_error_cb (void *cls)
  */
 static void
 handle_reverse_lookup (void *cls,
-                       const struct GNUNET_IDENTITY_PrivateKey *zone,
+                       const struct GNUNET_CRYPTO_PrivateKey *zone,
                        const char *label,
                        unsigned int rd_count,
                        const struct GNUNET_GNSRECORD_Data *rd)
@@ -1239,7 +1239,7 @@ del_lookup_error_cb (void *cls)
  */
 static void
 del_monitor (void *cls,
-             const struct GNUNET_IDENTITY_PrivateKey *zone,
+             const struct GNUNET_CRYPTO_PrivateKey *zone,
              const char *label,
              unsigned int rd_count,
              const struct GNUNET_GNSRECORD_Data *rd)
@@ -1622,7 +1622,7 @@ run_with_zone_pkey (const struct 
GNUNET_CONFIGURATION_Handle *cfg)
   }
   if (NULL != reverse_pkey)
   {
-    struct GNUNET_IDENTITY_PublicKey pubkey;
+    struct GNUNET_CRYPTO_PublicKey pubkey;
 
     if (NULL == ego_name)
     {
@@ -1635,7 +1635,7 @@ run_with_zone_pkey (const struct 
GNUNET_CONFIGURATION_Handle *cfg)
       return;
     }
     if (GNUNET_OK !=
-        GNUNET_IDENTITY_public_key_from_string (reverse_pkey,
+        GNUNET_CRYPTO_public_key_from_string (reverse_pkey,
                                                 &pubkey))
     {
       fprintf (stderr,
@@ -1657,7 +1657,7 @@ run_with_zone_pkey (const struct 
GNUNET_CONFIGURATION_Handle *cfg)
   {
     char sh[105];
     char sname[64];
-    struct GNUNET_IDENTITY_PublicKey pkey;
+    struct GNUNET_CRYPTO_PublicKey pkey;
     if (NULL == ego_name)
     {
       fprintf (stderr,
@@ -1674,7 +1674,7 @@ run_with_zone_pkey (const struct 
GNUNET_CONFIGURATION_Handle *cfg)
 
     if ((2 != (sscanf (uri, "gnunet://gns/%58s/%63s", sh, sname))) ||
         (GNUNET_OK !=
-         GNUNET_IDENTITY_public_key_from_string (sh, &pkey)))
+         GNUNET_CRYPTO_public_key_from_string (sh, &pkey)))
     {
       fprintf (stderr, _ ("Invalid URI `%s'\n"), uri);
       ret = 1;
@@ -1700,7 +1700,7 @@ run_with_zone_pkey (const struct 
GNUNET_CONFIGURATION_Handle *cfg)
     }
     memset (&rd, 0, sizeof(rd));
     rd.data = &pkey;
-    rd.data_size = GNUNET_IDENTITY_public_key_get_length (&pkey);
+    rd.data_size = GNUNET_CRYPTO_public_key_get_length (&pkey);
     rd.record_type = ntohl (pkey.type);
     rd.expiration_time = etime;
     if (GNUNET_YES == etime_is_rel)
@@ -1737,14 +1737,14 @@ run_with_zone_pkey (const struct 
GNUNET_CONFIGURATION_Handle *cfg)
 
 static int
 get_identity_for_string (const char *str,
-                         struct GNUNET_IDENTITY_PrivateKey *zk)
+                         struct GNUNET_CRYPTO_PrivateKey *zk)
 {
-  const struct GNUNET_IDENTITY_PrivateKey *privkey;
-  struct GNUNET_IDENTITY_PublicKey pubkey;
-  struct GNUNET_IDENTITY_PublicKey ego_pubkey;
+  const struct GNUNET_CRYPTO_PrivateKey *privkey;
+  struct GNUNET_CRYPTO_PublicKey pubkey;
+  struct GNUNET_CRYPTO_PublicKey ego_pubkey;
   struct EgoEntry *ego_entry;
 
-  if (GNUNET_OK == GNUNET_IDENTITY_public_key_from_string (str,
+  if (GNUNET_OK == GNUNET_CRYPTO_public_key_from_string (str,
                                                            &pubkey))
   {
     for (ego_entry = ego_head;
@@ -1777,7 +1777,7 @@ static void
 process_command_stdin ()
 {
   char buf[MAX_LINE_LEN];
-  static struct GNUNET_IDENTITY_PrivateKey next_zone_key;
+  static struct GNUNET_CRYPTO_PrivateKey next_zone_key;
   static char next_name[GNUNET_DNSPARSER_MAX_NAME_LENGTH];
   static int finished = GNUNET_NO;
   static int have_next_zonekey = GNUNET_NO;
@@ -1900,7 +1900,7 @@ id_connect_cb (void *cls,
                void **ctx,
                const char *name)
 {
-  struct GNUNET_IDENTITY_PublicKey pk;
+  struct GNUNET_CRYPTO_PublicKey pk;
   struct EgoEntry *ego_entry;
 
   (void) ctx;
diff --git a/src/namestore/gnunet-service-namestore.c 
b/src/namestore/gnunet-service-namestore.c
index f6594c6f9..26de295bf 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -80,7 +80,7 @@ struct ZoneIteration
   /**
    * Key of the zone we are iterating over.
    */
-  struct GNUNET_IDENTITY_PrivateKey zone;
+  struct GNUNET_CRYPTO_PrivateKey zone;
 
   /**
    * The record set filter
@@ -191,7 +191,7 @@ struct ZoneMonitor
   /**
    * Private key of the zone.
    */
-  struct GNUNET_IDENTITY_PrivateKey zone;
+  struct GNUNET_CRYPTO_PrivateKey zone;
 
   /**
    * The record set filter
@@ -302,7 +302,7 @@ struct StoreActivity
   /**
    * The zone private key
    */
-  struct GNUNET_IDENTITY_PrivateKey private_key;
+  struct GNUNET_CRYPTO_PrivateKey private_key;
 
   /**
    * Copy of the original record set (as data fields in @e rd will
@@ -326,7 +326,7 @@ struct NickCache
   /**
    * Zone the cache entry is for.
    */
-  struct GNUNET_IDENTITY_PrivateKey zone;
+  struct GNUNET_CRYPTO_PrivateKey zone;
 
   /**
    * Cached record data.
@@ -347,7 +347,7 @@ static struct NickCache nick_cache[NC_SIZE];
 /**
  * Public key of all zeros.
  */
-static const struct GNUNET_IDENTITY_PrivateKey zero;
+static const struct GNUNET_CRYPTO_PrivateKey zero;
 
 /**
  * Configuration handle.
@@ -453,7 +453,7 @@ free_store_activity (struct StoreActivity *sa)
 static void
 lookup_nick_it (void *cls,
                 uint64_t seq,
-                const struct GNUNET_IDENTITY_PrivateKey *private_key,
+                const struct GNUNET_CRYPTO_PrivateKey *private_key,
                 const char *label,
                 unsigned int rd_count,
                 const struct GNUNET_GNSRECORD_Data *rd)
@@ -493,7 +493,7 @@ lookup_nick_it (void *cls,
  * @param nick nick entry to cache
  */
 static void
-cache_nick (const struct GNUNET_IDENTITY_PrivateKey *zone,
+cache_nick (const struct GNUNET_CRYPTO_PrivateKey *zone,
             const struct GNUNET_GNSRECORD_Data *nick)
 {
   struct NickCache *oldest;
@@ -537,9 +537,9 @@ cache_nick (const struct GNUNET_IDENTITY_PrivateKey *zone,
  * @return NULL if no NICK record was found
  */
 static struct GNUNET_GNSRECORD_Data *
-get_nick_record (const struct GNUNET_IDENTITY_PrivateKey *zone)
+get_nick_record (const struct GNUNET_CRYPTO_PrivateKey *zone)
 {
-  struct GNUNET_IDENTITY_PublicKey pub;
+  struct GNUNET_CRYPTO_PublicKey pub;
   struct GNUNET_GNSRECORD_Data *nick;
   int res;
 
@@ -579,7 +579,7 @@ get_nick_record (const struct GNUNET_IDENTITY_PrivateKey 
*zone)
                                            __LINE__);
     if (1 == do_log)
     {
-      GNUNET_IDENTITY_key_get_public (zone, &pub);
+      GNUNET_CRYPTO_key_get_public (zone, &pub);
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
                   "No nick name set for zone `%s'\n",
                   GNUNET_GNSRECORD_z2s (&pub));
@@ -695,7 +695,7 @@ static int
 send_lookup_response_with_filter (struct NamestoreClient *nc,
                                   uint32_t request_id,
                                   const struct
-                                  GNUNET_IDENTITY_PrivateKey *zone_key,
+                                  GNUNET_CRYPTO_PrivateKey *zone_key,
                                   const char *name,
                                   unsigned int rd_count,
                                   const struct GNUNET_GNSRECORD_Data *rd,
@@ -778,7 +778,7 @@ send_lookup_response_with_filter (struct NamestoreClient 
*nc,
     GNUNET_SERVICE_client_drop (nc->client);
     return 0;
   }
-  key_len = GNUNET_IDENTITY_private_key_get_length (zone_key);
+  key_len = GNUNET_CRYPTO_private_key_get_length (zone_key);
   env = GNUNET_MQ_msg_extra (zir_msg,
                              name_len + rd_ser_len + key_len,
                              GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT);
@@ -787,7 +787,7 @@ send_lookup_response_with_filter (struct NamestoreClient 
*nc,
   zir_msg->rd_count = htons (res_count);
   zir_msg->rd_len = htons ((uint16_t) rd_ser_len);
   zir_msg->key_len = htons (key_len);
-  GNUNET_IDENTITY_write_private_key_to_buffer (zone_key,
+  GNUNET_CRYPTO_write_private_key_to_buffer (zone_key,
                                                &zir_msg[1],
                                                key_len);
   zir_msg->expire = GNUNET_TIME_absolute_hton (block_exp);
@@ -1194,7 +1194,7 @@ struct RecordLookupContext
 static void
 lookup_it (void *cls,
            uint64_t seq,
-           const struct GNUNET_IDENTITY_PrivateKey *private_key,
+           const struct GNUNET_CRYPTO_PrivateKey *private_key,
            const char *label,
            unsigned int rd_count_nf,
            const struct GNUNET_GNSRECORD_Data *rd_nf)
@@ -1337,7 +1337,7 @@ check_record_lookup (void *cls, const struct 
LabelLookupMessage *ll_msg)
 static void
 handle_record_lookup (void *cls, const struct LabelLookupMessage *ll_msg)
 {
-  struct GNUNET_IDENTITY_PrivateKey zone;
+  struct GNUNET_CRYPTO_PrivateKey zone;
   struct NamestoreClient *nc = cls;
   struct GNUNET_MQ_Envelope *env;
   struct LabelLookupResponseMessage *llr_msg;
@@ -1352,7 +1352,7 @@ handle_record_lookup (void *cls, const struct 
LabelLookupMessage *ll_msg)
 
   key_len = ntohs (ll_msg->key_len);
   if ((GNUNET_SYSERR ==
-       GNUNET_IDENTITY_read_private_key_from_buffer (&ll_msg[1],
+       GNUNET_CRYPTO_read_private_key_from_buffer (&ll_msg[1],
                                                      key_len,
                                                      &zone,
                                                      &kb_read)) ||
@@ -1489,7 +1489,7 @@ static void
 get_existing_rd_exp (void *cls,
                      uint64_t seq,
                      const struct
-                     GNUNET_IDENTITY_PrivateKey *private_key,
+                     GNUNET_CRYPTO_PrivateKey *private_key,
                      const char *label,
                      unsigned int rd_count,
                      const struct GNUNET_GNSRECORD_Data *rd)
@@ -1523,7 +1523,7 @@ get_existing_rd_exp (void *cls,
 
 static enum GNUNET_ErrorCode
 store_record_set (struct NamestoreClient *nc,
-                  const struct GNUNET_IDENTITY_PrivateKey *private_key,
+                  const struct GNUNET_CRYPTO_PrivateKey *private_key,
                   const struct RecordSet *rd_set,
                   ssize_t *len)
 {
@@ -1727,7 +1727,7 @@ store_record_set (struct NamestoreClient *nc,
 static void
 handle_record_store (void *cls, const struct RecordStoreMessage *rp_msg)
 {
-  struct GNUNET_IDENTITY_PrivateKey zone;
+  struct GNUNET_CRYPTO_PrivateKey zone;
   struct NamestoreClient *nc = cls;
   uint32_t rid;
   uint16_t rd_set_count;
@@ -1747,7 +1747,7 @@ handle_record_store (void *cls, const struct 
RecordStoreMessage *rp_msg)
   rs_off = sizeof (*rp_msg) + key_len;
   rs_len = rp_msg_len - rs_off;
   if ((GNUNET_SYSERR ==
-       GNUNET_IDENTITY_read_private_key_from_buffer (&rp_msg[1],
+       GNUNET_CRYPTO_read_private_key_from_buffer (&rp_msg[1],
                                                      key_len,
                                                      &zone,
                                                      &kb_read)) ||
@@ -1949,7 +1949,7 @@ struct ZoneToNameCtx
 static void
 handle_zone_to_name_it (void *cls,
                         uint64_t seq,
-                        const struct GNUNET_IDENTITY_PrivateKey *zone_key,
+                        const struct GNUNET_CRYPTO_PrivateKey *zone_key,
                         const char *name,
                         unsigned int rd_count,
                         const struct GNUNET_GNSRECORD_Data *rd)
@@ -1977,7 +1977,7 @@ handle_zone_to_name_it (void *cls,
     ztn_ctx->ec = htonl (GNUNET_EC_NAMESTORE_UNKNOWN);
     return;
   }
-  key_len = GNUNET_IDENTITY_private_key_get_length (zone_key);
+  key_len = GNUNET_CRYPTO_private_key_get_length (zone_key);
   msg_size = sizeof(struct ZoneToNameResponseMessage)
              + name_len + rd_ser_len + key_len;
   if (msg_size >= GNUNET_MAX_MESSAGE_SIZE)
@@ -1997,7 +1997,7 @@ handle_zone_to_name_it (void *cls,
   ztnr_msg->rd_count = htons (rd_count);
   ztnr_msg->name_len = htons (name_len);
   ztnr_msg->key_len = htons (key_len);
-  GNUNET_IDENTITY_write_private_key_to_buffer (zone_key,
+  GNUNET_CRYPTO_write_private_key_to_buffer (zone_key,
                                                &ztnr_msg[1],
                                                key_len);
   name_tmp = (char *) &ztnr_msg[1] + key_len;
@@ -2027,8 +2027,8 @@ check_zone_to_name (void *cls,
 static void
 handle_zone_to_name (void *cls, const struct ZoneToNameMessage *ztn_msg)
 {
-  struct GNUNET_IDENTITY_PrivateKey zone;
-  struct GNUNET_IDENTITY_PublicKey value_zone;
+  struct GNUNET_CRYPTO_PrivateKey zone;
+  struct GNUNET_CRYPTO_PublicKey value_zone;
   struct NamestoreClient *nc = cls;
   struct ZoneToNameCtx ztn_ctx;
   struct GNUNET_MQ_Envelope *env;
@@ -2043,7 +2043,7 @@ handle_zone_to_name (void *cls, const struct 
ZoneToNameMessage *ztn_msg)
   ztn_ctx.ec = GNUNET_EC_NAMESTORE_ZONE_NOT_FOUND;
   key_len = ntohs (ztn_msg->key_len);
   if ((GNUNET_SYSERR ==
-       GNUNET_IDENTITY_read_private_key_from_buffer (&ztn_msg[1],
+       GNUNET_CRYPTO_read_private_key_from_buffer (&ztn_msg[1],
                                                      key_len,
                                                      &zone,
                                                      &kb_read)) ||
@@ -2057,7 +2057,7 @@ handle_zone_to_name (void *cls, const struct 
ZoneToNameMessage *ztn_msg)
   }
   pkey_len = ntohs (ztn_msg->pkey_len);
   if ((GNUNET_SYSERR ==
-       GNUNET_IDENTITY_read_public_key_from_buffer ((char*) &ztn_msg[1]
+       GNUNET_CRYPTO_read_public_key_from_buffer ((char*) &ztn_msg[1]
                                                     + key_len,
                                                     pkey_len,
                                                     &value_zone,
@@ -2133,7 +2133,7 @@ struct ZoneIterationProcResult
 static void
 zone_iterate_proc (void *cls,
                    uint64_t seq,
-                   const struct GNUNET_IDENTITY_PrivateKey *zone_key,
+                   const struct GNUNET_CRYPTO_PrivateKey *zone_key,
                    const char *name,
                    unsigned int rd_count,
                    const struct GNUNET_GNSRECORD_Data *rd)
@@ -2254,7 +2254,7 @@ static void
 handle_iteration_start (void *cls,
                         const struct ZoneIterationStartMessage *zis_msg)
 {
-  struct GNUNET_IDENTITY_PrivateKey zone;
+  struct GNUNET_CRYPTO_PrivateKey zone;
   struct NamestoreClient *nc = cls;
   struct ZoneIteration *zi;
   size_t key_len;
@@ -2267,7 +2267,7 @@ handle_iteration_start (void *cls,
   if (0 < key_len)
   {
     if ((GNUNET_SYSERR ==
-         GNUNET_IDENTITY_read_private_key_from_buffer (&zis_msg[1],
+         GNUNET_CRYPTO_read_private_key_from_buffer (&zis_msg[1],
                                                        key_len,
                                                        &zone,
                                                        &kb_read)) ||
@@ -2443,7 +2443,7 @@ monitor_iteration_next (void *cls);
 static void
 monitor_iterate_cb (void *cls,
                     uint64_t seq,
-                    const struct GNUNET_IDENTITY_PrivateKey *zone_key,
+                    const struct GNUNET_CRYPTO_PrivateKey *zone_key,
                     const char *name,
                     unsigned int rd_count,
                     const struct GNUNET_GNSRECORD_Data *rd)
@@ -2505,7 +2505,7 @@ static void
 handle_monitor_start (void *cls, const struct
                       ZoneMonitorStartMessage *zis_msg)
 {
-  struct GNUNET_IDENTITY_PrivateKey zone;
+  struct GNUNET_CRYPTO_PrivateKey zone;
   struct NamestoreClient *nc = cls;
   struct ZoneMonitor *zm;
   size_t key_len;
@@ -2519,7 +2519,7 @@ handle_monitor_start (void *cls, const struct
   if (0 < key_len)
   {
     if ((GNUNET_SYSERR ==
-         GNUNET_IDENTITY_read_private_key_from_buffer (&zis_msg[1],
+         GNUNET_CRYPTO_read_private_key_from_buffer (&zis_msg[1],
                                                        key_len,
                                                        &zone,
                                                        &kb_read)) ||
diff --git a/src/namestore/gnunet-zoneimport.c 
b/src/namestore/gnunet-zoneimport.c
index 485df4924..c7e0cf65f 100644
--- a/src/namestore/gnunet-zoneimport.c
+++ b/src/namestore/gnunet-zoneimport.c
@@ -94,7 +94,7 @@ struct Zone
   /**
    * Private key of the zone.
    */
-  struct GNUNET_IDENTITY_PrivateKey key;
+  struct GNUNET_CRYPTO_PrivateKey key;
 };
 
 
@@ -1393,7 +1393,7 @@ ns_lookup_error_cb (void *cls)
  */
 static void
 ns_lookup_result_cb (void *cls,
-                     const struct GNUNET_IDENTITY_PrivateKey *key,
+                     const struct GNUNET_CRYPTO_PrivateKey *key,
                      const char *label,
                      unsigned int rd_count,
                      const struct GNUNET_GNSRECORD_Data *rd)
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c
index 2c5efb745..7a4438e30 100644
--- a/src/namestore/namestore_api.c
+++ b/src/namestore/namestore_api.c
@@ -183,7 +183,7 @@ struct GNUNET_NAMESTORE_ZoneIterator
   /**
    * Private key of the zone.
    */
-  struct GNUNET_IDENTITY_PrivateKey zone;
+  struct GNUNET_CRYPTO_PrivateKey zone;
 
   /**
    * The operation id this zone iteration operation has
@@ -448,7 +448,7 @@ handle_lookup_result (void *cls, const struct 
LabelLookupResponseMessage *msg)
 {
   struct GNUNET_NAMESTORE_Handle *h = cls;
   struct GNUNET_NAMESTORE_QueueEntry *qe;
-  struct GNUNET_IDENTITY_PrivateKey private_key;
+  struct GNUNET_CRYPTO_PrivateKey private_key;
   const char *name;
   const char *rd_tmp;
   size_t name_len;
@@ -468,7 +468,7 @@ handle_lookup_result (void *cls, const struct 
LabelLookupResponseMessage *msg)
   name_len = ntohs (msg->name_len);
   key_len = ntohs (msg->key_len);
   GNUNET_assert (GNUNET_SYSERR !=
-                 GNUNET_IDENTITY_read_private_key_from_buffer (&msg[1],
+                 GNUNET_CRYPTO_read_private_key_from_buffer (&msg[1],
                                                                key_len,
                                                                &private_key,
                                                                &kbytes_read));
@@ -566,7 +566,7 @@ handle_record_result (void *cls, const struct 
RecordResultMessage *msg)
   struct GNUNET_NAMESTORE_Handle *h = cls;
   struct GNUNET_NAMESTORE_QueueEntry *qe;
   struct GNUNET_NAMESTORE_ZoneIterator *ze;
-  struct GNUNET_IDENTITY_PrivateKey private_key;
+  struct GNUNET_CRYPTO_PrivateKey private_key;
   const char *name;
   const char *rd_tmp;
   size_t name_len;
@@ -592,7 +592,7 @@ handle_record_result (void *cls, const struct 
RecordResultMessage *msg)
   }
   name = (const char *) &msg[1] + key_len;
   GNUNET_assert (GNUNET_SYSERR !=
-                 GNUNET_IDENTITY_read_private_key_from_buffer (&msg[1],
+                 GNUNET_CRYPTO_read_private_key_from_buffer (&msg[1],
                                                                key_len,
                                                                &private_key,
                                                                &kbytes_read));
@@ -747,7 +747,7 @@ handle_zone_to_name_response (void *cls,
 {
   struct GNUNET_NAMESTORE_Handle *h = cls;
   struct GNUNET_NAMESTORE_QueueEntry *qe;
-  struct GNUNET_IDENTITY_PrivateKey zone;
+  struct GNUNET_CRYPTO_PrivateKey zone;
   enum GNUNET_ErrorCode res;
   size_t name_len;
   size_t rd_ser_len;
@@ -768,7 +768,7 @@ handle_zone_to_name_response (void *cls,
   res = ntohl (msg->ec);
   key_len = ntohs (msg->key_len);
   GNUNET_assert (GNUNET_SYSERR !=
-                 GNUNET_IDENTITY_read_private_key_from_buffer (&msg[1],
+                 GNUNET_CRYPTO_read_private_key_from_buffer (&msg[1],
                                                                key_len,
                                                                &zone,
                                                                &kbytes_read));
@@ -1050,7 +1050,7 @@ warn_delay (void *cls)
 struct GNUNET_NAMESTORE_QueueEntry *
 GNUNET_NAMESTORE_records_store (
   struct GNUNET_NAMESTORE_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *pkey,
+  const struct GNUNET_CRYPTO_PrivateKey *pkey,
   const char *label,
   unsigned int rd_count,
   const struct GNUNET_GNSRECORD_Data *rd,
@@ -1069,7 +1069,7 @@ GNUNET_NAMESTORE_records_store (
 struct GNUNET_NAMESTORE_QueueEntry *
 GNUNET_NAMESTORE_records_store2 (
   struct GNUNET_NAMESTORE_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *pkey,
+  const struct GNUNET_CRYPTO_PrivateKey *pkey,
   unsigned int rd_set_count,
   const struct GNUNET_NAMESTORE_RecordInfo *record_info,
   unsigned int *rds_sent,
@@ -1093,7 +1093,7 @@ GNUNET_NAMESTORE_records_store2 (
   size_t rd_set_len = 0;
   size_t key_len = 0;
   size_t max_len;
-  key_len = GNUNET_IDENTITY_private_key_get_length (pkey);
+  key_len = GNUNET_CRYPTO_private_key_get_length (pkey);
   max_len = UINT16_MAX - key_len - sizeof (struct RecordStoreMessage);
 
   *rds_sent = 0;
@@ -1146,7 +1146,7 @@ GNUNET_NAMESTORE_records_store2 (
   msg->gns_header.r_id = htonl (rid);
   msg->key_len = htons (key_len);
   msg->rd_set_count = htons ((uint16_t) (*rds_sent));
-  GNUNET_IDENTITY_write_private_key_to_buffer (pkey,
+  GNUNET_CRYPTO_write_private_key_to_buffer (pkey,
                                                &msg[1],
                                                key_len);
   rd_set = (struct RecordSet*) (((char*) &msg[1]) + key_len);
@@ -1195,7 +1195,7 @@ GNUNET_NAMESTORE_records_store2 (
 static struct GNUNET_NAMESTORE_QueueEntry *
 records_lookup (
   struct GNUNET_NAMESTORE_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *pkey,
+  const struct GNUNET_CRYPTO_PrivateKey *pkey,
   const char *label,
   GNUNET_SCHEDULER_TaskCallback error_cb,
   void *error_cb_cls,
@@ -1225,12 +1225,12 @@ records_lookup (
   qe->op_id = get_op_id (h);
   GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, qe);
 
-  key_len = GNUNET_IDENTITY_private_key_get_length (pkey);
+  key_len = GNUNET_CRYPTO_private_key_get_length (pkey);
   env = GNUNET_MQ_msg_extra (msg,
                              label_len +  key_len,
                              GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP);
   msg->gns_header.r_id = htonl (qe->op_id);
-  GNUNET_IDENTITY_write_private_key_to_buffer (pkey,
+  GNUNET_CRYPTO_write_private_key_to_buffer (pkey,
                                                &msg[1],
                                                key_len);
 
@@ -1249,7 +1249,7 @@ records_lookup (
 struct GNUNET_NAMESTORE_QueueEntry *
 GNUNET_NAMESTORE_records_lookup (
   struct GNUNET_NAMESTORE_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *pkey,
+  const struct GNUNET_CRYPTO_PrivateKey *pkey,
   const char *label,
   GNUNET_SCHEDULER_TaskCallback error_cb,
   void *error_cb_cls,
@@ -1265,7 +1265,7 @@ GNUNET_NAMESTORE_records_lookup (
 struct GNUNET_NAMESTORE_QueueEntry *
 GNUNET_NAMESTORE_records_lookup2 (
   struct GNUNET_NAMESTORE_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *pkey,
+  const struct GNUNET_CRYPTO_PrivateKey *pkey,
   const char *label,
   GNUNET_SCHEDULER_TaskCallback error_cb,
   void *error_cb_cls,
@@ -1283,7 +1283,7 @@ GNUNET_NAMESTORE_records_lookup2 (
 struct GNUNET_NAMESTORE_QueueEntry *
 GNUNET_NAMESTORE_records_edit (
   struct GNUNET_NAMESTORE_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *pkey,
+  const struct GNUNET_CRYPTO_PrivateKey *pkey,
   const char *label,
   GNUNET_SCHEDULER_TaskCallback error_cb,
   void *error_cb_cls,
@@ -1298,8 +1298,8 @@ GNUNET_NAMESTORE_records_edit (
 struct GNUNET_NAMESTORE_QueueEntry *
 GNUNET_NAMESTORE_zone_to_name (
   struct GNUNET_NAMESTORE_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *zone,
-  const struct GNUNET_IDENTITY_PublicKey *value_zone,
+  const struct GNUNET_CRYPTO_PrivateKey *zone,
+  const struct GNUNET_CRYPTO_PublicKey *value_zone,
   GNUNET_SCHEDULER_TaskCallback error_cb,
   void *error_cb_cls,
   GNUNET_NAMESTORE_RecordMonitor proc,
@@ -1322,15 +1322,15 @@ GNUNET_NAMESTORE_zone_to_name (
   qe->op_id = rid;
   GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, qe);
 
-  key_len = GNUNET_IDENTITY_private_key_get_length (zone);
-  pkey_len = GNUNET_IDENTITY_public_key_get_length (value_zone);
+  key_len = GNUNET_CRYPTO_private_key_get_length (zone);
+  pkey_len = GNUNET_CRYPTO_public_key_get_length (value_zone);
   env = GNUNET_MQ_msg_extra (msg, key_len + pkey_len,
                              GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME);
   msg->gns_header.r_id = htonl (rid);
   msg->key_len = htons (key_len);
   msg->pkey_len = htons (pkey_len);
-  GNUNET_IDENTITY_write_private_key_to_buffer (zone, &msg[1], key_len);
-  GNUNET_IDENTITY_write_public_key_to_buffer (value_zone,
+  GNUNET_CRYPTO_write_private_key_to_buffer (zone, &msg[1], key_len);
+  GNUNET_CRYPTO_write_public_key_to_buffer (value_zone,
                                               (char*) &msg[1] + key_len,
                                               pkey_len);
   if (NULL == h->mq)
@@ -1344,7 +1344,7 @@ GNUNET_NAMESTORE_zone_to_name (
 struct GNUNET_NAMESTORE_ZoneIterator *
 GNUNET_NAMESTORE_zone_iteration_start (
   struct GNUNET_NAMESTORE_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *zone,
+  const struct GNUNET_CRYPTO_PrivateKey *zone,
   GNUNET_SCHEDULER_TaskCallback error_cb,
   void *error_cb_cls,
   GNUNET_NAMESTORE_RecordMonitor proc,
@@ -1372,7 +1372,7 @@ GNUNET_NAMESTORE_zone_iteration_start (
   if (NULL != zone)
   {
     it->zone = *zone;
-    key_len = GNUNET_IDENTITY_private_key_get_length (zone);
+    key_len = GNUNET_CRYPTO_private_key_get_length (zone);
   }
   GNUNET_CONTAINER_DLL_insert_tail (h->z_head, h->z_tail, it);
   env = GNUNET_MQ_msg_extra (msg,
@@ -1381,7 +1381,7 @@ GNUNET_NAMESTORE_zone_iteration_start (
   msg->gns_header.r_id = htonl (rid);
   msg->key_len = htons (key_len);
   if (NULL != zone)
-    GNUNET_IDENTITY_write_private_key_to_buffer (zone, &msg[1], key_len);
+    GNUNET_CRYPTO_write_private_key_to_buffer (zone, &msg[1], key_len);
   if (NULL == h->mq)
     it->env = env;
   else
@@ -1392,7 +1392,7 @@ GNUNET_NAMESTORE_zone_iteration_start (
 struct GNUNET_NAMESTORE_ZoneIterator *
 GNUNET_NAMESTORE_zone_iteration_start2 (
   struct GNUNET_NAMESTORE_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *zone,
+  const struct GNUNET_CRYPTO_PrivateKey *zone,
   GNUNET_SCHEDULER_TaskCallback error_cb,
   void *error_cb_cls,
   GNUNET_NAMESTORE_RecordSetMonitor proc,
@@ -1421,7 +1421,7 @@ GNUNET_NAMESTORE_zone_iteration_start2 (
   if (NULL != zone)
   {
     it->zone = *zone;
-    key_len = GNUNET_IDENTITY_private_key_get_length (zone);
+    key_len = GNUNET_CRYPTO_private_key_get_length (zone);
   }
   GNUNET_CONTAINER_DLL_insert_tail (h->z_head, h->z_tail, it);
   env = GNUNET_MQ_msg_extra (msg,
@@ -1431,7 +1431,7 @@ GNUNET_NAMESTORE_zone_iteration_start2 (
   msg->key_len = htons (key_len);
   msg->filter = htons ((uint16_t) filter);
   if (NULL != zone)
-    GNUNET_IDENTITY_write_private_key_to_buffer (zone, &msg[1], key_len);
+    GNUNET_CRYPTO_write_private_key_to_buffer (zone, &msg[1], key_len);
   if (NULL == h->mq)
     it->env = env;
   else
diff --git a/src/namestore/namestore_api_monitor.c 
b/src/namestore/namestore_api_monitor.c
index a99b386d0..ec4ba879b 100644
--- a/src/namestore/namestore_api_monitor.c
+++ b/src/namestore/namestore_api_monitor.c
@@ -90,7 +90,7 @@ struct GNUNET_NAMESTORE_ZoneMonitor
   /**
    * Monitored zone.
    */
-  struct GNUNET_IDENTITY_PrivateKey zone;
+  struct GNUNET_CRYPTO_PrivateKey zone;
 
   /**
    * Do we first iterate over all existing records?
@@ -211,7 +211,7 @@ static void
 handle_result (void *cls, const struct RecordResultMessage *lrm)
 {
   struct GNUNET_NAMESTORE_ZoneMonitor *zm = cls;
-  struct GNUNET_IDENTITY_PrivateKey private_key;
+  struct GNUNET_CRYPTO_PrivateKey private_key;
   size_t name_len;
   size_t rd_len;
   size_t key_len;
@@ -226,7 +226,7 @@ handle_result (void *cls, const struct RecordResultMessage 
*lrm)
   name_len = ntohs (lrm->name_len);
   name_tmp = (const char *) &lrm[1] + key_len;
   GNUNET_assert (GNUNET_SYSERR !=
-                 GNUNET_IDENTITY_read_private_key_from_buffer (&lrm[1],
+                 GNUNET_CRYPTO_read_private_key_from_buffer (&lrm[1],
                                                                key_len,
                                                                &private_key,
                                                                &kbytes_read));
@@ -303,7 +303,7 @@ reconnect (struct GNUNET_NAMESTORE_ZoneMonitor *zm)
                              GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_START);
   sm->iterate_first = htonl (zm->iterate_first);
   if (0 < zm->key_len)
-    GNUNET_IDENTITY_write_private_key_to_buffer (&zm->zone,
+    GNUNET_CRYPTO_write_private_key_to_buffer (&zm->zone,
                                                &sm[1],
                                                zm->key_len);
   sm->key_len = htons (zm->key_len);
@@ -315,7 +315,7 @@ reconnect (struct GNUNET_NAMESTORE_ZoneMonitor *zm)
 struct GNUNET_NAMESTORE_ZoneMonitor *
 GNUNET_NAMESTORE_zone_monitor_start (
   const struct GNUNET_CONFIGURATION_Handle *cfg,
-  const struct GNUNET_IDENTITY_PrivateKey *zone,
+  const struct GNUNET_CRYPTO_PrivateKey *zone,
   int iterate_first,
   GNUNET_SCHEDULER_TaskCallback error_cb,
   void *error_cb_cls,
@@ -329,7 +329,7 @@ GNUNET_NAMESTORE_zone_monitor_start (
   zm = GNUNET_new (struct GNUNET_NAMESTORE_ZoneMonitor);
   if (NULL != zone)
   {
-    zm->key_len = GNUNET_IDENTITY_private_key_get_length (zone);
+    zm->key_len = GNUNET_CRYPTO_private_key_get_length (zone);
     zm->zone = *zone;
   }
   zm->iterate_first = iterate_first;
@@ -352,7 +352,7 @@ GNUNET_NAMESTORE_zone_monitor_start (
 struct GNUNET_NAMESTORE_ZoneMonitor *
 GNUNET_NAMESTORE_zone_monitor_start2 (
   const struct GNUNET_CONFIGURATION_Handle *cfg,
-  const struct GNUNET_IDENTITY_PrivateKey *zone,
+  const struct GNUNET_CRYPTO_PrivateKey *zone,
   int iterate_first,
   GNUNET_SCHEDULER_TaskCallback error_cb,
   void *error_cb_cls,
@@ -367,7 +367,7 @@ GNUNET_NAMESTORE_zone_monitor_start2 (
   zm = GNUNET_new (struct GNUNET_NAMESTORE_ZoneMonitor);
   if (NULL != zone)
   {
-    zm->key_len = GNUNET_IDENTITY_private_key_get_length (zone);
+    zm->key_len = GNUNET_CRYPTO_private_key_get_length (zone);
     zm->zone = *zone;
   }
   zm->iterate_first = iterate_first;
diff --git a/src/namestore/perf_namestore_api_import.c 
b/src/namestore/perf_namestore_api_import.c
index b4f17f742..e56fb961c 100644
--- a/src/namestore/perf_namestore_api_import.c
+++ b/src/namestore/perf_namestore_api_import.c
@@ -65,7 +65,7 @@ static struct GNUNET_SCHEDULER_Task *timeout_task;
 
 static struct GNUNET_SCHEDULER_Task *t;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey;
+static struct GNUNET_CRYPTO_PrivateKey privkey;
 
 static struct GNUNET_NAMESTORE_QueueEntry *qe;
 
diff --git a/src/namestore/perf_namestore_api_zone_iteration.c 
b/src/namestore/perf_namestore_api_zone_iteration.c
index bf89d6225..e16748f5b 100644
--- a/src/namestore/perf_namestore_api_zone_iteration.c
+++ b/src/namestore/perf_namestore_api_zone_iteration.c
@@ -63,7 +63,7 @@ static struct GNUNET_SCHEDULER_Task *timeout_task;
 
 static struct GNUNET_SCHEDULER_Task *t;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey;
+static struct GNUNET_CRYPTO_PrivateKey privkey;
 
 static struct GNUNET_NAMESTORE_ZoneIterator *zi;
 
@@ -187,7 +187,7 @@ fail_cb (void *cls)
 
 static void
 zone_proc (void *cls,
-           const struct GNUNET_IDENTITY_PrivateKey *zone,
+           const struct GNUNET_CRYPTO_PrivateKey *zone,
            const char *label,
            unsigned int rd_count,
            const struct GNUNET_GNSRECORD_Data *rd)
diff --git a/src/namestore/plugin_namestore_flat.c 
b/src/namestore/plugin_namestore_flat.c
index 3249d524a..8b574d2cf 100644
--- a/src/namestore/plugin_namestore_flat.c
+++ b/src/namestore/plugin_namestore_flat.c
@@ -54,7 +54,7 @@ struct FlatFileEntry
   /**
    * Entry zone
    */
-  struct GNUNET_IDENTITY_PrivateKey private_key;
+  struct GNUNET_CRYPTO_PrivateKey private_key;
 
   /**
    * Record count.
@@ -86,7 +86,7 @@ struct FlatFileEntry
  * @param[out] h initialized hash
  */
 static void
-hash_pkey_and_label (const struct GNUNET_IDENTITY_PrivateKey *pkey,
+hash_pkey_and_label (const struct GNUNET_CRYPTO_PrivateKey *pkey,
                      const char *label,
                      struct GNUNET_HashCode *h)
 {
@@ -95,14 +95,14 @@ hash_pkey_and_label (const struct 
GNUNET_IDENTITY_PrivateKey *pkey,
   size_t key_len;
 
   label_len = strlen (label);
-  key_len = label_len + sizeof(struct GNUNET_IDENTITY_PrivateKey);
+  key_len = label_len + sizeof(struct GNUNET_CRYPTO_PrivateKey);
   key = GNUNET_malloc (key_len);
   GNUNET_memcpy (key,
                  label,
                  label_len);
   GNUNET_memcpy (key + label_len,
                  pkey,
-                 sizeof(struct GNUNET_IDENTITY_PrivateKey));
+                 sizeof(struct GNUNET_CRYPTO_PrivateKey));
   GNUNET_CRYPTO_hash (key,
                       key_len,
                       h);
@@ -296,7 +296,7 @@ database_setup (struct Plugin *plugin)
     GNUNET_free (record_data);
 
     {
-      struct GNUNET_IDENTITY_PrivateKey *private_key;
+      struct GNUNET_CRYPTO_PrivateKey *private_key;
 
       GNUNET_STRINGS_base64_decode (zone_private_key,
                                     strlen (zone_private_key),
@@ -345,7 +345,7 @@ store_and_free_entries (void *cls,
 
   (void) key;
   GNUNET_STRINGS_base64_encode (&entry->private_key,
-                                sizeof(struct GNUNET_IDENTITY_PrivateKey),
+                                sizeof(struct GNUNET_CRYPTO_PrivateKey),
                                 &zone_private_key);
   data_size = GNUNET_GNSRECORD_records_get_size (entry->record_count,
                                                  entry->record_data);
@@ -452,7 +452,7 @@ database_shutdown (struct Plugin *plugin)
 static int
 namestore_flat_store_records (void *cls,
                               const struct
-                              GNUNET_IDENTITY_PrivateKey *zone_key,
+                              GNUNET_CRYPTO_PrivateKey *zone_key,
                               const char *label,
                               unsigned int rd_count,
                               const struct GNUNET_GNSRECORD_Data *rd)
@@ -482,7 +482,7 @@ namestore_flat_store_records (void *cls,
                    strlen (label));
   GNUNET_memcpy (&entry->private_key,
                  zone_key,
-                 sizeof(struct GNUNET_IDENTITY_PrivateKey));
+                 sizeof(struct GNUNET_CRYPTO_PrivateKey));
   entry->rvalue = rvalue;
   entry->record_count = rd_count;
   entry->record_data = GNUNET_new_array (rd_count,
@@ -517,7 +517,7 @@ namestore_flat_store_records (void *cls,
  */
 static int
 namestore_flat_lookup_records (void *cls,
-                               const struct GNUNET_IDENTITY_PrivateKey *zone,
+                               const struct GNUNET_CRYPTO_PrivateKey *zone,
                                const char *label,
                                GNUNET_NAMESTORE_RecordIterator iter,
                                void *iter_cls)
@@ -574,7 +574,7 @@ struct IterateContext
   /**
    * Target zone.
    */
-  const struct GNUNET_IDENTITY_PrivateKey *zone;
+  const struct GNUNET_CRYPTO_PrivateKey *zone;
 
   /**
    * Function to call on each record.
@@ -647,7 +647,7 @@ iterate_zones (void *cls,
 static int
 namestore_flat_iterate_records (void *cls,
                                 const struct
-                                GNUNET_IDENTITY_PrivateKey *zone,
+                                GNUNET_CRYPTO_PrivateKey *zone,
                                 uint64_t serial,
                                 uint64_t limit,
                                 GNUNET_NAMESTORE_RecordIterator iter,
@@ -674,8 +674,8 @@ namestore_flat_iterate_records (void *cls,
  */
 struct ZoneToNameContext
 {
-  const struct GNUNET_IDENTITY_PrivateKey *zone;
-  const struct GNUNET_IDENTITY_PublicKey *value_zone;
+  const struct GNUNET_CRYPTO_PrivateKey *zone;
+  const struct GNUNET_CRYPTO_PublicKey *value_zone;
   GNUNET_NAMESTORE_RecordIterator iter;
   void *iter_cls;
 
@@ -733,9 +733,9 @@ zone_to_name (void *cls,
  */
 static int
 namestore_flat_zone_to_name (void *cls,
-                             const struct GNUNET_IDENTITY_PrivateKey *zone,
+                             const struct GNUNET_CRYPTO_PrivateKey *zone,
                              const struct
-                             GNUNET_IDENTITY_PublicKey *value_zone,
+                             GNUNET_CRYPTO_PublicKey *value_zone,
                              GNUNET_NAMESTORE_RecordIterator iter,
                              void *iter_cls)
 {
diff --git a/src/namestore/plugin_namestore_postgres.c 
b/src/namestore/plugin_namestore_postgres.c
index de819f196..c6debf3a9 100644
--- a/src/namestore/plugin_namestore_postgres.c
+++ b/src/namestore/plugin_namestore_postgres.c
@@ -224,13 +224,13 @@ database_connect (struct Plugin *plugin)
 static enum GNUNET_GenericReturnValue
 namestore_postgres_store_records (void *cls,
                                   const struct
-                                  GNUNET_IDENTITY_PrivateKey *zone_key,
+                                  GNUNET_CRYPTO_PrivateKey *zone_key,
                                   const char *label,
                                   unsigned int rd_count,
                                   const struct GNUNET_GNSRECORD_Data *rd)
 {
   struct Plugin *plugin = cls;
-  struct GNUNET_IDENTITY_PublicKey pkey;
+  struct GNUNET_CRYPTO_PublicKey pkey;
   uint64_t rvalue;
   uint32_t rd_count32 = (uint32_t) rd_count;
   ssize_t data_size;
@@ -342,7 +342,7 @@ struct ParserContext
   /**
    * Zone key, NULL if part of record.
    */
-  const struct GNUNET_IDENTITY_PrivateKey *zone_key;
+  const struct GNUNET_CRYPTO_PrivateKey *zone_key;
 
   /**
    * Number of results still to return (counted down by
@@ -378,7 +378,7 @@ parse_result_call_iterator (void *cls,
     size_t data_size;
     uint32_t record_count;
     char *label;
-    struct GNUNET_IDENTITY_PrivateKey zk;
+    struct GNUNET_CRYPTO_PrivateKey zk;
     struct GNUNET_PQ_ResultSpec rs_with_zone[] = {
       GNUNET_PQ_result_spec_uint64 ("seq", &serial),
       GNUNET_PQ_result_spec_uint32 ("record_count", &record_count),
@@ -456,7 +456,7 @@ parse_result_call_iterator (void *cls,
 static enum GNUNET_GenericReturnValue
 lookup_records (void *cls,
                 const struct
-                GNUNET_IDENTITY_PrivateKey *zone,
+                GNUNET_CRYPTO_PrivateKey *zone,
                 const char *label,
                 GNUNET_NAMESTORE_RecordIterator iter,
                 void *iter_cls,
@@ -506,7 +506,7 @@ lookup_records (void *cls,
 static enum GNUNET_GenericReturnValue
 namestore_postgres_lookup_records (void *cls,
                                    const struct
-                                   GNUNET_IDENTITY_PrivateKey *zone,
+                                   GNUNET_CRYPTO_PrivateKey *zone,
                                    const char *label,
                                    GNUNET_NAMESTORE_RecordIterator iter,
                                    void *iter_cls)
@@ -528,7 +528,7 @@ namestore_postgres_lookup_records (void *cls,
 static int
 namestore_postgres_edit_records (void *cls,
                                  const struct
-                                 GNUNET_IDENTITY_PrivateKey *zone,
+                                 GNUNET_CRYPTO_PrivateKey *zone,
                                  const char *label,
                                  GNUNET_NAMESTORE_RecordIterator iter,
                                  void *iter_cls)
@@ -552,7 +552,7 @@ namestore_postgres_edit_records (void *cls,
 static enum GNUNET_GenericReturnValue
 namestore_postgres_iterate_records (void *cls,
                                     const struct
-                                    GNUNET_IDENTITY_PrivateKey *zone,
+                                    GNUNET_CRYPTO_PrivateKey *zone,
                                     uint64_t serial,
                                     uint64_t limit,
                                     GNUNET_NAMESTORE_RecordIterator iter,
@@ -620,9 +620,9 @@ namestore_postgres_iterate_records (void *cls,
 static enum GNUNET_GenericReturnValue
 namestore_postgres_zone_to_name (void *cls,
                                  const struct
-                                 GNUNET_IDENTITY_PrivateKey *zone,
+                                 GNUNET_CRYPTO_PrivateKey *zone,
                                  const struct
-                                 GNUNET_IDENTITY_PublicKey *value_zone,
+                                 GNUNET_CRYPTO_PublicKey *value_zone,
                                  GNUNET_NAMESTORE_RecordIterator iter,
                                  void *iter_cls)
 {
diff --git a/src/namestore/plugin_namestore_sqlite.c 
b/src/namestore/plugin_namestore_sqlite.c
index 15a6586b5..d66271ffa 100644
--- a/src/namestore/plugin_namestore_sqlite.c
+++ b/src/namestore/plugin_namestore_sqlite.c
@@ -268,14 +268,14 @@ database_shutdown (struct Plugin *plugin)
 static enum GNUNET_GenericReturnValue
 namestore_sqlite_store_records (void *cls,
                                 const struct
-                                GNUNET_IDENTITY_PrivateKey *zone_key,
+                                GNUNET_CRYPTO_PrivateKey *zone_key,
                                 const char *label,
                                 unsigned int rd_count,
                                 const struct GNUNET_GNSRECORD_Data *rd)
 {
   struct Plugin *plugin = cls;
   int n;
-  struct GNUNET_IDENTITY_PublicKey pkey;
+  struct GNUNET_CRYPTO_PublicKey pkey;
   uint64_t rvalue;
   ssize_t data_size;
 
@@ -426,7 +426,7 @@ static enum GNUNET_GenericReturnValue
 get_records_and_call_iterator (struct Plugin *plugin,
                                sqlite3_stmt *stmt,
                                const struct
-                               GNUNET_IDENTITY_PrivateKey *zone_key,
+                               GNUNET_CRYPTO_PrivateKey *zone_key,
                                uint64_t limit,
                                GNUNET_NAMESTORE_RecordIterator iter,
                                void *iter_cls)
@@ -461,7 +461,7 @@ get_records_and_call_iterator (struct Plugin *plugin,
       size_t data_size;
       void *data;
       char *label;
-      struct GNUNET_IDENTITY_PrivateKey zk;
+      struct GNUNET_CRYPTO_PrivateKey zk;
       struct GNUNET_SQ_ResultSpec rs[] = {
         GNUNET_SQ_result_spec_uint64 (&seq),
         GNUNET_SQ_result_spec_uint32 (&record_count),
@@ -543,7 +543,7 @@ get_records_and_call_iterator (struct Plugin *plugin,
 static enum GNUNET_GenericReturnValue
 namestore_sqlite_lookup_records (void *cls,
                                  const struct
-                                 GNUNET_IDENTITY_PrivateKey *zone,
+                                 GNUNET_CRYPTO_PrivateKey *zone,
                                  const char *label,
                                  GNUNET_NAMESTORE_RecordIterator iter,
                                  void *iter_cls)
@@ -595,7 +595,7 @@ namestore_sqlite_lookup_records (void *cls,
 static enum GNUNET_GenericReturnValue
 namestore_sqlite_iterate_records (void *cls,
                                   const struct
-                                  GNUNET_IDENTITY_PrivateKey *zone,
+                                  GNUNET_CRYPTO_PrivateKey *zone,
                                   uint64_t serial,
                                   uint64_t limit,
                                   GNUNET_NAMESTORE_RecordIterator iter,
@@ -662,9 +662,9 @@ namestore_sqlite_iterate_records (void *cls,
  */
 static enum GNUNET_GenericReturnValue
 namestore_sqlite_zone_to_name (void *cls,
-                               const struct GNUNET_IDENTITY_PrivateKey *zone,
+                               const struct GNUNET_CRYPTO_PrivateKey *zone,
                                const struct
-                               GNUNET_IDENTITY_PublicKey *value_zone,
+                               GNUNET_CRYPTO_PublicKey *value_zone,
                                GNUNET_NAMESTORE_RecordIterator iter,
                                void *iter_cls)
 {
diff --git a/src/namestore/plugin_rest_namestore.c 
b/src/namestore/plugin_rest_namestore.c
index 1f2f58097..31e78e6dd 100644
--- a/src/namestore/plugin_rest_namestore.c
+++ b/src/namestore/plugin_rest_namestore.c
@@ -214,7 +214,7 @@ struct RequestHandle
   /**
    * Private key for the zone
    */
-  const struct GNUNET_IDENTITY_PrivateKey *zone_pkey;
+  const struct GNUNET_CRYPTO_PrivateKey *zone_pkey;
 
   /**
    * IDENTITY Operation
@@ -482,7 +482,7 @@ namestore_list_finished (void *cls)
  */
 static void
 namestore_list_iteration (void *cls,
-                          const struct GNUNET_IDENTITY_PrivateKey *zone_key,
+                          const struct GNUNET_CRYPTO_PrivateKey *zone_key,
                           const char *rname,
                           unsigned int rd_len,
                           const struct GNUNET_GNSRECORD_Data *rd,
@@ -541,7 +541,7 @@ ns_lookup_error_cb (void *cls)
 
 static void
 ns_get_lookup_cb (void *cls,
-                  const struct GNUNET_IDENTITY_PrivateKey *zone,
+                  const struct GNUNET_CRYPTO_PrivateKey *zone,
                   const char *label,
                   unsigned int rd_len,
                   const struct GNUNET_GNSRECORD_Data *rd)
@@ -692,7 +692,7 @@ namestore_get (struct GNUNET_REST_RequestHandle *con_handle,
 
 static void
 ns_lookup_cb (void *cls,
-              const struct GNUNET_IDENTITY_PrivateKey *zone,
+              const struct GNUNET_CRYPTO_PrivateKey *zone,
               const char *label,
               unsigned int rd_count,
               const struct GNUNET_GNSRECORD_Data *rd)
@@ -1152,7 +1152,7 @@ list_ego (void *cls,
           const char *identifier)
 {
   struct EgoEntry *ego_entry;
-  struct GNUNET_IDENTITY_PublicKey pk;
+  struct GNUNET_CRYPTO_PublicKey pk;
 
   if ((NULL == ego) && (ID_REST_STATE_INIT == state))
   {
@@ -1169,7 +1169,7 @@ list_ego (void *cls,
   {
     ego_entry = GNUNET_new (struct EgoEntry);
     GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
-    ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk);
+    ego_entry->keystring = GNUNET_CRYPTO_public_key_to_string (&pk);
     ego_entry->ego = ego;
     ego_entry->identifier = GNUNET_strdup (identifier);
     GNUNET_CONTAINER_DLL_insert_tail (ego_head,
@@ -1195,7 +1195,7 @@ list_ego (void *cls,
       /* Add */
       ego_entry = GNUNET_new (struct EgoEntry);
       GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
-      ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk);
+      ego_entry->keystring = GNUNET_CRYPTO_public_key_to_string (&pk);
       ego_entry->ego = ego;
       ego_entry->identifier = GNUNET_strdup (identifier);
       GNUNET_CONTAINER_DLL_insert_tail (ego_head,
diff --git a/src/namestore/test_namestore_api_edit_records.c 
b/src/namestore/test_namestore_api_edit_records.c
index fbee57432..a6bce7c17 100644
--- a/src/namestore/test_namestore_api_edit_records.c
+++ b/src/namestore/test_namestore_api_edit_records.c
@@ -40,9 +40,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh2;
 
 static struct GNUNET_SCHEDULER_Task *endbadly_task;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey;
+static struct GNUNET_CRYPTO_PrivateKey privkey;
 
-static struct GNUNET_IDENTITY_PublicKey pubkey;
+static struct GNUNET_CRYPTO_PublicKey pubkey;
 
 static int res;
 
@@ -91,7 +91,7 @@ end (void *cls)
 
 static void
 lookup_it (void *cls,
-           const struct GNUNET_IDENTITY_PrivateKey *zone,
+           const struct GNUNET_CRYPTO_PrivateKey *zone,
            const char *label,
            unsigned int rd_count,
            const struct GNUNET_GNSRECORD_Data *rd)
@@ -138,7 +138,7 @@ fail_cb_lock (void *cls);
 
 static void
 edit_cont_b (void *cls,
-             const struct GNUNET_IDENTITY_PrivateKey *zone,
+             const struct GNUNET_CRYPTO_PrivateKey *zone,
              const char *label,
              unsigned int rd_count,
              const struct GNUNET_GNSRECORD_Data *rd)
@@ -243,7 +243,7 @@ begin_cont_b (void *cls,
 
 static void
 edit_cont (void *cls,
-           const struct GNUNET_IDENTITY_PrivateKey *zone,
+           const struct GNUNET_CRYPTO_PrivateKey *zone,
            const char *label,
            unsigned int rd_count,
            const struct GNUNET_GNSRECORD_Data *rd)
@@ -322,7 +322,7 @@ run (void *cls,
 
   privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
   GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
-  GNUNET_IDENTITY_key_get_public (&privkey,
+  GNUNET_CRYPTO_key_get_public (&privkey,
                                   &pubkey);
 
   removed = GNUNET_NO;
diff --git a/src/namestore/test_namestore_api_lookup_nick.c 
b/src/namestore/test_namestore_api_lookup_nick.c
index b26674a95..21fc1ef79 100644
--- a/src/namestore/test_namestore_api_lookup_nick.c
+++ b/src/namestore/test_namestore_api_lookup_nick.c
@@ -40,9 +40,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
 
 static struct GNUNET_SCHEDULER_Task *endbadly_task;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey;
+static struct GNUNET_CRYPTO_PrivateKey privkey;
 
-static struct GNUNET_IDENTITY_PublicKey pubkey;
+static struct GNUNET_CRYPTO_PublicKey pubkey;
 
 static int res;
 
@@ -97,7 +97,7 @@ end (void *cls)
 
 static void
 lookup_it (void *cls,
-           const struct GNUNET_IDENTITY_PrivateKey *zone,
+           const struct GNUNET_CRYPTO_PrivateKey *zone,
            const char *label,
            unsigned int rd_count,
            const struct GNUNET_GNSRECORD_Data *rd)
@@ -289,7 +289,7 @@ run (void *cls,
                                                 NULL);
   privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
   GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
-  GNUNET_IDENTITY_key_get_public (&privkey,
+  GNUNET_CRYPTO_key_get_public (&privkey,
                                       &pubkey);
 
   nsh = GNUNET_NAMESTORE_connect (cfg);
diff --git a/src/namestore/test_namestore_api_monitoring.c 
b/src/namestore/test_namestore_api_monitoring.c
index 271f4c40b..74dad3749 100644
--- a/src/namestore/test_namestore_api_monitoring.c
+++ b/src/namestore/test_namestore_api_monitoring.c
@@ -36,9 +36,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
 
 static struct GNUNET_SCHEDULER_Task *endbadly_task;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey;
+static struct GNUNET_CRYPTO_PrivateKey privkey;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey2;
+static struct GNUNET_CRYPTO_PrivateKey privkey2;
 
 static struct GNUNET_NAMESTORE_ZoneMonitor *zm;
 
@@ -132,7 +132,7 @@ end (void *cls)
 
 static void
 zone_proc (void *cls,
-           const struct GNUNET_IDENTITY_PrivateKey *zone_key,
+           const struct GNUNET_CRYPTO_PrivateKey *zone_key,
            const char *name,
            unsigned int rd_count,
            const struct GNUNET_GNSRECORD_Data *rd)
diff --git a/src/namestore/test_namestore_api_monitoring_existing.c 
b/src/namestore/test_namestore_api_monitoring_existing.c
index 87476b309..fe17833c8 100644
--- a/src/namestore/test_namestore_api_monitoring_existing.c
+++ b/src/namestore/test_namestore_api_monitoring_existing.c
@@ -37,9 +37,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
 
 static struct GNUNET_SCHEDULER_Task *endbadly_task;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey;
+static struct GNUNET_CRYPTO_PrivateKey privkey;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey2;
+static struct GNUNET_CRYPTO_PrivateKey privkey2;
 
 static struct GNUNET_NAMESTORE_ZoneMonitor *zm;
 
@@ -128,7 +128,7 @@ end (void *cls)
 
 static void
 zone_proc (void *cls,
-           const struct GNUNET_IDENTITY_PrivateKey *zone_key,
+           const struct GNUNET_CRYPTO_PrivateKey *zone_key,
            const char *name,
            unsigned int rd_count,
            const struct GNUNET_GNSRECORD_Data *rd)
diff --git a/src/namestore/test_namestore_api_remove.c 
b/src/namestore/test_namestore_api_remove.c
index 9c00cdfad..1a4a7c867 100644
--- a/src/namestore/test_namestore_api_remove.c
+++ b/src/namestore/test_namestore_api_remove.c
@@ -38,9 +38,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
 
 static struct GNUNET_SCHEDULER_Task *endbadly_task;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey;
+static struct GNUNET_CRYPTO_PrivateKey privkey;
 
-static struct GNUNET_IDENTITY_PublicKey pubkey;
+static struct GNUNET_CRYPTO_PublicKey pubkey;
 
 static int res;
 
@@ -157,7 +157,7 @@ run (void *cls,
                                                 NULL);
   privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
   GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
-  GNUNET_IDENTITY_key_get_public (&privkey,
+  GNUNET_CRYPTO_key_get_public (&privkey,
                                   &pubkey);
 
   removed = GNUNET_NO;
diff --git a/src/namestore/test_namestore_api_remove_not_existing_record.c 
b/src/namestore/test_namestore_api_remove_not_existing_record.c
index 9a3eabbee..11a69bea1 100644
--- a/src/namestore/test_namestore_api_remove_not_existing_record.c
+++ b/src/namestore/test_namestore_api_remove_not_existing_record.c
@@ -38,9 +38,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
 
 static struct GNUNET_SCHEDULER_Task *endbadly_task;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey;
+static struct GNUNET_CRYPTO_PrivateKey privkey;
 
-static struct GNUNET_IDENTITY_PublicKey pubkey;
+static struct GNUNET_CRYPTO_PublicKey pubkey;
 
 static int res;
 
@@ -132,7 +132,7 @@ run (void *cls,
                                                 NULL);
   privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
   GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
-  GNUNET_IDENTITY_key_get_public (&privkey, &pubkey);
+  GNUNET_CRYPTO_key_get_public (&privkey, &pubkey);
 
   nsh = GNUNET_NAMESTORE_connect (cfg);
   GNUNET_break (NULL != nsh);
diff --git a/src/namestore/test_namestore_api_store.c 
b/src/namestore/test_namestore_api_store.c
index f8a3dd412..22b92fbe5 100644
--- a/src/namestore/test_namestore_api_store.c
+++ b/src/namestore/test_namestore_api_store.c
@@ -38,9 +38,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
 
 static struct GNUNET_SCHEDULER_Task *endbadly_task;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey;
+static struct GNUNET_CRYPTO_PrivateKey privkey;
 
-static struct GNUNET_IDENTITY_PublicKey pubkey;
+static struct GNUNET_CRYPTO_PublicKey pubkey;
 
 static int res;
 
@@ -114,7 +114,7 @@ run (void *cls,
                                                 &endbadly, NULL);
   privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
   GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
-  GNUNET_IDENTITY_key_get_public (&privkey, &pubkey);
+  GNUNET_CRYPTO_key_get_public (&privkey, &pubkey);
 
 
   rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us;
diff --git a/src/namestore/test_namestore_api_store_update.c 
b/src/namestore/test_namestore_api_store_update.c
index 9baa4becd..86495e261 100644
--- a/src/namestore/test_namestore_api_store_update.c
+++ b/src/namestore/test_namestore_api_store_update.c
@@ -44,9 +44,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
 
 static struct GNUNET_SCHEDULER_Task *endbadly_task;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey;
+static struct GNUNET_CRYPTO_PrivateKey privkey;
 
-static struct GNUNET_IDENTITY_PublicKey pubkey;
+static struct GNUNET_CRYPTO_PublicKey pubkey;
 
 static int res;
 
@@ -100,7 +100,7 @@ put_cont (void *cls,
 
 static void
 lookup_success (void *cls,
-                const struct GNUNET_IDENTITY_PrivateKey *zone,
+                const struct GNUNET_CRYPTO_PrivateKey *zone,
                 const char* label,
                 unsigned int rd_count,
                 const struct GNUNET_GNSRECORD_Data *rd)
@@ -210,7 +210,7 @@ run (void *cls,
   memset (&privkey, 0, sizeof (privkey));
   privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
   GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
-  GNUNET_IDENTITY_key_get_public (&privkey, &pubkey);
+  GNUNET_CRYPTO_key_get_public (&privkey, &pubkey);
   rd.flags = GNUNET_GNSRECORD_RF_NONE;
   rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 1000000000;
   rd.record_type = TEST_RECORD_TYPE;
diff --git a/src/namestore/test_namestore_api_tx_rollback.c 
b/src/namestore/test_namestore_api_tx_rollback.c
index 1b1d00c96..4a701f60e 100644
--- a/src/namestore/test_namestore_api_tx_rollback.c
+++ b/src/namestore/test_namestore_api_tx_rollback.c
@@ -38,9 +38,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
 
 static struct GNUNET_SCHEDULER_Task *endbadly_task;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey;
+static struct GNUNET_CRYPTO_PrivateKey privkey;
 
-static struct GNUNET_IDENTITY_PublicKey pubkey;
+static struct GNUNET_CRYPTO_PublicKey pubkey;
 
 static int res;
 
@@ -88,7 +88,7 @@ end (void *cls)
 
 static void
 lookup_it (void *cls,
-           const struct GNUNET_IDENTITY_PrivateKey *zone,
+           const struct GNUNET_CRYPTO_PrivateKey *zone,
            const char *label,
            unsigned int rd_count,
            const struct GNUNET_GNSRECORD_Data *rd)
@@ -173,7 +173,7 @@ begin_cont (void *cls,
   GNUNET_assert (GNUNET_EC_NONE == ec);
   privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
   GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
-  GNUNET_IDENTITY_key_get_public (&privkey,
+  GNUNET_CRYPTO_key_get_public (&privkey,
                                   &pubkey);
 
   removed = GNUNET_NO;
diff --git a/src/namestore/test_namestore_api_zone_iteration.c 
b/src/namestore/test_namestore_api_zone_iteration.c
index f9bf4986b..fb69fffcc 100644
--- a/src/namestore/test_namestore_api_zone_iteration.c
+++ b/src/namestore/test_namestore_api_zone_iteration.c
@@ -36,9 +36,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
 
 static struct GNUNET_SCHEDULER_Task *endbadly_task;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey;
+static struct GNUNET_CRYPTO_PrivateKey privkey;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey2;
+static struct GNUNET_CRYPTO_PrivateKey privkey2;
 
 static struct GNUNET_NAMESTORE_ZoneIterator *zi;
 
@@ -141,7 +141,7 @@ fail_cb (void *cls)
 
 static void
 zone_proc (void *cls,
-           const struct GNUNET_IDENTITY_PrivateKey *zone,
+           const struct GNUNET_CRYPTO_PrivateKey *zone,
            const char *label,
            unsigned int rd_count,
            const struct GNUNET_GNSRECORD_Data *rd)
@@ -329,7 +329,7 @@ create_record (unsigned int count)
  */
 static void
 empty_zone_proc (void *cls,
-                 const struct GNUNET_IDENTITY_PrivateKey *zone,
+                 const struct GNUNET_CRYPTO_PrivateKey *zone,
                  const char *label,
                  unsigned int rd_count,
                  const struct GNUNET_GNSRECORD_Data *rd)
diff --git a/src/namestore/test_namestore_api_zone_iteration_nick.c 
b/src/namestore/test_namestore_api_zone_iteration_nick.c
index 5855b1e87..c494051d0 100644
--- a/src/namestore/test_namestore_api_zone_iteration_nick.c
+++ b/src/namestore/test_namestore_api_zone_iteration_nick.c
@@ -37,9 +37,9 @@
 
 static struct GNUNET_NAMESTORE_Handle *nsh;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey;
+static struct GNUNET_CRYPTO_PrivateKey privkey;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey2;
+static struct GNUNET_CRYPTO_PrivateKey privkey2;
 
 static struct GNUNET_NAMESTORE_ZoneIterator *zi;
 
@@ -152,7 +152,7 @@ zone_proc_end (void *cls)
 
 static void
 zone_proc (void *cls,
-           const struct GNUNET_IDENTITY_PrivateKey *zone,
+           const struct GNUNET_CRYPTO_PrivateKey *zone,
            const char *label,
            unsigned int rd_count,
            const struct GNUNET_GNSRECORD_Data *rd)
@@ -342,7 +342,7 @@ nick_1_cont (void *cls, enum GNUNET_ErrorCode ec)
  */
 static void
 empty_zone_proc (void *cls,
-                 const struct GNUNET_IDENTITY_PrivateKey *zone,
+                 const struct GNUNET_CRYPTO_PrivateKey *zone,
                  const char *label,
                  unsigned int rd_count,
                  const struct GNUNET_GNSRECORD_Data *rd)
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c 
b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
index 519383169..02587706c 100644
--- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
+++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
@@ -37,9 +37,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
 
 static struct GNUNET_SCHEDULER_Task *endbadly_task;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey;
+static struct GNUNET_CRYPTO_PrivateKey privkey;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey2;
+static struct GNUNET_CRYPTO_PrivateKey privkey2;
 
 static struct GNUNET_NAMESTORE_ZoneIterator *zi;
 
@@ -123,7 +123,7 @@ fail_cb (void *cls)
 
 static void
 zone_proc (void *cls,
-           const struct GNUNET_IDENTITY_PrivateKey *zone,
+           const struct GNUNET_CRYPTO_PrivateKey *zone,
            const char *label,
            unsigned int rd_count,
            const struct GNUNET_GNSRECORD_Data *rd)
@@ -307,7 +307,7 @@ create_record (unsigned int count)
  */
 static void
 empty_zone_proc (void *cls,
-                 const struct GNUNET_IDENTITY_PrivateKey *zone,
+                 const struct GNUNET_CRYPTO_PrivateKey *zone,
                  const char *label,
                  unsigned int rd_count,
                  const struct GNUNET_GNSRECORD_Data *rd)
diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c 
b/src/namestore/test_namestore_api_zone_iteration_stop.c
index 4fe86301c..b6b0787ef 100644
--- a/src/namestore/test_namestore_api_zone_iteration_stop.c
+++ b/src/namestore/test_namestore_api_zone_iteration_stop.c
@@ -33,9 +33,9 @@
 
 static struct GNUNET_NAMESTORE_Handle *nsh;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey;
+static struct GNUNET_CRYPTO_PrivateKey privkey;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey2;
+static struct GNUNET_CRYPTO_PrivateKey privkey2;
 
 static struct GNUNET_NAMESTORE_ZoneIterator *zi;
 
@@ -111,7 +111,7 @@ fail_cb (void *cls)
 
 static void
 zone_proc (void *cls,
-           const struct GNUNET_IDENTITY_PrivateKey *zone,
+           const struct GNUNET_CRYPTO_PrivateKey *zone,
            const char *label,
            unsigned int rd_count,
            const struct GNUNET_GNSRECORD_Data *rd)
@@ -317,7 +317,7 @@ create_record (unsigned int count)
  */
 static void
 empty_zone_proc (void *cls,
-                 const struct GNUNET_IDENTITY_PrivateKey *zone,
+                 const struct GNUNET_CRYPTO_PrivateKey *zone,
                  const char *label,
                  unsigned int rd_count,
                  const struct GNUNET_GNSRECORD_Data *rd)
diff --git a/src/namestore/test_namestore_api_zone_to_name.c 
b/src/namestore/test_namestore_api_zone_to_name.c
index a99b7bc71..c70eef53a 100644
--- a/src/namestore/test_namestore_api_zone_to_name.c
+++ b/src/namestore/test_namestore_api_zone_to_name.c
@@ -41,11 +41,11 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
 
 static struct GNUNET_SCHEDULER_Task *endbadly_task;
 
-static struct GNUNET_IDENTITY_PrivateKey privkey;
+static struct GNUNET_CRYPTO_PrivateKey privkey;
 
-static struct GNUNET_IDENTITY_PublicKey pubkey;
+static struct GNUNET_CRYPTO_PublicKey pubkey;
 
-static struct GNUNET_IDENTITY_PublicKey s_zone_value;
+static struct GNUNET_CRYPTO_PublicKey s_zone_value;
 
 static char *s_name;
 
@@ -91,7 +91,7 @@ end (void *cls)
 
 static void
 zone_to_name_proc (void *cls,
-                   const struct GNUNET_IDENTITY_PrivateKey *zone_key,
+                   const struct GNUNET_CRYPTO_PrivateKey *zone_key,
                    const char *n,
                    unsigned int rd_count,
                    const struct GNUNET_GNSRECORD_Data *rd)
@@ -205,7 +205,7 @@ run (void *cls,
   privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
   GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
   /* get public key */
-  GNUNET_IDENTITY_key_get_public (&privkey,
+  GNUNET_CRYPTO_key_get_public (&privkey,
                                   &pubkey);
 
   GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
diff --git a/src/namestore/test_plugin_namestore.c 
b/src/namestore/test_plugin_namestore.c
index d82a3d349..388b23f57 100644
--- a/src/namestore/test_plugin_namestore.c
+++ b/src/namestore/test_plugin_namestore.c
@@ -98,14 +98,14 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg)
 static void
 test_record (void *cls,
              uint64_t seq,
-             const struct GNUNET_IDENTITY_PrivateKey *private_key,
+             const struct GNUNET_CRYPTO_PrivateKey *private_key,
              const char *label,
              unsigned int rd_count,
              const struct GNUNET_GNSRECORD_Data *rd)
 {
   int *idp = cls;
   int id = *idp;
-  struct GNUNET_IDENTITY_PrivateKey tzone_private_key;
+  struct GNUNET_CRYPTO_PrivateKey tzone_private_key;
   char tname[64];
   unsigned int trd_count = 1 + (id % 1024);
 
@@ -136,7 +136,7 @@ get_record (struct GNUNET_NAMESTORE_PluginFunctions *nsp, 
int id)
 static void
 put_record (struct GNUNET_NAMESTORE_PluginFunctions *nsp, int id)
 {
-  struct GNUNET_IDENTITY_PrivateKey zone_private_key;
+  struct GNUNET_CRYPTO_PrivateKey zone_private_key;
   char label[64];
   unsigned int rd_count = 1 + (id % 1024);
   struct GNUNET_GNSRECORD_Data rd[GNUNET_NZL (rd_count)];
diff --git a/src/nat-auto/Makefile.am b/src/nat-auto/Makefile.am
index 48ea93d9f..0ca5da4dc 100644
--- a/src/nat-auto/Makefile.am
+++ b/src/nat-auto/Makefile.am
@@ -19,7 +19,7 @@ gnunet_nat_server_SOURCES = \
  gnunet-nat-server.c nat-auto.h
 gnunet_nat_server_LDADD = \
   $(top_builddir)/src/nat/libgnunetnatnew.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 gnunet_nat_server_LDFLAGS = \
   $(GN_LIBINTL)
 
@@ -27,7 +27,7 @@ gnunet_nat_auto_SOURCES = \
   gnunet-nat-auto.c nat-auto.h
 gnunet_nat_auto_LDADD = \
   libgnunetnatauto.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 gnunet_nat_auto_LDFLAGS = \
   $(GN_LIBINTL)
 
@@ -43,7 +43,7 @@ libgnunetnatauto_la_SOURCES = \
   nat_auto_api_test.c
 libgnunetnatauto_la_LIBADD = \
   $(top_builddir)/src/nat/libgnunetnatnew.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL) @EXT_LIBS@
 libgnunetnatauto_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)  \
@@ -52,7 +52,7 @@ libgnunetnatauto_la_LDFLAGS = \
 gnunet_service_nat_auto_SOURCES = \
  gnunet-service-nat-auto.c
 gnunet_service_nat_auto_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/nat/libgnunetnatnew.la \
   $(LIBGCRYPT_LIBS) \
diff --git a/src/nat/Makefile.am b/src/nat/Makefile.am
index 3eea5e2a4..78ba9b92c 100644
--- a/src/nat/Makefile.am
+++ b/src/nat/Makefile.am
@@ -41,7 +41,7 @@ gnunet_nat_SOURCES = \
   gnunet-nat.c nat.h
 gnunet_nat_LDADD = \
   libgnunetnatnew.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 gnunet_nat_LDFLAGS = \
   $(GN_LIBINTL)
 
@@ -58,7 +58,7 @@ libgnunetnatnew_la_SOURCES = \
   nat_api_stun.c nat_stun.h \
   nat.h
 libgnunetnatnew_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL) @EXT_LIBS@
 libgnunetnatnew_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)  \
@@ -71,7 +71,7 @@ gnunet_service_nat_SOURCES = \
  gnunet-service-nat_mini.c gnunet-service-nat_mini.h \
  gnunet-service-nat_helper.c gnunet-service-nat_helper.h
 gnunet_service_nat_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(LIBGCRYPT_LIBS) \
   -lgcrypt \
@@ -92,25 +92,25 @@ endif
 #  test_nat.c
 #test_nat_LDADD = \
 # libgnunetnat.la \
-# $(top_builddir)/src/util/libgnunetutil.la
+# $(top_builddir)/src/lib/util/libgnunetutil.la
 
 #test_nat_mini_SOURCES = \
 #  test_nat_mini.c
 #test_nat_mini_LDADD = \
 # libgnunetnat.la \
-# $(top_builddir)/src/util/libgnunetutil.la
+# $(top_builddir)/src/lib/util/libgnunetutil.la
 
 #test_nat_test_SOURCES = \
 #  test_nat_test.c
 #test_nat_test_LDADD = \
 # libgnunetnat.la \
-# $(top_builddir)/src/util/libgnunetutil.la
+# $(top_builddir)/src/lib/util/libgnunetutil.la
 
 #test_stun_SOURCES = \
 #  test_stun.c
 #test_stun_LDADD = \
 # libgnunetnat.la \
-# $(top_builddir)/src/util/libgnunetutil.la
+# $(top_builddir)/src/lib/util/libgnunetutil.la
 
 EXTRA_DIST = \
  test_nat_data.conf \
diff --git a/src/nse/Makefile.am b/src/nse/Makefile.am
index 460e68e02..a6f2b8b36 100644
--- a/src/nse/Makefile.am
+++ b/src/nse/Makefile.am
@@ -18,7 +18,7 @@ bin_PROGRAMS = gnunet-nse
 gnunet_nse_SOURCES = gnunet-nse.c
 gnunet_nse_LDADD = \
   libgnunetnse.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(XLIB) $(GN_LIBINTL)
 
 lib_LTLIBRARIES = libgnunetnse.la
@@ -26,7 +26,7 @@ lib_LTLIBRARIES = libgnunetnse.la
 libgnunetnse_la_SOURCES = \
   nse_api.c nse.h
 libgnunetnse_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL) $(XLIB)
 libgnunetnse_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)   \
@@ -44,7 +44,7 @@ libexec_PROGRAMS = \
 # gnunet-nse-profiler.c
 #gnunet_nse_profiler_LDADD = -lm \
 #  libgnunetnse.la \
-#  $(top_builddir)/src/util/libgnunetutil.la \
+#  $(top_builddir)/src/lib/util/libgnunetutil.la \
 #  $(top_builddir)/src/statistics/libgnunetstatistics.la \
 #  $(top_builddir)/src/testing/libgnunettesting.la \
 #  $(top_builddir)/src/testbed/libgnunettestbed.la \
@@ -54,7 +54,7 @@ gnunet_service_nse_SOURCES = \
  gnunet-service-nse.c
 gnunet_service_nse_LDADD = \
   libgnunetnse.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(LIBGCRYPT_LIBS) \
@@ -85,20 +85,20 @@ test_nse_api_SOURCES = \
 test_nse_api_LDADD = \
   libgnunetnse.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_nse_multipeer_SOURCES = \
  test_nse_multipeer.c
 test_nse_multipeer_LDADD = \
   libgnunetnse.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/testbed/libgnunettestbed.la \
   -lm
 
 perf_kdf_SOURCES = \
  perf_kdf.c
 perf_kdf_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LIBGCRYPT_LIBS) \
   -lgcrypt
 
diff --git a/src/peerstore/Makefile.am b/src/peerstore/Makefile.am
index 7220492f2..e9835eb31 100644
--- a/src/peerstore/Makefile.am
+++ b/src/peerstore/Makefile.am
@@ -27,7 +27,7 @@ lib_LTLIBRARIES = \
 gnunet_peerstore_SOURCES = \
  gnunet-peerstore.c
 gnunet_peerstore_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   libgnunetpeerstore.la \
   $(GN_LIBINTL)
 
@@ -37,16 +37,16 @@ gnunet_service_peerstore_SOURCES = \
  peerstore.h
 gnunet_service_peerstore_CFLAGS = $(AM_CFLAGS)
 gnunet_service_peerstore_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/hello/libgnunethello.la \
   $(GN_LIBINTL)
 
 libgnunetpeerstore_la_SOURCES = \
   peerstore_api.c \
   peerstore_common.c
 libgnunetpeerstore_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/hello/libgnunethello.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/hello/libgnunethello.la
 libgnunetpeerstore_la_LDFLAGS = \
   $(GN_LIBINTL) \
   $(GN_LIB_LDFLAGS)
@@ -58,7 +58,7 @@ libgnunet_plugin_peerstore_flat_la_SOURCES = \
   plugin_peerstore_flat.c
 libgnunet_plugin_peerstore_flat_la_LIBADD = \
   libgnunetpeerstore.la  \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \
   $(LTLIBINTL)
 libgnunet_plugin_peerstore_flat_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -72,7 +72,7 @@ libgnunet_plugin_peerstore_sqlite_la_SOURCES = \
 libgnunet_plugin_peerstore_sqlite_la_LIBADD = \
   libgnunetpeerstore.la  \
   $(top_builddir)/src/sq/libgnunetsq.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(XLIBS) -lsqlite3 \
   $(LTLIBINTL)
 libgnunet_plugin_peerstore_sqlite_la_LDFLAGS = \
@@ -87,13 +87,13 @@ test_plugin_peerstore_sqlite_SOURCES = \
   test_plugin_peerstore.c
 test_plugin_peerstore_sqlite_LDADD = \
        $(top_builddir)/src/testing/libgnunettesting.la \
-       $(top_builddir)/src/util/libgnunetutil.la
+       $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_plugin_peerstore_flat_SOURCES = \
   test_plugin_peerstore.c
 test_plugin_peerstore_flat_LDADD = \
        $(top_builddir)/src/testing/libgnunettesting.la \
-       $(top_builddir)/src/util/libgnunetutil.la
+       $(top_builddir)/src/lib/util/libgnunetutil.la
 
 check_PROGRAMS = \
  test_peerstore_api_store \
@@ -119,32 +119,32 @@ test_peerstore_api_store_SOURCES = \
 test_peerstore_api_store_LDADD = \
   libgnunetpeerstore.la  \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_peerstore_api_iterate_SOURCES = \
  test_peerstore_api_iterate.c
 test_peerstore_api_iterate_LDADD = \
   libgnunetpeerstore.la  \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_peerstore_api_watch_SOURCES = \
  test_peerstore_api_watch.c
 test_peerstore_api_watch_LDADD = \
   libgnunetpeerstore.la  \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_peerstore_api_sync_SOURCES = \
  test_peerstore_api_sync.c
 test_peerstore_api_sync_LDADD = \
   libgnunetpeerstore.la  \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 perf_peerstore_store_SOURCES = \
  perf_peerstore_store.c
 perf_peerstore_store_LDADD = \
   libgnunetpeerstore.la  \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
diff --git a/src/plugin/Makefile.am b/src/plugin/Makefile.am
new file mode 100644
index 000000000..c3e06bca8
--- /dev/null
+++ b/src/plugin/Makefile.am
@@ -0,0 +1,3 @@
+SUBDIRS = \
+       block \
+       gnsrecord
diff --git a/src/block/Makefile.am b/src/plugin/block/Makefile.am
similarity index 51%
rename from src/block/Makefile.am
rename to src/plugin/block/Makefile.am
index ea796bf8f..9b72e4e3c 100644
--- a/src/block/Makefile.am
+++ b/src/plugin/block/Makefile.am
@@ -7,10 +7,6 @@ if USE_COVERAGE
   AM_CFLAGS = --coverage
 endif
 
-lib_LTLIBRARIES = \
-  libgnunetblock.la \
-  libgnunetblockgroup.la
-
 plugin_LTLIBRARIES = \
   libgnunet_plugin_block_test.la
 
@@ -22,9 +18,9 @@ noinst_LTLIBRARIES = \
 libgnunet_plugin_block_template_la_SOURCES = \
   plugin_block_template.c
 libgnunet_plugin_block_template_la_LIBADD = \
-  libgnunetblockgroup.la \
-  libgnunetblock.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/block/libgnunetblockgroup.la \
+  $(top_builddir)/src/lib/block/libgnunetblock.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunet_plugin_block_template_la_LDFLAGS = \
   $(GN_PLUGIN_LDFLAGS)
@@ -32,28 +28,10 @@ libgnunet_plugin_block_template_la_LDFLAGS = \
 libgnunet_plugin_block_test_la_SOURCES = \
   plugin_block_test.c
 libgnunet_plugin_block_test_la_LIBADD = \
-  libgnunetblockgroup.la \
-  libgnunetblock.la \
-  $(top_builddir)/src/util/libgnunetutil.la  \
+  $(top_builddir)/src/lib/block/libgnunetblockgroup.la \
+  $(top_builddir)/src/lib/block/libgnunetblock.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la  \
   $(LTLIBINTL)
 libgnunet_plugin_block_test_la_LDFLAGS = \
   $(GN_PLUGIN_LDFLAGS)
 
-libgnunetblock_la_SOURCES = \
-  block.c
-libgnunetblock_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la
-libgnunetblock_la_LDFLAGS = \
-  $(GN_LIB_LDFLAGS) \
-  $(GN_LIBINTL) \
-  -version-info 0:0:0
-
-libgnunetblockgroup_la_SOURCES = \
-  bg_bf.c
-libgnunetblockgroup_la_LIBADD = \
-  libgnunetblock.la \
-  $(top_builddir)/src/util/libgnunetutil.la
-libgnunetblockgroup_la_LDFLAGS = \
-  $(GN_LIB_LDFLAGS) \
-  $(GN_LIBINTL) \
-  -version-info 0:0:0
diff --git a/src/block/plugin_block_template.c 
b/src/plugin/block/plugin_block_template.c
similarity index 100%
rename from src/block/plugin_block_template.c
rename to src/plugin/block/plugin_block_template.c
diff --git a/src/block/plugin_block_test.c 
b/src/plugin/block/plugin_block_test.c
similarity index 100%
rename from src/block/plugin_block_test.c
rename to src/plugin/block/plugin_block_test.c
diff --git a/src/plugin/gnsrecord/Makefile.am b/src/plugin/gnsrecord/Makefile.am
new file mode 100644
index 000000000..1b008cf62
--- /dev/null
+++ b/src/plugin/gnsrecord/Makefile.am
@@ -0,0 +1,25 @@
+# This Makefile.am is in the public domain
+AM_CPPFLAGS = -I$(top_srcdir)/src/include ${MHD_CFLAGS}
+
+plugindir = $(libdir)/gnunet
+
+pkgcfgdir= $(pkgdatadir)/config.d/
+
+libexecdir= $(pkglibdir)/libexec/
+
+if USE_COVERAGE
+  AM_CFLAGS = --coverage -O0
+  XLIBS = -lgcov
+endif
+
+plugin_LTLIBRARIES = \
+  libgnunet_plugin_gnsrecord_dns.la
+
+
+libgnunet_plugin_gnsrecord_dns_la_SOURCES = \
+  plugin_gnsrecord_dns.c
+libgnunet_plugin_gnsrecord_dns_la_LIBADD = \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(LTLIBINTL)
+libgnunet_plugin_gnsrecord_dns_la_LDFLAGS = \
+ $(GN_PLUGIN_LDFLAGS)
diff --git a/src/gnsrecord/plugin_gnsrecord_dns.c 
b/src/plugin/gnsrecord/plugin_gnsrecord_dns.c
similarity index 100%
rename from src/gnsrecord/plugin_gnsrecord_dns.c
rename to src/plugin/gnsrecord/plugin_gnsrecord_dns.c
diff --git a/src/pq/Makefile.am b/src/pq/Makefile.am
index c91f874f7..6a42499ca 100644
--- a/src/pq/Makefile.am
+++ b/src/pq/Makefile.am
@@ -28,7 +28,7 @@ libgnunetpq_la_SOURCES = \
   pq_query_helper.c \
   pq_result_helper.c
 libgnunetpq_la_LIBADD = -lpq \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 libgnunetpq_la_LDFLAGS = \
  $(POSTGRESQL_LDFLAGS) \
  $(GN_LIB_LDFLAGS) \
@@ -47,5 +47,5 @@ test_pq_SOURCES = \
   test_pq.c
 test_pq_LDADD = \
   libgnunetpq.la \
-  $(top_builddir)/src/util/libgnunetutil.la  \
+  $(top_builddir)/src/lib/util/libgnunetutil.la  \
   -lpq $(XLIB)
diff --git a/src/pt/Makefile.am b/src/pt/Makefile.am
index f4202457d..c2d2ae505 100644
--- a/src/pt/Makefile.am
+++ b/src/pt/Makefile.am
@@ -25,7 +25,7 @@ gnunet_daemon_pt_LDADD = \
   $(top_builddir)/src/dht/libgnunetdht.la \
   $(top_builddir)/src/dns/libgnunetdns.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 if LINUX
@@ -55,9 +55,9 @@ test_gns_vpn_SOURCES = \
 test_gns_vpn_LDADD = $(MHD_LIBS) @LIBCURL@ \
  $(top_builddir)/src/namestore/libgnunetnamestore.la \
  $(top_builddir)/src/identity/libgnunetidentity.la \
- $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+ $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 test_gns_vpn_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS)
 
 test_gnunet_vpn_4_over_SOURCES = \
@@ -65,7 +65,7 @@ test_gnunet_vpn_4_over_SOURCES = \
 test_gnunet_vpn_4_over_LDADD = $(MHD_LIBS) @LIBCURL@ \
  $(top_builddir)/src/vpn/libgnunetvpn.la \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 test_gnunet_vpn_4_over_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS)
 
 test_gnunet_vpn_6_over_SOURCES = \
@@ -73,7 +73,7 @@ test_gnunet_vpn_6_over_SOURCES = \
 test_gnunet_vpn_6_over_LDADD = $(MHD_LIBS) @LIBCURL@ \
  $(top_builddir)/src/vpn/libgnunetvpn.la \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 test_gnunet_vpn_6_over_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS)
 
 test_gnunet_vpn_4_to_6_SOURCES = \
@@ -81,7 +81,7 @@ test_gnunet_vpn_4_to_6_SOURCES = \
 test_gnunet_vpn_4_to_6_LDADD = $(MHD_LIBS) @LIBCURL@ \
  $(top_builddir)/src/vpn/libgnunetvpn.la \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 test_gnunet_vpn_4_to_6_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS)
 
 test_gnunet_vpn_6_to_4_SOURCES = \
@@ -89,5 +89,5 @@ test_gnunet_vpn_6_to_4_SOURCES = \
 test_gnunet_vpn_6_to_4_LDADD = $(MHD_LIBS) @LIBCURL@ \
  $(top_builddir)/src/vpn/libgnunetvpn.la \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 test_gnunet_vpn_6_to_4_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS)
diff --git a/src/pt/test_gns_vpn.c b/src/pt/test_gns_vpn.c
index b2797bc83..4db7bf274 100644
--- a/src/pt/test_gns_vpn.c
+++ b/src/pt/test_gns_vpn.c
@@ -557,7 +557,7 @@ identity_cb (void *cls,
              void **ctx,
              const char *name)
 {
-  const struct GNUNET_IDENTITY_PrivateKey *zone_key;
+  const struct GNUNET_CRYPTO_PrivateKey *zone_key;
   struct GNUNET_GNSRECORD_Data rd;
   char *rd_string;
   char *peername;
diff --git a/src/reclaim/Makefile.am b/src/reclaim/Makefile.am
index 4c84a8efc..ac3332ecf 100644
--- a/src/reclaim/Makefile.am
+++ b/src/reclaim/Makefile.am
@@ -61,10 +61,10 @@ libgnunet_plugin_rest_reclaim_la_LIBADD = \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   libgnunetreclaim.la \
   $(top_builddir)/src/json/libgnunetjson.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/rest/libgnunetrest.la \
   $(top_builddir)/src/namestore/libgnunetnamestore.la \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \
   $(LTLIBINTL) -ljansson $(MHD_LIBS)
 libgnunet_plugin_rest_reclaim_la_LDFLAGS = \
   $(GN_PLUGIN_LDFLAGS)
@@ -81,8 +81,8 @@ libgnunet_plugin_rest_openid_connect_la_LIBADD = \
   $(top_builddir)/src/rest/libgnunetrest.la \
   $(top_builddir)/src/namestore/libgnunetnamestore.la \
   $(top_builddir)/src/gns/libgnunetgns.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \
   $(LTLIBINTL) -ljansson -ljose $(MHD_LIBS) \
        $(LIBGCRYPT_LIBS)
 libgnunet_plugin_rest_openid_connect_la_LDFLAGS = \
@@ -98,7 +98,7 @@ libgnunet_plugin_rest_pabc_la_LIBADD = \
   libgnunetreclaim.la \
   $(top_builddir)/src/json/libgnunetjson.la \
   $(top_builddir)/src/rest/libgnunetrest.la \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \
   $(LTLIBINTL) -ljansson -lpabc $(MHD_LIBS)
 libgnunet_plugin_rest_pabc_la_LDFLAGS = \
   $(GN_PLUGIN_LDFLAGS)
@@ -109,7 +109,7 @@ endif
 libgnunet_plugin_gnsrecord_reclaim_la_SOURCES = \
   plugin_gnsrecord_reclaim.c
 libgnunet_plugin_gnsrecord_reclaim_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunet_plugin_gnsrecord_reclaim_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -120,9 +120,9 @@ gnunet_service_reclaim_SOURCES = \
  gnunet-service-reclaim_tickets.c \
  gnunet-service-reclaim_tickets.h
 gnunet_service_reclaim_LDADD = \
- $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+ $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
  $(top_builddir)/src/identity/libgnunetidentity.la \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(top_builddir)/src/namestore/libgnunetnamestore.la \
  $(top_builddir)/src/statistics/libgnunetstatistics.la \
  libgnunetreclaim.la \
@@ -137,7 +137,7 @@ libgnunetreclaim_la_SOURCES = \
  reclaim_credential.c \
  reclaim_credential.h
 libgnunetreclaim_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(GN_LIBINTL) $(XLIB)
 libgnunetreclaim_la_LDFLAGS = \
@@ -150,9 +150,9 @@ libgnunetdid_la_SOURCES = \
   did_core.h \
   did_core.c
 libgnunetdid_la_LIBADD = \
-       $(top_builddir)/src/util/libgnunetutil.la \
+       $(top_builddir)/src/lib/util/libgnunetutil.la \
        $(top_builddir)/src/gns/libgnunetgns.la \
-       $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+       $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
        $(top_builddir)/src/identity/libgnunetidentity.la \
        $(top_builddir)/src/namestore/libgnunetnamestore.la \
        -ljansson \
@@ -164,7 +164,7 @@ libgnunetdid_la_LDFLAGS = \
 libgnunet_plugin_reclaim_attribute_basic_la_SOURCES = \
   plugin_reclaim_attribute_basic.c
 libgnunet_plugin_reclaim_attribute_basic_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunet_plugin_reclaim_attribute_basic_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -175,7 +175,7 @@ libgnunet_plugin_reclaim_credential_pabc_la_SOURCES = \
   pabc_helper.c \
        pabc_helper.h
 libgnunet_plugin_reclaim_credential_pabc_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   libgnunetreclaim.la \
   -ljansson\
   -lpabc \
@@ -189,7 +189,7 @@ libgnunet_plugin_reclaim_credential_jwt_la_SOURCES = \
   plugin_reclaim_credential_jwt.c
 libgnunet_plugin_reclaim_credential_jwt_la_LIBADD = \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   libgnunetreclaim.la \
   -ljansson\
   $(LTLIBINTL)
@@ -199,7 +199,7 @@ libgnunet_plugin_reclaim_credential_jwt_la_LDFLAGS = \
 gnunet_reclaim_SOURCES = \
  gnunet-reclaim.c
 gnunet_reclaim_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/namestore/libgnunetnamestore.la \
   libgnunetreclaim.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
@@ -208,16 +208,16 @@ gnunet_reclaim_LDADD = \
 test_reclaim_attribute_SOURCES = \
   test_reclaim_attribute.c
 test_reclaim_attribute_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   libgnunetreclaim.la \
   $(GN_LIBINTL)
 
 gnunet_did_SOURCES = \
        gnunet-did.c
 gnunet_did_LDADD = \
-       $(top_builddir)/src/util/libgnunetutil.la \
+       $(top_builddir)/src/lib/util/libgnunetutil.la \
        $(top_builddir)/src/gns/libgnunetgns.la \
-       $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+       $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
        $(top_builddir)/src/identity/libgnunetidentity.la \
        $(top_builddir)/src/namestore/libgnunetnamestore.la \
   libgnunetdid.la \
@@ -227,9 +227,9 @@ gnunet_did_LDADD = \
 test_did_helper_SOURCES = \
   test_did_helper.c
 test_did_helper_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
        $(top_builddir)/src/gns/libgnunetgns.la \
-       $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+       $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
        $(top_builddir)/src/identity/libgnunetidentity.la \
        $(top_builddir)/src/namestore/libgnunetnamestore.la \
   libgnunetdid.la \
diff --git a/src/reclaim/did.h b/src/reclaim/did.h
index 42f65db26..ab1b65925 100644
--- a/src/reclaim/did.h
+++ b/src/reclaim/did.h
@@ -44,6 +44,6 @@ DID_ego_to_did (struct GNUNET_IDENTITY_Ego *ego);
  */
 enum GNUNET_GenericReturnValue
 DID_public_key_from_did (const char* did,
-                         struct GNUNET_IDENTITY_PublicKey *pk);
+                         struct GNUNET_CRYPTO_PublicKey *pk);
 
 #endif
diff --git a/src/reclaim/did_core.c b/src/reclaim/did_core.c
index 4f2bd5a87..ce3336b91 100644
--- a/src/reclaim/did_core.c
+++ b/src/reclaim/did_core.c
@@ -90,7 +90,7 @@ DID_resolve (const char *did,
              DID_resolve_callback *cont,
              void *cls)
 {
-  struct GNUNET_IDENTITY_PublicKey pkey;
+  struct GNUNET_CRYPTO_PublicKey pkey;
 
   // did, gns_handle and cont must me set
   if ((did == NULL) || (gns_handle == NULL) || (cont == NULL))
@@ -151,13 +151,13 @@ struct DID_create_namestore_lookup_closure
 static void
 DID_create_namestore_lookup_cb (void *cls,
                                 const struct
-                                GNUNET_IDENTITY_PrivateKey *zone,
+                                GNUNET_CRYPTO_PrivateKey *zone,
                                 const char *label,
                                 unsigned int rd_count,
                                 const struct GNUNET_GNSRECORD_Data *rd)
 {
   struct GNUNET_GNSRECORD_Data record_data;
-  struct GNUNET_IDENTITY_PublicKey pkey;
+  struct GNUNET_CRYPTO_PublicKey pkey;
 
   const char *did_document
     = ((struct DID_create_namestore_lookup_closure *) cls)->did_document;
@@ -180,7 +180,7 @@ DID_create_namestore_lookup_cb (void *cls,
   }
   else {
     // Get public key
-    GNUNET_IDENTITY_key_get_public (zone, &pkey);
+    GNUNET_CRYPTO_key_get_public (zone, &pkey);
 
     // If no DID Document is given a default one is created
     if (did_document != NULL)
@@ -225,7 +225,7 @@ DID_create (const struct GNUNET_IDENTITY_Ego *ego,
             DID_action_callback *cont,
             void *cls)
 {
-  struct GNUNET_IDENTITY_PublicKey pkey;
+  struct GNUNET_CRYPTO_PublicKey pkey;
 
   // Ego, namestore_handle and cont must be set
   if ((ego == NULL) || (namestore_handle == NULL) || (cont == NULL))
diff --git a/src/reclaim/did_helper.c b/src/reclaim/did_helper.c
index 17f3b21b2..3aac027ee 100644
--- a/src/reclaim/did_helper.c
+++ b/src/reclaim/did_helper.c
@@ -42,12 +42,12 @@
  * TODO: Check if EdDSA
  */
 char*
-DID_pkey_to_did (struct GNUNET_IDENTITY_PublicKey *pkey)
+DID_pkey_to_did (struct GNUNET_CRYPTO_PublicKey *pkey)
 {
   char *pkey_str;
   char *did_str;
 
-  pkey_str = GNUNET_IDENTITY_public_key_to_string (pkey);
+  pkey_str = GNUNET_CRYPTO_public_key_to_string (pkey);
   GNUNET_asprintf (&did_str, "%s%s",
                    GNUNET_DID_METHOD_PREFIX,
                    pkey_str);
@@ -66,7 +66,7 @@ DID_pkey_to_did (struct GNUNET_IDENTITY_PublicKey *pkey)
 char*
 DID_identity_to_did (struct GNUNET_IDENTITY_Ego *ego)
 {
-  struct GNUNET_IDENTITY_PublicKey pkey;
+  struct GNUNET_CRYPTO_PublicKey pkey;
 
   GNUNET_IDENTITY_ego_get_public_key (ego, &pkey);
   return DID_pkey_to_did (&pkey);
@@ -76,7 +76,7 @@ DID_identity_to_did (struct GNUNET_IDENTITY_Ego *ego)
  * @brief Return the public key of a DID
  */
 enum GNUNET_GenericReturnValue
-DID_did_to_pkey (const char *did, struct GNUNET_IDENTITY_PublicKey *pkey)
+DID_did_to_pkey (const char *did, struct GNUNET_CRYPTO_PublicKey *pkey)
 {
   char pkey_str[MAX_DID_SPECIFIC_IDENTIFIER_LENGTH + 1]; /* 0-term */
 
@@ -84,7 +84,7 @@ DID_did_to_pkey (const char *did, struct 
GNUNET_IDENTITY_PublicKey *pkey)
                      GNUNET_DID_METHOD_PREFIX "%"
                      STR (MAX_DID_SPECIFIC_IDENTIFIER_LENGTH)
                      "s", pkey_str))) ||
-      (GNUNET_OK != GNUNET_IDENTITY_public_key_from_string (pkey_str, pkey)))
+      (GNUNET_OK != GNUNET_CRYPTO_public_key_from_string (pkey_str, pkey)))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Could not decode given DID: %s\n",
                 did);
@@ -97,7 +97,7 @@ DID_did_to_pkey (const char *did, struct 
GNUNET_IDENTITY_PublicKey *pkey)
 /**
  * @brief Convert a base 64 encoded public key to a GNUNET key
  */
-struct GNUNET_IDENTITY_PublicKey *
+struct GNUNET_CRYPTO_PublicKey *
 GNUNET_DID_key_convert_multibase_base64_to_gnunet (char *pkey_str)
 {
   return NULL;
@@ -108,7 +108,7 @@ GNUNET_DID_key_convert_multibase_base64_to_gnunet (char 
*pkey_str)
  */
 char *
 DID_key_convert_gnunet_to_multibase_base64 (struct
-                                           GNUNET_IDENTITY_PublicKey *
+                                           GNUNET_CRYPTO_PublicKey *
                                            pkey)
 {
   struct GNUNET_CRYPTO_EddsaPublicKey pubkey = pkey->eddsa_key;
@@ -135,7 +135,7 @@ DID_key_convert_gnunet_to_multibase_base64 (struct
  * @return void* Return pointer to the DID Document
  */
 char *
-DID_pkey_to_did_document (struct GNUNET_IDENTITY_PublicKey *pkey)
+DID_pkey_to_did_document (struct GNUNET_CRYPTO_PublicKey *pkey)
 {
 
   /* FIXME-MSC: This is effectively creating a DID Document default template 
for
@@ -196,7 +196,7 @@ DID_pkey_to_did_document (struct GNUNET_IDENTITY_PublicKey 
*pkey)
 char *
 DID_identity_to_did_document (struct GNUNET_IDENTITY_Ego *ego)
 {
-  struct GNUNET_IDENTITY_PublicKey pkey;
+  struct GNUNET_CRYPTO_PublicKey pkey;
 
   GNUNET_IDENTITY_ego_get_public_key (ego, &pkey);
   return DID_pkey_to_did (&pkey);
diff --git a/src/reclaim/did_helper.h b/src/reclaim/did_helper.h
index fea86af5e..d61992c68 100644
--- a/src/reclaim/did_helper.h
+++ b/src/reclaim/did_helper.h
@@ -31,7 +31,7 @@
  * @brief Return a DID for a given GNUNET public key
  */
 char *
-DID_pkey_to_did (struct GNUNET_IDENTITY_PublicKey *pkey);
+DID_pkey_to_did (struct GNUNET_CRYPTO_PublicKey *pkey);
 
 /**
  * @brief Generate a DID for a given gnunet EGO
@@ -46,12 +46,12 @@ DID_identity_to_did (struct GNUNET_IDENTITY_Ego *ego);
  * @brief Return the public key of a DID
  */
 enum GNUNET_GenericReturnValue
-DID_did_to_pkey (const char *did, struct GNUNET_IDENTITY_PublicKey *pkey);
+DID_did_to_pkey (const char *did, struct GNUNET_CRYPTO_PublicKey *pkey);
 
 // /**
 //  * @brief Convert a base 64 encoded public key to a GNUNET key
 //  */
-// struct GNUNET_IDENTITY_PublicKey *
+// struct GNUNET_CRYPTO_PublicKey *
 // GNUNET_DID_key_convert_multibase_base64_to_gnunet(char *);
 
 /**
@@ -59,13 +59,13 @@ DID_did_to_pkey (const char *did, struct 
GNUNET_IDENTITY_PublicKey *pkey);
  */
 char *
 DID_key_convert_gnunet_to_multibase_base64 (struct
-                                                  GNUNET_IDENTITY_PublicKey *);
+                                                  GNUNET_CRYPTO_PublicKey *);
 
 /**
  * @brief Generate the default DID document for a GNUNET public key
  */
 char *
-DID_pkey_to_did_document (struct GNUNET_IDENTITY_PublicKey *pkey);
+DID_pkey_to_did_document (struct GNUNET_CRYPTO_PublicKey *pkey);
 
 /**
  * @brief Generate the default DID document for a GNUNET ego
diff --git a/src/reclaim/did_misc.c b/src/reclaim/did_misc.c
index 44b72a69f..32b127b2b 100644
--- a/src/reclaim/did_misc.c
+++ b/src/reclaim/did_misc.c
@@ -33,14 +33,14 @@
 char*
 DID_ego_to_did (struct GNUNET_IDENTITY_Ego *ego)
 {
-  struct GNUNET_IDENTITY_PublicKey pkey; // Get Public key
+  struct GNUNET_CRYPTO_PublicKey pkey; // Get Public key
   char *pkey_str;
   char *did_str;
   size_t pkey_len;
 
   GNUNET_IDENTITY_ego_get_public_key (ego, &pkey);
 
-  pkey_str = GNUNET_IDENTITY_public_key_to_string (&pkey);
+  pkey_str = GNUNET_CRYPTO_public_key_to_string (&pkey);
   GNUNET_asprintf (&did_str, "%s%s",
                    GNUNET_RECLAIM_DID_METHOD_PREFIX,
                    pkey_str);
@@ -51,7 +51,7 @@ DID_ego_to_did (struct GNUNET_IDENTITY_Ego *ego)
 
 enum GNUNET_GenericReturnValue
 DID_public_key_from_did (const char* did,
-                         struct GNUNET_IDENTITY_PublicKey *pk)
+                         struct GNUNET_CRYPTO_PublicKey *pk)
 {
   /* FIXME-MSC: I suggest introducing a
    * #define MAX_DID_LENGTH <something>
@@ -60,7 +60,7 @@ DID_public_key_from_did (const char* did,
   char pkey_str[59];
 
   if ((1 != (sscanf (did, GNUNET_RECLAIM_DID_METHOD_PREFIX"%58s", pkey_str))) 
||
-      (GNUNET_OK != GNUNET_IDENTITY_public_key_from_string (pkey_str, pk)))
+      (GNUNET_OK != GNUNET_CRYPTO_public_key_from_string (pkey_str, pk)))
   {
     return GNUNET_SYSERR;
   }
diff --git a/src/reclaim/gnunet-did.c b/src/reclaim/gnunet-did.c
index 1f91e0ee2..e88a3671e 100644
--- a/src/reclaim/gnunet-did.c
+++ b/src/reclaim/gnunet-did.c
@@ -263,7 +263,7 @@ remove_did_document_namestore_cb (void *cls, enum 
GNUNET_ErrorCode ec)
 static void
 remove_did_document_ego_lookup_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
 {
-  const struct GNUNET_IDENTITY_PrivateKey *skey =
+  const struct GNUNET_CRYPTO_PrivateKey *skey =
     GNUNET_IDENTITY_ego_get_private_key (ego);
 
   GNUNET_NAMESTORE_records_store (namestore_handle,
@@ -335,7 +335,7 @@ create_did_cb (enum GNUNET_GenericReturnValue status, void 
*cls)
  */
 static void
 create_did_ego_create_cb (void *cls,
-                          const struct GNUNET_IDENTITY_PrivateKey *pk,
+                          const struct GNUNET_CRYPTO_PrivateKey *pk,
                           enum GNUNET_ErrorCode ec)
 {
   if (GNUNET_EC_NONE != ec)
@@ -366,7 +366,7 @@ create_did_ego_lockup_cb (void *cls, struct 
GNUNET_IDENTITY_Ego *ego)
     GNUNET_IDENTITY_create (identity_handle,
                             egoname,
                             NULL,
-                            GNUNET_IDENTITY_TYPE_EDDSA,
+                            GNUNET_PUBLIC_KEY_TYPE_EDDSA,
                             &create_did_ego_create_cb,
                             egoname);
   }
diff --git a/src/reclaim/gnunet-reclaim.c b/src/reclaim/gnunet-reclaim.c
index cb8703495..efb2c2902 100644
--- a/src/reclaim/gnunet-reclaim.c
+++ b/src/reclaim/gnunet-reclaim.c
@@ -152,12 +152,12 @@ static struct GNUNET_RECLAIM_TicketIterator 
*ticket_iterator;
 /**
  * ego private key
  */
-static const struct GNUNET_IDENTITY_PrivateKey *pkey;
+static const struct GNUNET_CRYPTO_PrivateKey *pkey;
 
 /**
  * rp public key
  */
-static struct GNUNET_IDENTITY_PublicKey rp_key;
+static struct GNUNET_CRYPTO_PublicKey rp_key;
 
 /**
  * Ticket to consume
@@ -264,7 +264,7 @@ store_cont (void *cls, int32_t success, const char *emsg)
 
 static void
 process_attrs (void *cls,
-               const struct GNUNET_IDENTITY_PublicKey *identity,
+               const struct GNUNET_CRYPTO_PublicKey *identity,
                const struct GNUNET_RECLAIM_Attribute *attr,
                const struct GNUNET_RECLAIM_Presentation *presentation)
 {
@@ -349,7 +349,7 @@ ticket_iter (void *cls, const struct GNUNET_RECLAIM_Ticket 
*ticket)
   aud =
     GNUNET_STRINGS_data_to_string_alloc (&ticket->audience,
                                          sizeof(struct
-                                                GNUNET_IDENTITY_PublicKey));
+                                                GNUNET_CRYPTO_PublicKey));
   ref = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, 
sizeof(ticket->rnd));
   tkt =
     GNUNET_STRINGS_data_to_string_alloc (ticket,
@@ -514,7 +514,7 @@ iter_finished (void *cls)
 
 static void
 iter_cb (void *cls,
-         const struct GNUNET_IDENTITY_PublicKey *identity,
+         const struct GNUNET_CRYPTO_PublicKey *identity,
          const struct GNUNET_RECLAIM_Attribute *attr)
 {
   struct GNUNET_RECLAIM_AttributeListEntry *le;
@@ -657,7 +657,7 @@ cred_iter_finished (void *cls)
 
 static void
 cred_iter_cb (void *cls,
-              const struct GNUNET_IDENTITY_PublicKey *identity,
+              const struct GNUNET_CRYPTO_PublicKey *identity,
               const struct GNUNET_RECLAIM_Credential *cred)
 {
   char *cred_str;
@@ -738,7 +738,7 @@ start_process ()
 
   if ((NULL != rp) &&
       (GNUNET_OK !=
-       GNUNET_IDENTITY_public_key_from_string (rp, &rp_key)) )
+       GNUNET_CRYPTO_public_key_from_string (rp, &rp_key)) )
   {
     fprintf (stderr, "%s is not a public key!\n", rp);
     cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
diff --git a/src/reclaim/gnunet-service-reclaim.c 
b/src/reclaim/gnunet-service-reclaim.c
index 8b468fc8e..47a86a3e8 100644
--- a/src/reclaim/gnunet-service-reclaim.c
+++ b/src/reclaim/gnunet-service-reclaim.c
@@ -110,7 +110,7 @@ struct Iterator
   /**
    * Key of the zone we are iterating over.
    */
-  struct GNUNET_IDENTITY_PrivateKey identity;
+  struct GNUNET_CRYPTO_PrivateKey identity;
 
   /**
    * Namestore iterator
@@ -266,7 +266,7 @@ struct AttributeDeleteHandle
   /**
    * Identity
    */
-  struct GNUNET_IDENTITY_PrivateKey identity;
+  struct GNUNET_CRYPTO_PrivateKey identity;
 
 
   /**
@@ -344,12 +344,12 @@ struct AttributeStoreHandle
   /**
    * Identity
    */
-  struct GNUNET_IDENTITY_PrivateKey identity;
+  struct GNUNET_CRYPTO_PrivateKey identity;
 
   /**
    * Identity pubkey
    */
-  struct GNUNET_IDENTITY_PublicKey identity_pkey;
+  struct GNUNET_CRYPTO_PublicKey identity_pkey;
 
   /**
    * QueueEntry
@@ -771,8 +771,8 @@ handle_issue_ticket_message (void *cls, const struct 
IssueTicketMessage *im)
   struct IdpClient *idp = cls;
   struct GNUNET_RECLAIM_AttributeList *attrs;
   struct GNUNET_RECLAIM_AttributeListEntry *le;
-  struct GNUNET_IDENTITY_PrivateKey identity;
-  struct GNUNET_IDENTITY_PublicKey rp;
+  struct GNUNET_CRYPTO_PrivateKey identity;
+  struct GNUNET_CRYPTO_PublicKey rp;
   size_t attrs_len;
   size_t key_len;
   size_t pkey_len;
@@ -783,7 +783,7 @@ handle_issue_ticket_message (void *cls, const struct 
IssueTicketMessage *im)
   key_len = ntohs (im->key_len);
   buf = (char *) &im[1];
   if ((GNUNET_SYSERR ==
-       GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len,
+       GNUNET_CRYPTO_read_private_key_from_buffer (buf, key_len,
                                                      &identity, &read)) ||
       (read != key_len))
   {
@@ -795,7 +795,7 @@ handle_issue_ticket_message (void *cls, const struct 
IssueTicketMessage *im)
   buf += read;
   pkey_len = ntohs (im->pkey_len);
   if ((GNUNET_SYSERR ==
-       GNUNET_IDENTITY_read_public_key_from_buffer (buf, pkey_len,
+       GNUNET_CRYPTO_read_public_key_from_buffer (buf, pkey_len,
                                                     &rp, &read)) ||
       (read != pkey_len))
   {
@@ -890,7 +890,7 @@ handle_revoke_ticket_message (void *cls, const struct 
RevokeTicketMessage *rm)
 {
   struct TicketRevocationOperation *rop;
   struct IdpClient *idp = cls;
-  struct GNUNET_IDENTITY_PrivateKey identity;
+  struct GNUNET_CRYPTO_PrivateKey identity;
   struct GNUNET_RECLAIM_Ticket ticket;
   size_t key_len;
   size_t tkt_len;
@@ -901,7 +901,7 @@ handle_revoke_ticket_message (void *cls, const struct 
RevokeTicketMessage *rm)
   key_len = ntohs (rm->key_len);
   buf = (char *) &rm[1];
   if ((GNUNET_SYSERR ==
-       GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len,
+       GNUNET_CRYPTO_read_private_key_from_buffer (buf, key_len,
                                                      &identity, &read)) ||
       (read != key_len))
   {
@@ -943,7 +943,7 @@ handle_revoke_ticket_message (void *cls, const struct 
RevokeTicketMessage *rm)
  */
 static void
 consume_result_cb (void *cls,
-                   const struct GNUNET_IDENTITY_PublicKey *identity,
+                   const struct GNUNET_CRYPTO_PublicKey *identity,
                    const struct GNUNET_RECLAIM_AttributeList *attrs,
                    const struct GNUNET_RECLAIM_PresentationList *presentations,
                    int32_t success,
@@ -965,7 +965,7 @@ consume_result_cb (void *cls,
   attrs_len = GNUNET_RECLAIM_attribute_list_serialize_get_size (attrs);
   pres_len = GNUNET_RECLAIM_presentation_list_serialize_get_size (
     presentations);
-  key_len = GNUNET_IDENTITY_public_key_get_length (identity);
+  key_len = GNUNET_CRYPTO_public_key_get_length (identity);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Sending CONSUME_TICKET_RESULT message\n");
   env = GNUNET_MQ_msg_extra (crm,
@@ -977,7 +977,7 @@ consume_result_cb (void *cls,
   crm->key_len = htons (key_len);
   crm->result = htons (success);
   data_tmp = (char *) &crm[1];
-  written = GNUNET_IDENTITY_write_public_key_to_buffer (identity,
+  written = GNUNET_CRYPTO_write_public_key_to_buffer (identity,
                                                         data_tmp,
                                                         key_len);
   GNUNET_assert (0 <= written);
@@ -1025,7 +1025,7 @@ handle_consume_ticket_message (void *cls, const struct 
ConsumeTicketMessage *cm)
 {
   struct ConsumeTicketOperation *cop;
   struct IdpClient *idp = cls;
-  struct GNUNET_IDENTITY_PrivateKey identity;
+  struct GNUNET_CRYPTO_PrivateKey identity;
   struct GNUNET_RECLAIM_Ticket ticket;
   size_t key_len;
   size_t tkt_len;
@@ -1036,7 +1036,7 @@ handle_consume_ticket_message (void *cls, const struct 
ConsumeTicketMessage *cm)
   key_len = ntohs (cm->key_len);
   buf = (char *) &cm[1];
   if ((GNUNET_SYSERR ==
-       GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len,
+       GNUNET_CRYPTO_read_private_key_from_buffer (buf, key_len,
                                                      &identity, &read)) ||
       (read != key_len))
   {
@@ -1188,7 +1188,7 @@ handle_attribute_store_message (void *cls,
 {
   struct AttributeStoreHandle *ash;
   struct IdpClient *idp = cls;
-  struct GNUNET_IDENTITY_PrivateKey identity;
+  struct GNUNET_CRYPTO_PrivateKey identity;
   size_t data_len;
   size_t key_len;
   size_t read;
@@ -1200,7 +1200,7 @@ handle_attribute_store_message (void *cls,
   key_len = ntohs (sam->key_len);
   buf = (char *) &sam[1];
   if ((GNUNET_SYSERR ==
-       GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len,
+       GNUNET_CRYPTO_read_private_key_from_buffer (buf, key_len,
                                                      &identity, &read)) ||
       (read != key_len))
   {
@@ -1218,7 +1218,7 @@ handle_attribute_store_message (void *cls,
   ash->r_id = ntohl (sam->id);
   ash->identity = identity;
   ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
-  GNUNET_IDENTITY_key_get_public (&identity, &ash->identity_pkey);
+  GNUNET_CRYPTO_key_get_public (&identity, &ash->identity_pkey);
 
   GNUNET_SERVICE_client_continue (idp->client);
   ash->client = idp;
@@ -1293,7 +1293,7 @@ cred_error (void *cls)
 */
 static void
 cred_add_cb (void *cls,
-             const struct GNUNET_IDENTITY_PrivateKey *zone,
+             const struct GNUNET_CRYPTO_PrivateKey *zone,
              const char *label,
              unsigned int rd_count,
              const struct GNUNET_GNSRECORD_Data *rd)
@@ -1389,7 +1389,7 @@ handle_credential_store_message (void *cls,
 {
   struct AttributeStoreHandle *ash;
   struct IdpClient *idp = cls;
-  struct GNUNET_IDENTITY_PrivateKey identity;
+  struct GNUNET_CRYPTO_PrivateKey identity;
   size_t data_len;
   size_t key_len;
   size_t read;
@@ -1401,7 +1401,7 @@ handle_credential_store_message (void *cls,
   key_len = ntohs (sam->key_len);
   buf = (char *) &sam[1];
   if ((GNUNET_SYSERR ==
-       GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len,
+       GNUNET_CRYPTO_read_private_key_from_buffer (buf, key_len,
                                                      &identity, &read)) ||
       (read != key_len))
   {
@@ -1418,7 +1418,7 @@ handle_credential_store_message (void *cls,
   ash->r_id = ntohl (sam->id);
   ash->identity = identity;
   ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
-  GNUNET_IDENTITY_key_get_public (&identity, &ash->identity_pkey);
+  GNUNET_CRYPTO_key_get_public (&identity, &ash->identity_pkey);
 
   GNUNET_SERVICE_client_continue (idp->client);
   ash->client = idp;
@@ -1463,7 +1463,7 @@ send_delete_response (struct AttributeDeleteHandle *adh, 
int32_t success)
  */
 static void
 consistency_iter (void *cls,
-                  const struct GNUNET_IDENTITY_PrivateKey *zone,
+                  const struct GNUNET_CRYPTO_PrivateKey *zone,
                   const char *label,
                   unsigned int rd_count,
                   const struct GNUNET_GNSRECORD_Data *rd)
@@ -1860,7 +1860,7 @@ handle_attribute_delete_message (void *cls,
 {
   struct AttributeDeleteHandle *adh;
   struct IdpClient *idp = cls;
-  struct GNUNET_IDENTITY_PrivateKey identity;
+  struct GNUNET_CRYPTO_PrivateKey identity;
   size_t data_len;
   size_t key_len;
   size_t read;
@@ -1872,7 +1872,7 @@ handle_attribute_delete_message (void *cls,
   key_len = ntohs (dam->key_len);
   buf = (char *) &dam[1];
   if ((GNUNET_SYSERR ==
-       GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len,
+       GNUNET_CRYPTO_read_private_key_from_buffer (buf, key_len,
                                                      &identity, &read)) ||
       (read != key_len))
   {
@@ -1967,7 +1967,7 @@ handle_credential_delete_message (void *cls,
 {
   struct AttributeDeleteHandle *adh;
   struct IdpClient *idp = cls;
-  struct GNUNET_IDENTITY_PrivateKey identity;
+  struct GNUNET_CRYPTO_PrivateKey identity;
   size_t data_len;
   size_t key_len;
   size_t read;
@@ -1979,7 +1979,7 @@ handle_credential_delete_message (void *cls,
   key_len = ntohs (dam->key_len);
   buf = (char *) &dam[1];
   if ((GNUNET_SYSERR ==
-       GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len,
+       GNUNET_CRYPTO_read_private_key_from_buffer (buf, key_len,
                                                      &identity, &read)) ||
       (read != key_len))
   {
@@ -2068,14 +2068,14 @@ attr_iter_error (void *cls)
  */
 static void
 attr_iter_cb (void *cls,
-              const struct GNUNET_IDENTITY_PrivateKey *zone,
+              const struct GNUNET_CRYPTO_PrivateKey *zone,
               const char *label,
               unsigned int rd_count,
               const struct GNUNET_GNSRECORD_Data *rd)
 {
   struct Iterator *ai = cls;
   struct GNUNET_MQ_Envelope *env;
-  struct GNUNET_IDENTITY_PublicKey identity;
+  struct GNUNET_CRYPTO_PublicKey identity;
   char *data_tmp;
   size_t key_len;
   ssize_t written;
@@ -2091,8 +2091,8 @@ attr_iter_cb (void *cls,
               label);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Sending ATTRIBUTE_RESULT message\n");
-  GNUNET_IDENTITY_key_get_public (zone, &identity);
-  key_len = GNUNET_IDENTITY_public_key_get_length (&identity);
+  GNUNET_CRYPTO_key_get_public (zone, &identity);
+  key_len = GNUNET_CRYPTO_public_key_get_length (&identity);
   env = GNUNET_MQ_msg_extra (arm,
                              rd->data_size + key_len,
                              GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
@@ -2100,7 +2100,7 @@ attr_iter_cb (void *cls,
   arm->attr_len = htons (rd->data_size);
   data_tmp = (char *) &arm[1];
   arm->pkey_len = htons (key_len);
-  written = GNUNET_IDENTITY_write_public_key_to_buffer (&identity,
+  written = GNUNET_CRYPTO_write_public_key_to_buffer (&identity,
                                                         data_tmp,
                                                         key_len);
   GNUNET_assert (0 <= written);
@@ -2141,7 +2141,7 @@ handle_iteration_start (void *cls,
 {
   struct IdpClient *idp = cls;
   struct Iterator *ai;
-  struct GNUNET_IDENTITY_PrivateKey identity;
+  struct GNUNET_CRYPTO_PrivateKey identity;
   size_t key_len;
   size_t read;
 
@@ -2149,7 +2149,7 @@ handle_iteration_start (void *cls,
               "Received ATTRIBUTE_ITERATION_START message\n");
   key_len = ntohs (ais_msg->key_len);
   if ((GNUNET_SYSERR ==
-       GNUNET_IDENTITY_read_private_key_from_buffer (&ais_msg[1],
+       GNUNET_CRYPTO_read_private_key_from_buffer (&ais_msg[1],
                                                      key_len,
                                                      &identity,
                                                      &read)) ||
@@ -2298,7 +2298,7 @@ cred_iter_error (void *cls)
  */
 static void
 cred_iter_cb (void *cls,
-              const struct GNUNET_IDENTITY_PrivateKey *zone,
+              const struct GNUNET_CRYPTO_PrivateKey *zone,
               const char *label,
               unsigned int rd_count,
               const struct GNUNET_GNSRECORD_Data *rd)
@@ -2306,7 +2306,7 @@ cred_iter_cb (void *cls,
   struct Iterator *ai = cls;
   struct GNUNET_MQ_Envelope *env;
   struct CredentialResultMessage *arm;
-  struct GNUNET_IDENTITY_PublicKey identity;
+  struct GNUNET_CRYPTO_PublicKey identity;
   char *data_tmp;
   size_t key_len;
   ssize_t written;
@@ -2321,8 +2321,8 @@ cred_iter_cb (void *cls,
               label);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Sending CREDENTIAL_RESULT message\n");
-  GNUNET_IDENTITY_key_get_public (zone, &identity);
-  key_len = GNUNET_IDENTITY_public_key_get_length (&identity);
+  GNUNET_CRYPTO_key_get_public (zone, &identity);
+  key_len = GNUNET_CRYPTO_public_key_get_length (&identity);
   env = GNUNET_MQ_msg_extra (arm,
                              rd->data_size + key_len,
                              GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT);
@@ -2330,7 +2330,7 @@ cred_iter_cb (void *cls,
   arm->credential_len = htons (rd->data_size);
   arm->key_len = htons (key_len);
   data_tmp = (char *) &arm[1];
-  written = GNUNET_IDENTITY_write_public_key_to_buffer (&identity,
+  written = GNUNET_CRYPTO_write_public_key_to_buffer (&identity,
                                                         data_tmp,
                                                         key_len);
   GNUNET_assert (written >= 0);
@@ -2372,7 +2372,7 @@ handle_credential_iteration_start (void *cls,
 {
   struct IdpClient *idp = cls;
   struct Iterator *ai;
-  struct GNUNET_IDENTITY_PrivateKey identity;
+  struct GNUNET_CRYPTO_PrivateKey identity;
   size_t key_len;
   size_t read;
 
@@ -2380,7 +2380,7 @@ handle_credential_iteration_start (void *cls,
               "Received CREDENTIAL_ITERATION_START message\n");
   key_len = ntohs (ais_msg->key_len);
   if ((GNUNET_SYSERR ==
-       GNUNET_IDENTITY_read_private_key_from_buffer (&ais_msg[1],
+       GNUNET_CRYPTO_read_private_key_from_buffer (&ais_msg[1],
                                                      key_len,
                                                      &identity,
                                                      &read)) ||
@@ -2554,7 +2554,7 @@ handle_ticket_iteration_start (
   void *cls,
   const struct TicketIterationStartMessage *tis_msg)
 {
-  struct GNUNET_IDENTITY_PrivateKey identity;
+  struct GNUNET_CRYPTO_PrivateKey identity;
   struct IdpClient *client = cls;
   struct TicketIteration *ti;
   size_t key_len;
@@ -2564,7 +2564,7 @@ handle_ticket_iteration_start (
               "Received TICKET_ITERATION_START message\n");
   key_len = ntohs (tis_msg->key_len);
   if ((GNUNET_SYSERR ==
-       GNUNET_IDENTITY_read_private_key_from_buffer (&tis_msg[1],
+       GNUNET_CRYPTO_read_private_key_from_buffer (&tis_msg[1],
                                                      key_len,
                                                      &identity,
                                                      &read)) ||
diff --git a/src/reclaim/gnunet-service-reclaim_tickets.c 
b/src/reclaim/gnunet-service-reclaim_tickets.c
index 0c2fadd96..689fbc429 100644
--- a/src/reclaim/gnunet-service-reclaim_tickets.c
+++ b/src/reclaim/gnunet-service-reclaim_tickets.c
@@ -87,12 +87,12 @@ struct RECLAIM_TICKETS_ConsumeHandle
   /**
    * Audience Key
    */
-  struct GNUNET_IDENTITY_PrivateKey identity;
+  struct GNUNET_CRYPTO_PrivateKey identity;
 
   /**
    * Audience Key
    */
-  struct GNUNET_IDENTITY_PublicKey identity_pub;
+  struct GNUNET_CRYPTO_PublicKey identity_pub;
 
   /**
    * Lookup DLL
@@ -181,7 +181,7 @@ struct TicketIssueHandle
   /**
    * Issuer Key
    */
-  struct GNUNET_IDENTITY_PrivateKey identity;
+  struct GNUNET_CRYPTO_PrivateKey identity;
 
   /**
    * Ticket to issue
@@ -264,7 +264,7 @@ struct RECLAIM_TICKETS_RevokeHandle
   /**
    * Issuer Key
    */
-  struct GNUNET_IDENTITY_PrivateKey identity;
+  struct GNUNET_CRYPTO_PrivateKey identity;
 
   /**
    * Callback
@@ -491,7 +491,7 @@ rvk_ticket_update_finished (void *cls)
  */
 static void
 rvk_ticket_update (void *cls,
-                   const struct GNUNET_IDENTITY_PrivateKey *zone,
+                   const struct GNUNET_CRYPTO_PrivateKey *zone,
                    const char *label,
                    unsigned int rd_count,
                    const struct GNUNET_GNSRECORD_Data *rd)
@@ -667,7 +667,7 @@ move_attr_finished (void *cls, enum GNUNET_ErrorCode ec)
  */
 static void
 rvk_move_attr_cb (void *cls,
-                  const struct GNUNET_IDENTITY_PrivateKey *zone,
+                  const struct GNUNET_CRYPTO_PrivateKey *zone,
                   const char *label,
                   unsigned int rd_count,
                   const struct GNUNET_GNSRECORD_Data *rd)
@@ -845,7 +845,7 @@ remove_ticket_cont (void *cls, enum GNUNET_ErrorCode ec)
  */
 static void
 revoke_attrs_cb (void *cls,
-                 const struct GNUNET_IDENTITY_PrivateKey *zone,
+                 const struct GNUNET_CRYPTO_PrivateKey *zone,
                  const char *label,
                  unsigned int rd_count,
                  const struct GNUNET_GNSRECORD_Data *rd)
@@ -908,7 +908,7 @@ rvk_attrs_err_cb (void *cls)
  */
 struct RECLAIM_TICKETS_RevokeHandle *
 RECLAIM_TICKETS_revoke (const struct GNUNET_RECLAIM_Ticket *ticket,
-                        const struct GNUNET_IDENTITY_PrivateKey *identity,
+                        const struct GNUNET_CRYPTO_PrivateKey *identity,
                         RECLAIM_TICKETS_RevokeCallback cb,
                         void *cb_cls)
 {
@@ -920,7 +920,7 @@ RECLAIM_TICKETS_revoke (const struct GNUNET_RECLAIM_Ticket 
*ticket,
   rvk->cb_cls = cb_cls;
   rvk->identity = *identity;
   rvk->ticket = *ticket;
-  GNUNET_IDENTITY_key_get_public (&rvk->identity, &rvk->ticket.identity);
+  GNUNET_CRYPTO_key_get_public (&rvk->identity, &rvk->ticket.identity);
   /** Get shared attributes **/
   label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd,
                                                sizeof(ticket->rnd));
@@ -1179,7 +1179,7 @@ lookup_authz_cb (void *cls,
  * @return handle to the operation
  */
 struct RECLAIM_TICKETS_ConsumeHandle *
-RECLAIM_TICKETS_consume (const struct GNUNET_IDENTITY_PrivateKey *id,
+RECLAIM_TICKETS_consume (const struct GNUNET_CRYPTO_PrivateKey *id,
                          const struct GNUNET_RECLAIM_Ticket *ticket,
                          RECLAIM_TICKETS_ConsumeCallback cb,
                          void *cb_cls)
@@ -1190,7 +1190,7 @@ RECLAIM_TICKETS_consume (const struct 
GNUNET_IDENTITY_PrivateKey *id,
   cth = GNUNET_new (struct RECLAIM_TICKETS_ConsumeHandle);
 
   cth->identity = *id;
-  GNUNET_IDENTITY_key_get_public (&cth->identity, &cth->identity_pub);
+  GNUNET_CRYPTO_key_get_public (&cth->identity, &cth->identity_pub);
   cth->attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
   cth->presentations = GNUNET_new (struct GNUNET_RECLAIM_PresentationList);
   cth->ticket = *ticket;
@@ -1199,7 +1199,7 @@ RECLAIM_TICKETS_consume (const struct 
GNUNET_IDENTITY_PrivateKey *id,
   label =
     GNUNET_STRINGS_data_to_string_alloc (&cth->ticket.rnd,
                                          sizeof(cth->ticket.rnd));
-  char *str = GNUNET_IDENTITY_public_key_to_string (&cth->ticket.identity);
+  char *str = GNUNET_CRYPTO_public_key_to_string (&cth->ticket.identity);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Looking for AuthZ info under %s in %s\n",
               label, str);
@@ -1397,10 +1397,10 @@ issue_ticket (struct TicketIssueHandle *ih)
   label =
     GNUNET_STRINGS_data_to_string_alloc (&ih->ticket.rnd,
                                          sizeof(ih->ticket.rnd));
-  struct GNUNET_IDENTITY_PublicKey pub;
-  GNUNET_IDENTITY_key_get_public (&ih->identity,
+  struct GNUNET_CRYPTO_PublicKey pub;
+  GNUNET_CRYPTO_key_get_public (&ih->identity,
                                   &pub);
-  char *str = GNUNET_IDENTITY_public_key_to_string (&pub);
+  char *str = GNUNET_CRYPTO_public_key_to_string (&pub);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Storing AuthZ information under %s in %s\n", label, str);
   GNUNET_free (str);
@@ -1466,7 +1466,7 @@ filter_tickets_error_cb (void *cls)
  */
 static void
 filter_tickets_cb (void *cls,
-                   const struct GNUNET_IDENTITY_PrivateKey *zone,
+                   const struct GNUNET_CRYPTO_PrivateKey *zone,
                    const char *label,
                    unsigned int rd_count,
                    const struct GNUNET_GNSRECORD_Data *rd)
@@ -1512,11 +1512,11 @@ filter_tickets_cb (void *cls,
         continue;
       }
       // cmp audience
-      // FIXME this is ugly, GNUNET_IDENTITY_PublicKey cannot be compared
+      // FIXME this is ugly, GNUNET_CRYPTO_PublicKey cannot be compared
       // like this
       if (0 == memcmp (&tih->ticket.audience,
                        &ticket.audience,
-                       sizeof(struct GNUNET_IDENTITY_PublicKey)))
+                       sizeof(struct GNUNET_CRYPTO_PublicKey)))
       {
         tih->ticket = ticket;
         ticket_found = GNUNET_YES;
@@ -1631,7 +1631,7 @@ filter_tickets_finished_cb (void *cls)
 {
   struct TicketIssueHandle *tih = cls;
 
-  GNUNET_IDENTITY_key_get_public (&tih->identity, &tih->ticket.identity);
+  GNUNET_CRYPTO_key_get_public (&tih->identity, &tih->ticket.identity);
   GNUNET_RECLAIM_id_generate (&tih->ticket.rnd);
   issue_ticket (tih);
 }
@@ -1649,9 +1649,9 @@ filter_tickets_finished_cb (void *cls)
  * FIXME: Return handle??
  */
 void
-RECLAIM_TICKETS_issue (const struct GNUNET_IDENTITY_PrivateKey *identity,
+RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_PrivateKey *identity,
                        const struct GNUNET_RECLAIM_AttributeList *attrs,
-                       const struct GNUNET_IDENTITY_PublicKey *audience,
+                       const struct GNUNET_CRYPTO_PublicKey *audience,
                        RECLAIM_TICKETS_TicketResult cb,
                        void *cb_cls)
 {
@@ -1709,7 +1709,7 @@ cleanup_iter (struct RECLAIM_TICKETS_Iterator *iter)
  */
 static void
 collect_tickets_cb (void *cls,
-                    const struct GNUNET_IDENTITY_PrivateKey *zone,
+                    const struct GNUNET_CRYPTO_PrivateKey *zone,
                     const char *label,
                     unsigned int rd_count,
                     const struct GNUNET_GNSRECORD_Data *rd)
@@ -1807,7 +1807,7 @@ RECLAIM_TICKETS_iteration_stop (struct 
RECLAIM_TICKETS_Iterator *iter)
  */
 struct RECLAIM_TICKETS_Iterator *
 RECLAIM_TICKETS_iteration_start (
-  const struct GNUNET_IDENTITY_PrivateKey *identity,
+  const struct GNUNET_CRYPTO_PrivateKey *identity,
   RECLAIM_TICKETS_TicketIter cb,
   void *cb_cls)
 {
diff --git a/src/reclaim/gnunet-service-reclaim_tickets.h 
b/src/reclaim/gnunet-service-reclaim_tickets.h
index 9c31a6143..0ec232f49 100644
--- a/src/reclaim/gnunet-service-reclaim_tickets.h
+++ b/src/reclaim/gnunet-service-reclaim_tickets.h
@@ -138,7 +138,7 @@ typedef void (*RECLAIM_TICKETS_TicketResult) (
  */
 typedef void (*RECLAIM_TICKETS_ConsumeCallback) (
   void *cls,
-  const struct GNUNET_IDENTITY_PublicKey *identity,
+  const struct GNUNET_CRYPTO_PublicKey *identity,
   const struct GNUNET_RECLAIM_AttributeList *attributes,
   const struct GNUNET_RECLAIM_PresentationList *presentations,
   int32_t success,
@@ -167,7 +167,7 @@ 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_IDENTITY_PrivateKey *identity,
+                        const struct GNUNET_CRYPTO_PrivateKey *identity,
                         RECLAIM_TICKETS_RevokeCallback cb,
                         void *cb_cls);
 
@@ -193,7 +193,7 @@ RECLAIM_TICKETS_revoke_cancel (struct 
RECLAIM_TICKETS_RevokeHandle *rh);
  * @return handle to the operation
  */
 struct RECLAIM_TICKETS_ConsumeHandle *
-RECLAIM_TICKETS_consume (const struct GNUNET_IDENTITY_PrivateKey *id,
+RECLAIM_TICKETS_consume (const struct GNUNET_CRYPTO_PrivateKey *id,
                          const struct GNUNET_RECLAIM_Ticket *ticket,
                          RECLAIM_TICKETS_ConsumeCallback cb,
                          void *cb_cls);
@@ -220,9 +220,9 @@ RECLAIM_TICKETS_consume_cancel (struct 
RECLAIM_TICKETS_ConsumeHandle *cth);
  * FIXME: Return handle??
  */
 void
-RECLAIM_TICKETS_issue (const struct GNUNET_IDENTITY_PrivateKey *identity,
+RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_PrivateKey *identity,
                        const struct GNUNET_RECLAIM_AttributeList *attrs,
-                       const struct GNUNET_IDENTITY_PublicKey *audience,
+                       const struct GNUNET_CRYPTO_PublicKey *audience,
                        RECLAIM_TICKETS_TicketResult cb,
                        void *cb_cls);
 
@@ -255,7 +255,7 @@ RECLAIM_TICKETS_iteration_stop (struct 
RECLAIM_TICKETS_Iterator *iter);
  */
 struct RECLAIM_TICKETS_Iterator *
 RECLAIM_TICKETS_iteration_start (
-  const struct GNUNET_IDENTITY_PrivateKey *identity,
+  const struct GNUNET_CRYPTO_PrivateKey *identity,
   RECLAIM_TICKETS_TicketIter cb,
   void *cb_cls);
 
diff --git a/src/reclaim/oidc_helper.c b/src/reclaim/oidc_helper.c
index 90c33375f..a2da7312b 100644
--- a/src/reclaim/oidc_helper.c
+++ b/src/reclaim/oidc_helper.c
@@ -158,7 +158,7 @@ fix_base64 (char *str)
 
 
 static json_t*
-generate_userinfo_json (const struct GNUNET_IDENTITY_PublicKey *sub_key,
+generate_userinfo_json (const struct GNUNET_CRYPTO_PublicKey *sub_key,
                         const struct GNUNET_RECLAIM_AttributeList *attrs,
                         const struct
                         GNUNET_RECLAIM_PresentationList *presentations)
@@ -184,7 +184,7 @@ generate_userinfo_json (const struct 
GNUNET_IDENTITY_PublicKey *sub_key,
   subject =
     GNUNET_STRINGS_data_to_string_alloc (sub_key,
                                          sizeof(struct
-                                                GNUNET_IDENTITY_PublicKey));
+                                                GNUNET_CRYPTO_PublicKey));
   body = json_object ();
   aggr_names = json_object ();
   aggr_sources = json_object ();
@@ -343,7 +343,7 @@ generate_userinfo_json (const struct 
GNUNET_IDENTITY_PublicKey *sub_key,
  * @return Userinfo JSON
  */
 char *
-OIDC_generate_userinfo (const struct GNUNET_IDENTITY_PublicKey *sub_key,
+OIDC_generate_userinfo (const struct GNUNET_CRYPTO_PublicKey *sub_key,
                         const struct GNUNET_RECLAIM_AttributeList *attrs,
                         const struct
                         GNUNET_RECLAIM_PresentationList *presentations)
@@ -359,8 +359,8 @@ OIDC_generate_userinfo (const struct 
GNUNET_IDENTITY_PublicKey *sub_key,
 
 
 char *
-generate_id_token_body (const struct GNUNET_IDENTITY_PublicKey *aud_key,
-                        const struct GNUNET_IDENTITY_PublicKey *sub_key,
+generate_id_token_body (const struct GNUNET_CRYPTO_PublicKey *aud_key,
+                        const struct GNUNET_CRYPTO_PublicKey *sub_key,
                         const struct GNUNET_RECLAIM_AttributeList *attrs,
                         const struct
                         GNUNET_RECLAIM_PresentationList *presentations,
@@ -387,11 +387,11 @@ generate_id_token_body (const struct 
GNUNET_IDENTITY_PublicKey *aud_key,
   subject =
     GNUNET_STRINGS_data_to_string_alloc (sub_key,
                                          sizeof(struct
-                                                GNUNET_IDENTITY_PublicKey));
+                                                GNUNET_CRYPTO_PublicKey));
   audience =
     GNUNET_STRINGS_data_to_string_alloc (aud_key,
                                          sizeof(struct
-                                                GNUNET_IDENTITY_PublicKey));
+                                                GNUNET_CRYPTO_PublicKey));
 
   // aud REQUIRED public key client_id must be there
   json_object_set_new (body, "aud", json_string (audience));
@@ -424,8 +424,8 @@ generate_id_token_body (const struct 
GNUNET_IDENTITY_PublicKey *aud_key,
 
 
 char *
-OIDC_generate_id_token_rsa (const struct GNUNET_IDENTITY_PublicKey *aud_key,
-                            const struct GNUNET_IDENTITY_PublicKey *sub_key,
+OIDC_generate_id_token_rsa (const struct GNUNET_CRYPTO_PublicKey *aud_key,
+                            const struct GNUNET_CRYPTO_PublicKey *sub_key,
                             const struct GNUNET_RECLAIM_AttributeList *attrs,
                             const struct
                             GNUNET_RECLAIM_PresentationList *presentations,
@@ -486,8 +486,8 @@ OIDC_generate_id_token_rsa (const struct 
GNUNET_IDENTITY_PublicKey *aud_key,
  * @return a new base64-encoded JWT string.
  */
 char *
-OIDC_generate_id_token_hmac (const struct GNUNET_IDENTITY_PublicKey *aud_key,
-                             const struct GNUNET_IDENTITY_PublicKey *sub_key,
+OIDC_generate_id_token_hmac (const struct GNUNET_CRYPTO_PublicKey *aud_key,
+                             const struct GNUNET_CRYPTO_PublicKey *sub_key,
                              const struct GNUNET_RECLAIM_AttributeList *attrs,
                              const struct
                              GNUNET_RECLAIM_PresentationList *presentations,
@@ -578,7 +578,7 @@ OIDC_generate_id_token_hmac (const struct 
GNUNET_IDENTITY_PublicKey *aud_key,
  * @return a new authorization code (caller must free)
  */
 char *
-OIDC_build_authz_code (const struct GNUNET_IDENTITY_PrivateKey *issuer,
+OIDC_build_authz_code (const struct GNUNET_CRYPTO_PrivateKey *issuer,
                        const struct GNUNET_RECLAIM_Ticket *ticket,
                        const struct GNUNET_RECLAIM_AttributeList *attrs,
                        const struct
@@ -671,7 +671,7 @@ OIDC_build_authz_code (const struct 
GNUNET_IDENTITY_PrivateKey *issuer,
   // Get length
   code_payload_len = sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
                      + payload_len + sizeof(struct
-                                            GNUNET_IDENTITY_Signature);
+                                            GNUNET_CRYPTO_Signature);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Length of data to encode: %lu\n",
               code_payload_len);
@@ -690,9 +690,9 @@ OIDC_build_authz_code (const struct 
GNUNET_IDENTITY_PrivateKey *issuer,
   buf_ptr += payload_len;
   // Sign and store signature
   if (GNUNET_SYSERR ==
-      GNUNET_IDENTITY_sign_ (issuer,
+      GNUNET_CRYPTO_sign_ (issuer,
                              purpose,
-                             (struct GNUNET_IDENTITY_Signature *)
+                             (struct GNUNET_CRYPTO_Signature *)
                              buf_ptr))
   {
     GNUNET_break (0);
@@ -764,7 +764,7 @@ check_code_challenge (const char *code_challenge,
  * @return GNUNET_OK if successful, else GNUNET_SYSERR
  */
 int
-OIDC_parse_authz_code (const struct GNUNET_IDENTITY_PublicKey *audience,
+OIDC_parse_authz_code (const struct GNUNET_CRYPTO_PublicKey *audience,
                        const char *code,
                        const char *code_verifier,
                        struct GNUNET_RECLAIM_Ticket *ticket,
@@ -780,7 +780,7 @@ OIDC_parse_authz_code (const struct 
GNUNET_IDENTITY_PublicKey *audience,
   char *presentations_ser;
   char *code_challenge;
   struct GNUNET_CRYPTO_EccSignaturePurpose *purpose;
-  struct GNUNET_IDENTITY_Signature *signature;
+  struct GNUNET_CRYPTO_Signature *signature;
   uint32_t code_challenge_len;
   uint32_t attrs_ser_len;
   uint32_t pres_ser_len;
@@ -796,7 +796,7 @@ OIDC_parse_authz_code (const struct 
GNUNET_IDENTITY_PublicKey *audience,
                                      (void **) &code_payload);
   if (code_payload_len < sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
       + sizeof(struct OIDC_Parameters)
-      + sizeof(struct GNUNET_IDENTITY_Signature))
+      + sizeof(struct GNUNET_CRYPTO_Signature))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Authorization code malformed\n");
     GNUNET_free (code_payload);
@@ -807,10 +807,10 @@ OIDC_parse_authz_code (const struct 
GNUNET_IDENTITY_PublicKey *audience,
   plaintext_len = code_payload_len;
   plaintext_len -= sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose);
   ptr = (char *) &purpose[1];
-  plaintext_len -= sizeof(struct GNUNET_IDENTITY_Signature);
+  plaintext_len -= sizeof(struct GNUNET_CRYPTO_Signature);
   plaintext = ptr;
   ptr += plaintext_len;
-  signature = (struct GNUNET_IDENTITY_Signature *) ptr;
+  signature = (struct GNUNET_CRYPTO_Signature *) ptr;
   params = (struct OIDC_Parameters *) plaintext;
 
   // cmp code_challenge code_verifier
@@ -848,7 +848,7 @@ OIDC_parse_authz_code (const struct 
GNUNET_IDENTITY_PublicKey *audience,
     return GNUNET_SYSERR;
   }
   if (GNUNET_OK !=
-      GNUNET_IDENTITY_signature_verify_ (
+      GNUNET_CRYPTO_signature_verify_ (
         GNUNET_SIGNATURE_PURPOSE_RECLAIM_CODE_SIGN,
         purpose,
         signature,
diff --git a/src/reclaim/oidc_helper.h b/src/reclaim/oidc_helper.h
index 81eadf2ed..de788fbdb 100644
--- a/src/reclaim/oidc_helper.h
+++ b/src/reclaim/oidc_helper.h
@@ -61,8 +61,8 @@ enum OIDC_VerificationOptions
  * @return a new base64-encoded JWT string.
  */
 char *
-OIDC_generate_id_token_rsa (const struct GNUNET_IDENTITY_PublicKey *aud_key,
-                            const struct GNUNET_IDENTITY_PublicKey *sub_key,
+OIDC_generate_id_token_rsa (const struct GNUNET_CRYPTO_PublicKey *aud_key,
+                            const struct GNUNET_CRYPTO_PublicKey *sub_key,
                             const struct GNUNET_RECLAIM_AttributeList *attrs,
                             const struct
                             GNUNET_RECLAIM_PresentationList *presentations,
@@ -82,8 +82,8 @@ OIDC_generate_id_token_rsa (const struct 
GNUNET_IDENTITY_PublicKey *aud_key,
  * @return a new base64-encoded JWT string.
  */
 char*
-OIDC_generate_id_token_hmac (const struct GNUNET_IDENTITY_PublicKey *aud_key,
-                             const struct GNUNET_IDENTITY_PublicKey *sub_key,
+OIDC_generate_id_token_hmac (const struct GNUNET_CRYPTO_PublicKey *aud_key,
+                             const struct GNUNET_CRYPTO_PublicKey *sub_key,
                              const struct GNUNET_RECLAIM_AttributeList *attrs,
                              const struct
                              GNUNET_RECLAIM_PresentationList *presentations,
@@ -105,7 +105,7 @@ OIDC_generate_id_token_hmac (const struct 
GNUNET_IDENTITY_PublicKey *aud_key,
  * @return a new authorization code (caller must free)
  */
 char*
-OIDC_build_authz_code (const struct GNUNET_IDENTITY_PrivateKey *issuer,
+OIDC_build_authz_code (const struct GNUNET_CRYPTO_PrivateKey *issuer,
                        const struct GNUNET_RECLAIM_Ticket *ticket,
                        const struct GNUNET_RECLAIM_AttributeList *attrs,
                        const struct
@@ -128,7 +128,7 @@ OIDC_build_authz_code (const struct 
GNUNET_IDENTITY_PrivateKey *issuer,
  * @return GNUNET_OK if successful, else GNUNET_SYSERR
  */
 int
-OIDC_parse_authz_code (const struct GNUNET_IDENTITY_PublicKey *ecdsa_pub,
+OIDC_parse_authz_code (const struct GNUNET_CRYPTO_PublicKey *ecdsa_pub,
                        const char *code,
                        const char *code_verifier,
                        struct GNUNET_RECLAIM_Ticket *ticket,
@@ -188,7 +188,7 @@ OIDC_check_scopes_for_claim_request (const char *scopes,
  * @return Userinfo JSON
  */
 char *
-OIDC_generate_userinfo (const struct GNUNET_IDENTITY_PublicKey *sub_key,
+OIDC_generate_userinfo (const struct GNUNET_CRYPTO_PublicKey *sub_key,
                         const struct GNUNET_RECLAIM_AttributeList *attrs,
                         const struct
                         GNUNET_RECLAIM_PresentationList *presentations);
diff --git a/src/reclaim/plugin_rest_openid_connect.c 
b/src/reclaim/plugin_rest_openid_connect.c
index ff882aca1..d0aee043e 100644
--- a/src/reclaim/plugin_rest_openid_connect.c
+++ b/src/reclaim/plugin_rest_openid_connect.c
@@ -331,7 +331,7 @@ struct OIDC_Variables
   /**
    * The RP client public key
    */
-  struct GNUNET_IDENTITY_PublicKey client_pkey;
+  struct GNUNET_CRYPTO_PublicKey client_pkey;
 
   /**
    * The OIDC client id of the RP
@@ -442,7 +442,7 @@ struct RequestHandle
   /**
    * Pointer to ego private key
    */
-  struct GNUNET_IDENTITY_PrivateKey priv_key;
+  struct GNUNET_CRYPTO_PrivateKey priv_key;
 
   /**
    * OIDC variables
@@ -1257,7 +1257,7 @@ oidc_cred_collect_finished_cb (void *cls)
  */
 static void
 oidc_cred_collect (void *cls,
-                   const struct GNUNET_IDENTITY_PublicKey *identity,
+                   const struct GNUNET_CRYPTO_PublicKey *identity,
                    const struct GNUNET_RECLAIM_Credential *cred)
 {
   struct RequestHandle *handle = cls;
@@ -1380,7 +1380,7 @@ attr_in_userinfo_request (struct RequestHandle *handle,
  */
 static void
 oidc_attr_collect (void *cls,
-                   const struct GNUNET_IDENTITY_PublicKey *identity,
+                   const struct GNUNET_CRYPTO_PublicKey *identity,
                    const struct GNUNET_RECLAIM_Attribute *attr)
 {
   struct RequestHandle *handle = cls;
@@ -1429,8 +1429,8 @@ code_redirect (void *cls)
   struct RequestHandle *handle = cls;
   struct GNUNET_TIME_Absolute current_time;
   struct GNUNET_TIME_Absolute *relog_time;
-  struct GNUNET_IDENTITY_PublicKey pubkey;
-  struct GNUNET_IDENTITY_PublicKey ego_pkey;
+  struct GNUNET_CRYPTO_PublicKey pubkey;
+  struct GNUNET_CRYPTO_PublicKey ego_pkey;
   struct GNUNET_HashCode cache_key;
   char *identity_cookie;
 
@@ -1450,7 +1450,7 @@ code_redirect (void *cls)
     if (current_time.abs_value_us <= relog_time->abs_value_us)
     {
       if (GNUNET_OK !=
-          GNUNET_IDENTITY_public_key_from_string (handle->oidc
+          GNUNET_CRYPTO_public_key_from_string (handle->oidc
                                                   ->login_identity,
                                                   &pubkey))
       {
@@ -1544,7 +1544,7 @@ lookup_redirect_uri_result (void *cls,
   char *tmp;
   char *tmp_key_str;
   char *pos;
-  struct GNUNET_IDENTITY_PublicKey redirect_zone;
+  struct GNUNET_CRYPTO_PublicKey redirect_zone;
 
   handle->gns_op = NULL;
   if (0 == rd_count)
@@ -1776,10 +1776,10 @@ static void
 tld_iter (void *cls, const char *section, const char *option, const char 
*value)
 {
   struct RequestHandle *handle = cls;
-  struct GNUNET_IDENTITY_PublicKey pkey;
+  struct GNUNET_CRYPTO_PublicKey pkey;
 
   if (GNUNET_OK !=
-      GNUNET_IDENTITY_public_key_from_string (value, &pkey))
+      GNUNET_CRYPTO_public_key_from_string (value, &pkey))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Skipping non key %s\n", value);
     return;
@@ -1803,8 +1803,8 @@ authorize_endpoint (struct GNUNET_REST_RequestHandle 
*con_handle,
 {
   struct RequestHandle *handle = cls;
   struct EgoEntry *tmp_ego;
-  const struct GNUNET_IDENTITY_PrivateKey *priv_key;
-  struct GNUNET_IDENTITY_PublicKey pkey;
+  const struct GNUNET_CRYPTO_PrivateKey *priv_key;
+  struct GNUNET_CRYPTO_PublicKey pkey;
 
   cookie_identity_interpretation (handle);
 
@@ -1832,7 +1832,7 @@ authorize_endpoint (struct GNUNET_REST_RequestHandle 
*con_handle,
   }
 
   if (GNUNET_OK !=
-      GNUNET_IDENTITY_public_key_from_string (handle->oidc->client_id,
+      GNUNET_CRYPTO_public_key_from_string (handle->oidc->client_id,
                                               &handle->oidc->client_pkey))
   {
     handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_UNAUTHORIZED_CLIENT);
@@ -1848,7 +1848,7 @@ authorize_endpoint (struct GNUNET_REST_RequestHandle 
*con_handle,
   for (tmp_ego = ego_head; NULL != tmp_ego; tmp_ego = tmp_ego->next)
   {
     priv_key = GNUNET_IDENTITY_ego_get_private_key (tmp_ego->ego);
-    GNUNET_IDENTITY_key_get_public (priv_key, &pkey);
+    GNUNET_CRYPTO_key_get_public (priv_key, &pkey);
     if (0 == GNUNET_memcmp (&pkey, &handle->oidc->client_pkey))
     {
       handle->tld = GNUNET_strdup (tmp_ego->identifier);
@@ -2041,7 +2041,7 @@ parse_credentials_post_body (struct RequestHandle *handle,
 
 static int
 check_authorization (struct RequestHandle *handle,
-                     struct GNUNET_IDENTITY_PublicKey *cid)
+                     struct GNUNET_CRYPTO_PublicKey *cid)
 {
   char *expected_pass;
   char *received_cid;
@@ -2078,7 +2078,7 @@ check_authorization (struct RequestHandle *handle,
     GNUNET_STRINGS_string_to_data (received_cid,
                                    strlen (received_cid),
                                    cid,
-                                   sizeof(struct GNUNET_IDENTITY_PublicKey));
+                                   sizeof(struct GNUNET_CRYPTO_PublicKey));
     GNUNET_free (received_cid);
     return GNUNET_OK;
 
@@ -2128,7 +2128,7 @@ check_authorization (struct RequestHandle *handle,
   GNUNET_STRINGS_string_to_data (received_cid,
                                  strlen (received_cid),
                                  cid,
-                                 sizeof(struct GNUNET_IDENTITY_PublicKey));
+                                 sizeof(struct GNUNET_CRYPTO_PublicKey));
 
   GNUNET_free (received_cpw);
   GNUNET_free (received_cid);
@@ -2138,10 +2138,10 @@ check_authorization (struct RequestHandle *handle,
 
 const struct EgoEntry *
 find_ego (struct RequestHandle *handle,
-          struct GNUNET_IDENTITY_PublicKey *test_key)
+          struct GNUNET_CRYPTO_PublicKey *test_key)
 {
   struct EgoEntry *ego_entry;
-  struct GNUNET_IDENTITY_PublicKey pub_key;
+  struct GNUNET_CRYPTO_PublicKey pub_key;
 
   for (ego_entry = ego_head; NULL != ego_entry;
        ego_entry = ego_entry->next)
@@ -2172,7 +2172,7 @@ token_endpoint (struct GNUNET_REST_RequestHandle 
*con_handle,
   struct GNUNET_RECLAIM_AttributeList *cl = NULL;
   struct GNUNET_RECLAIM_PresentationList *pl = NULL;
   struct GNUNET_RECLAIM_Ticket ticket;
-  struct GNUNET_IDENTITY_PublicKey cid;
+  struct GNUNET_CRYPTO_PublicKey cid;
   struct GNUNET_HashCode cache_key;
   struct MHD_Response *resp = NULL;
   char *grant_type = NULL;
@@ -2439,7 +2439,7 @@ token_endpoint (struct GNUNET_REST_RequestHandle 
*con_handle,
  */
 static void
 consume_ticket (void *cls,
-                const struct GNUNET_IDENTITY_PublicKey *identity,
+                const struct GNUNET_CRYPTO_PublicKey *identity,
                 const struct GNUNET_RECLAIM_Attribute *attr,
                 const struct GNUNET_RECLAIM_Presentation *presentation)
 {
@@ -2620,7 +2620,7 @@ userinfo_endpoint (struct GNUNET_REST_RequestHandle 
*con_handle,
   char *authorization_type;
   char *authorization_access_token;
   const struct EgoEntry *aud_ego;
-  const struct GNUNET_IDENTITY_PrivateKey *privkey;
+  const struct GNUNET_CRYPTO_PrivateKey *privkey;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Getting userinfo\n");
   GNUNET_CRYPTO_hash (OIDC_AUTHORIZATION_HEADER_KEY,
@@ -2802,7 +2802,7 @@ list_ego (void *cls,
           const char *identifier)
 {
   struct EgoEntry *ego_entry;
-  struct GNUNET_IDENTITY_PublicKey pk;
+  struct GNUNET_CRYPTO_PublicKey pk;
 
   if (NULL == ego)
   {
@@ -2814,7 +2814,7 @@ list_ego (void *cls,
   {
     ego_entry = GNUNET_new (struct EgoEntry);
     GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
-    ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk);
+    ego_entry->keystring = GNUNET_CRYPTO_public_key_to_string (&pk);
     ego_entry->ego = ego;
     ego_entry->identifier = GNUNET_strdup (identifier);
     GNUNET_CONTAINER_DLL_insert_tail (ego_head,
@@ -2841,7 +2841,7 @@ list_ego (void *cls,
       /* Add */
       ego_entry = GNUNET_new (struct EgoEntry);
       GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
-      ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk);
+      ego_entry->keystring = GNUNET_CRYPTO_public_key_to_string (&pk);
       ego_entry->ego = ego;
       ego_entry->identifier = GNUNET_strdup (identifier);
       GNUNET_CONTAINER_DLL_insert_tail (ego_head,
diff --git a/src/reclaim/plugin_rest_reclaim.c 
b/src/reclaim/plugin_rest_reclaim.c
index 9cc41bf1a..b2586109a 100644
--- a/src/reclaim/plugin_rest_reclaim.c
+++ b/src/reclaim/plugin_rest_reclaim.c
@@ -172,7 +172,7 @@ struct RequestHandle
   /**
    * Pointer to ego private key
    */
-  struct GNUNET_IDENTITY_PrivateKey priv_key;
+  struct GNUNET_CRYPTO_PrivateKey priv_key;
 
   /**
    * Rest connection
@@ -449,14 +449,14 @@ ticket_collect (void *cls, const struct 
GNUNET_RECLAIM_Ticket *ticket)
   tmp =
     GNUNET_STRINGS_data_to_string_alloc (&ticket->identity,
                                          sizeof(struct
-                                                GNUNET_IDENTITY_PublicKey));
+                                                GNUNET_CRYPTO_PublicKey));
   value = json_string (tmp);
   json_object_set_new (json_resource, "issuer", value);
   GNUNET_free (tmp);
   tmp =
     GNUNET_STRINGS_data_to_string_alloc (&ticket->audience,
                                          sizeof(struct
-                                                GNUNET_IDENTITY_PublicKey));
+                                                GNUNET_CRYPTO_PublicKey));
   value = json_string (tmp);
   json_object_set_new (json_resource, "audience", value);
   GNUNET_free (tmp);
@@ -474,7 +474,7 @@ add_credential_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
                      void *cls)
 {
   struct RequestHandle *handle = cls;
-  const struct GNUNET_IDENTITY_PrivateKey *identity_priv;
+  const struct GNUNET_CRYPTO_PrivateKey *identity_priv;
   const char *identity;
   struct EgoEntry *ego_entry;
   struct GNUNET_RECLAIM_Credential *attribute;
@@ -562,7 +562,7 @@ add_credential_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
  */
 static void
 cred_collect (void *cls,
-              const struct GNUNET_IDENTITY_PublicKey *identity,
+              const struct GNUNET_CRYPTO_PublicKey *identity,
               const struct GNUNET_RECLAIM_Credential *cred)
 {
   struct RequestHandle *handle = cls;
@@ -649,7 +649,7 @@ list_credential_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
                       void *cls)
 {
   struct RequestHandle *handle = cls;
-  const struct GNUNET_IDENTITY_PrivateKey *priv_key;
+  const struct GNUNET_CRYPTO_PrivateKey *priv_key;
   struct EgoEntry *ego_entry;
   char *identity;
 
@@ -706,7 +706,7 @@ delete_credential_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
                         void *cls)
 {
   struct RequestHandle *handle = cls;
-  const struct GNUNET_IDENTITY_PrivateKey *priv_key;
+  const struct GNUNET_CRYPTO_PrivateKey *priv_key;
   struct GNUNET_RECLAIM_Credential attr;
   struct EgoEntry *ego_entry;
   char *identity_id_str;
@@ -772,7 +772,7 @@ list_tickets_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
                    const char *url,
                    void *cls)
 {
-  const struct GNUNET_IDENTITY_PrivateKey *priv_key;
+  const struct GNUNET_CRYPTO_PrivateKey *priv_key;
   struct RequestHandle *handle = cls;
   struct EgoEntry *ego_entry;
   char *identity;
@@ -819,7 +819,7 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
                     const char *url,
                     void *cls)
 {
-  const struct GNUNET_IDENTITY_PrivateKey *identity_priv;
+  const struct GNUNET_CRYPTO_PrivateKey *identity_priv;
   const char *identity;
   struct RequestHandle *handle = cls;
   struct EgoEntry *ego_entry;
@@ -967,7 +967,7 @@ parse_jwt (const struct GNUNET_RECLAIM_Credential *cred,
  */
 static void
 attr_collect (void *cls,
-              const struct GNUNET_IDENTITY_PublicKey *identity,
+              const struct GNUNET_CRYPTO_PublicKey *identity,
               const struct GNUNET_RECLAIM_Attribute *attr)
 {
   struct RequestHandle *handle = cls;
@@ -1016,7 +1016,7 @@ list_attribute_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
                      const char *url,
                      void *cls)
 {
-  const struct GNUNET_IDENTITY_PrivateKey *priv_key;
+  const struct GNUNET_CRYPTO_PrivateKey *priv_key;
   struct RequestHandle *handle = cls;
   struct EgoEntry *ego_entry;
   char *identity;
@@ -1070,7 +1070,7 @@ delete_attribute_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
                        const char *url,
                        void *cls)
 {
-  const struct GNUNET_IDENTITY_PrivateKey *priv_key;
+  const struct GNUNET_CRYPTO_PrivateKey *priv_key;
   struct RequestHandle *handle = cls;
   struct GNUNET_RECLAIM_Attribute attr;
   struct EgoEntry *ego_entry;
@@ -1128,11 +1128,11 @@ revoke_ticket_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
                     const char *url,
                     void *cls)
 {
-  const struct GNUNET_IDENTITY_PrivateKey *identity_priv;
+  const struct GNUNET_CRYPTO_PrivateKey *identity_priv;
   struct RequestHandle *handle = cls;
   struct EgoEntry *ego_entry;
   struct GNUNET_RECLAIM_Ticket *ticket = NULL;
-  struct GNUNET_IDENTITY_PublicKey tmp_pk;
+  struct GNUNET_CRYPTO_PublicKey tmp_pk;
   char term_data[handle->rest_handle->data_size + 1];
   json_t *data_json;
   json_error_t err;
@@ -1176,7 +1176,7 @@ revoke_ticket_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
     GNUNET_IDENTITY_ego_get_public_key (ego_entry->ego, &tmp_pk);
     if (0 == memcmp (&ticket->identity,
                      &tmp_pk,
-                     sizeof(struct GNUNET_IDENTITY_PublicKey)))
+                     sizeof(struct GNUNET_CRYPTO_PublicKey)))
       break;
   }
   if (NULL == ego_entry)
@@ -1198,7 +1198,7 @@ revoke_ticket_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
 
 static void
 consume_cont (void *cls,
-              const struct GNUNET_IDENTITY_PublicKey *identity,
+              const struct GNUNET_CRYPTO_PublicKey *identity,
               const struct GNUNET_RECLAIM_Attribute *attr,
               const struct GNUNET_RECLAIM_Presentation *presentation)
 {
@@ -1235,11 +1235,11 @@ consume_ticket_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
                      const char *url,
                      void *cls)
 {
-  const struct GNUNET_IDENTITY_PrivateKey *identity_priv;
+  const struct GNUNET_CRYPTO_PrivateKey *identity_priv;
   struct RequestHandle *handle = cls;
   struct EgoEntry *ego_entry;
   struct GNUNET_RECLAIM_Ticket *ticket;
-  struct GNUNET_IDENTITY_PublicKey tmp_pk;
+  struct GNUNET_CRYPTO_PublicKey tmp_pk;
   char term_data[handle->rest_handle->data_size + 1];
   json_t *data_json;
   json_error_t err;
@@ -1279,7 +1279,7 @@ consume_ticket_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
     GNUNET_IDENTITY_ego_get_public_key (ego_entry->ego, &tmp_pk);
     if (0 == memcmp (&ticket->audience,
                      &tmp_pk,
-                     sizeof(struct GNUNET_IDENTITY_PublicKey)))
+                     sizeof(struct GNUNET_CRYPTO_PublicKey)))
       break;
   }
   if (NULL == ego_entry)
@@ -1362,7 +1362,7 @@ list_ego (void *cls,
           const char *identifier)
 {
   struct EgoEntry *ego_entry;
-  struct GNUNET_IDENTITY_PublicKey pk;
+  struct GNUNET_CRYPTO_PublicKey pk;
 
   if (NULL == ego)
   {
@@ -1373,7 +1373,7 @@ list_ego (void *cls,
   {
     ego_entry = GNUNET_new (struct EgoEntry);
     GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
-    ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk);
+    ego_entry->keystring = GNUNET_CRYPTO_public_key_to_string (&pk);
     ego_entry->ego = ego;
     ego_entry->identifier = GNUNET_strdup (identifier);
     GNUNET_CONTAINER_DLL_insert_tail (ego_head,
@@ -1399,7 +1399,7 @@ list_ego (void *cls,
       /* Add */
       ego_entry = GNUNET_new (struct EgoEntry);
       GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
-      ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk);
+      ego_entry->keystring = GNUNET_CRYPTO_public_key_to_string (&pk);
       ego_entry->ego = ego;
       ego_entry->identifier = GNUNET_strdup (identifier);
       GNUNET_CONTAINER_DLL_insert_tail (ego_head,
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c
index fedee3fff..e9a34dd95 100644
--- a/src/reclaim/reclaim_api.c
+++ b/src/reclaim/reclaim_api.c
@@ -234,7 +234,7 @@ struct GNUNET_RECLAIM_AttributeIterator
   /**
    * Private key of the zone.
    */
-  struct GNUNET_IDENTITY_PrivateKey identity;
+  struct GNUNET_CRYPTO_PrivateKey identity;
 
   /**
    * The operation id this zone iteration operation has
@@ -301,7 +301,7 @@ struct GNUNET_RECLAIM_CredentialIterator
   /**
    * Private key of the zone.
    */
-  struct GNUNET_IDENTITY_PrivateKey identity;
+  struct GNUNET_CRYPTO_PrivateKey identity;
 
   /**
    * The operation id this zone iteration operation has
@@ -592,7 +592,7 @@ static void
 handle_consume_ticket_result (void *cls,
                               const struct ConsumeTicketResultMessage *msg)
 {
-  struct GNUNET_IDENTITY_PublicKey identity;
+  struct GNUNET_CRYPTO_PublicKey identity;
   struct GNUNET_RECLAIM_Handle *h = cls;
   struct GNUNET_RECLAIM_Operation *op;
   size_t attrs_len;
@@ -621,7 +621,7 @@ handle_consume_ticket_result (void *cls,
     struct GNUNET_RECLAIM_PresentationListEntry *ple;
     read_ptr = (char *) &msg[1];
     GNUNET_assert (GNUNET_SYSERR !=
-                   GNUNET_IDENTITY_read_public_key_from_buffer (read_ptr,
+                   GNUNET_CRYPTO_read_public_key_from_buffer (read_ptr,
                                                                 key_len,
                                                                 &identity,
                                                                 &read));
@@ -714,7 +714,7 @@ check_attribute_result (void *cls, const struct 
AttributeResultMessage *msg)
 static void
 handle_attribute_result (void *cls, const struct AttributeResultMessage *msg)
 {
-  static struct GNUNET_IDENTITY_PublicKey identity;
+  static struct GNUNET_CRYPTO_PublicKey identity;
   struct GNUNET_RECLAIM_Handle *h = cls;
   struct GNUNET_RECLAIM_AttributeIterator *it;
   struct GNUNET_RECLAIM_Operation *op;
@@ -765,7 +765,7 @@ handle_attribute_result (void *cls, const struct 
AttributeResultMessage *msg)
   {
     struct GNUNET_RECLAIM_Attribute *attr;
     GNUNET_assert (GNUNET_SYSERR !=
-                   GNUNET_IDENTITY_read_public_key_from_buffer (buf,
+                   GNUNET_CRYPTO_read_public_key_from_buffer (buf,
                                                                 key_len,
                                                                 &identity,
                                                                 &read));
@@ -826,7 +826,7 @@ static void
 handle_credential_result (void *cls, const struct
                           CredentialResultMessage *msg)
 {
-  struct GNUNET_IDENTITY_PublicKey identity;
+  struct GNUNET_CRYPTO_PublicKey identity;
   struct GNUNET_RECLAIM_Handle *h = cls;
   struct GNUNET_RECLAIM_CredentialIterator *it;
   struct GNUNET_RECLAIM_Operation *op;
@@ -854,7 +854,7 @@ handle_credential_result (void *cls, const struct
   if (0 < key_len)
   {
     GNUNET_assert (GNUNET_SYSERR !=
-                   GNUNET_IDENTITY_read_public_key_from_buffer (buf,
+                   GNUNET_CRYPTO_read_public_key_from_buffer (buf,
                                                                 key_len,
                                                                 &identity,
                                                                 &read));
@@ -1161,7 +1161,7 @@ GNUNET_RECLAIM_disconnect (struct GNUNET_RECLAIM_Handle 
*h)
 struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_attribute_store (
   struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *pkey,
+  const struct GNUNET_CRYPTO_PrivateKey *pkey,
   const struct GNUNET_RECLAIM_Attribute *attr,
   const struct GNUNET_TIME_Relative *exp_interval,
   GNUNET_RECLAIM_ContinuationWithStatus cont,
@@ -1180,14 +1180,14 @@ GNUNET_RECLAIM_attribute_store (
   op->cls = cont_cls;
   op->r_id = h->r_id_gen++;
   GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
-  key_len = GNUNET_IDENTITY_private_key_get_length (pkey);
+  key_len = GNUNET_CRYPTO_private_key_get_length (pkey);
   attr_len = GNUNET_RECLAIM_attribute_serialize_get_size (attr);
   op->env = GNUNET_MQ_msg_extra (sam,
                                  attr_len + key_len,
                                  GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE);
   sam->key_len = htons (key_len);
   buf = (char *) &sam[1];
-  written = GNUNET_IDENTITY_write_private_key_to_buffer (pkey, buf, key_len);
+  written = GNUNET_CRYPTO_write_private_key_to_buffer (pkey, buf, key_len);
   GNUNET_assert (0 < written);
   buf += written;
   sam->id = htonl (op->r_id);
@@ -1205,7 +1205,7 @@ GNUNET_RECLAIM_attribute_store (
 struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_attribute_delete (
   struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *pkey,
+  const struct GNUNET_CRYPTO_PrivateKey *pkey,
   const struct GNUNET_RECLAIM_Attribute *attr,
   GNUNET_RECLAIM_ContinuationWithStatus cont,
   void *cont_cls)
@@ -1223,14 +1223,14 @@ GNUNET_RECLAIM_attribute_delete (
   op->cls = cont_cls;
   op->r_id = h->r_id_gen++;
   GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
-  key_len = GNUNET_IDENTITY_private_key_get_length (pkey);
+  key_len = GNUNET_CRYPTO_private_key_get_length (pkey);
   attr_len = GNUNET_RECLAIM_attribute_serialize_get_size (attr);
   op->env = GNUNET_MQ_msg_extra (dam,
                                  attr_len + key_len,
                                  GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE);
   dam->key_len = htons (key_len);
   buf = (char *) &dam[1];
-  written = GNUNET_IDENTITY_write_private_key_to_buffer (pkey, buf, key_len);
+  written = GNUNET_CRYPTO_write_private_key_to_buffer (pkey, buf, key_len);
   GNUNET_assert (0 < written);
   buf += written;
   dam->id = htonl (op->r_id);
@@ -1246,7 +1246,7 @@ GNUNET_RECLAIM_attribute_delete (
 struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_credential_store (
   struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *pkey,
+  const struct GNUNET_CRYPTO_PrivateKey *pkey,
   const struct GNUNET_RECLAIM_Credential *credential,
   const struct GNUNET_TIME_Relative *exp_interval,
   GNUNET_RECLAIM_ContinuationWithStatus cont,
@@ -1264,7 +1264,7 @@ GNUNET_RECLAIM_credential_store (
   op->as_cb = cont;
   op->cls = cont_cls;
   op->r_id = h->r_id_gen++;
-  key_len = GNUNET_IDENTITY_private_key_get_length (pkey);
+  key_len = GNUNET_CRYPTO_private_key_get_length (pkey);
   GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
   attr_len = GNUNET_RECLAIM_credential_serialize_get_size (credential);
   op->env = GNUNET_MQ_msg_extra (sam,
@@ -1272,7 +1272,7 @@ GNUNET_RECLAIM_credential_store (
                                  GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_STORE);
   sam->key_len = htons (key_len);
   buf = (char *) &sam[1];
-  written = GNUNET_IDENTITY_write_private_key_to_buffer (pkey, buf, key_len);
+  written = GNUNET_CRYPTO_write_private_key_to_buffer (pkey, buf, key_len);
   GNUNET_assert (0 <= written);
   buf += written;
   sam->id = htonl (op->r_id);
@@ -1290,7 +1290,7 @@ GNUNET_RECLAIM_credential_store (
 struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_credential_delete (
   struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *pkey,
+  const struct GNUNET_CRYPTO_PrivateKey *pkey,
   const struct GNUNET_RECLAIM_Credential *attr,
   GNUNET_RECLAIM_ContinuationWithStatus cont,
   void *cont_cls)
@@ -1307,7 +1307,7 @@ GNUNET_RECLAIM_credential_delete (
   op->as_cb = cont;
   op->cls = cont_cls;
   op->r_id = h->r_id_gen++;
-  key_len = GNUNET_IDENTITY_private_key_get_length (pkey);
+  key_len = GNUNET_CRYPTO_private_key_get_length (pkey);
   GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
   attr_len = GNUNET_RECLAIM_credential_serialize_get_size (attr);
   op->env = GNUNET_MQ_msg_extra (dam,
@@ -1315,7 +1315,7 @@ GNUNET_RECLAIM_credential_delete (
                                  
GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE);
   dam->key_len = htons (key_len);
   buf = (char *) &dam[1];
-  written = GNUNET_IDENTITY_write_private_key_to_buffer (pkey, buf, key_len);
+  written = GNUNET_CRYPTO_write_private_key_to_buffer (pkey, buf, key_len);
   GNUNET_assert (0 <= written);
   buf += written;
   dam->id = htonl (op->r_id);
@@ -1331,7 +1331,7 @@ GNUNET_RECLAIM_credential_delete (
 struct GNUNET_RECLAIM_AttributeIterator *
 GNUNET_RECLAIM_get_attributes_start (
   struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *identity,
+  const struct GNUNET_CRYPTO_PrivateKey *identity,
   GNUNET_SCHEDULER_TaskCallback error_cb,
   void *error_cb_cls,
   GNUNET_RECLAIM_AttributeResult proc,
@@ -1356,7 +1356,7 @@ GNUNET_RECLAIM_get_attributes_start (
   it->proc_cls = proc_cls;
   it->r_id = rid;
   it->identity = *identity;
-  key_len = GNUNET_IDENTITY_private_key_get_length (identity);
+  key_len = GNUNET_CRYPTO_private_key_get_length (identity);
   GNUNET_CONTAINER_DLL_insert_tail (h->it_head, h->it_tail, it);
   env =
     GNUNET_MQ_msg_extra (msg,
@@ -1364,7 +1364,7 @@ GNUNET_RECLAIM_get_attributes_start (
                          
GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START);
   msg->id = htonl (rid);
   msg->key_len = htons (key_len);
-  GNUNET_IDENTITY_write_private_key_to_buffer (identity, &msg[1], key_len);
+  GNUNET_CRYPTO_write_private_key_to_buffer (identity, &msg[1], key_len);
   if (NULL == h->mq)
     it->env = env;
   else
@@ -1408,7 +1408,7 @@ GNUNET_RECLAIM_get_attributes_stop (struct 
GNUNET_RECLAIM_AttributeIterator *it)
 struct GNUNET_RECLAIM_CredentialIterator *
 GNUNET_RECLAIM_get_credentials_start (
   struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *identity,
+  const struct GNUNET_CRYPTO_PrivateKey *identity,
   GNUNET_SCHEDULER_TaskCallback error_cb,
   void *error_cb_cls,
   GNUNET_RECLAIM_CredentialResult proc,
@@ -1433,7 +1433,7 @@ GNUNET_RECLAIM_get_credentials_start (
   ait->proc_cls = proc_cls;
   ait->r_id = rid;
   ait->identity = *identity;
-  key_len = GNUNET_IDENTITY_private_key_get_length (identity);
+  key_len = GNUNET_CRYPTO_private_key_get_length (identity);
   GNUNET_CONTAINER_DLL_insert_tail (h->ait_head, h->ait_tail, ait);
   env =
     GNUNET_MQ_msg_extra (msg,
@@ -1441,7 +1441,7 @@ GNUNET_RECLAIM_get_credentials_start (
                          
GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START);
   msg->id = htonl (rid);
   msg->key_len = htons (key_len);
-  GNUNET_IDENTITY_write_private_key_to_buffer (identity, &msg[1], key_len);
+  GNUNET_CRYPTO_write_private_key_to_buffer (identity, &msg[1], key_len);
   if (NULL == h->mq)
     ait->env = env;
   else
@@ -1488,8 +1488,8 @@ GNUNET_RECLAIM_get_credentials_stop (struct
 struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_ticket_issue (
   struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *iss,
-  const struct GNUNET_IDENTITY_PublicKey *rp,
+  const struct GNUNET_CRYPTO_PrivateKey *iss,
+  const struct GNUNET_CRYPTO_PublicKey *rp,
   const struct GNUNET_RECLAIM_AttributeList *attrs,
   GNUNET_RECLAIM_IssueTicketCallback cb,
   void *cb_cls)
@@ -1507,8 +1507,8 @@ GNUNET_RECLAIM_ticket_issue (
   op->ti_cb = cb;
   op->cls = cb_cls;
   op->r_id = h->r_id_gen++;
-  key_len = GNUNET_IDENTITY_private_key_get_length (iss);
-  rpk_len = GNUNET_IDENTITY_public_key_get_length (rp);
+  key_len = GNUNET_CRYPTO_private_key_get_length (iss);
+  rpk_len = GNUNET_CRYPTO_public_key_get_length (rp);
   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,
@@ -1517,10 +1517,10 @@ GNUNET_RECLAIM_ticket_issue (
   tim->key_len = htons (key_len);
   tim->pkey_len = htons (rpk_len);
   buf = (char *) &tim[1];
-  written = GNUNET_IDENTITY_write_private_key_to_buffer (iss, buf, key_len);
+  written = GNUNET_CRYPTO_write_private_key_to_buffer (iss, buf, key_len);
   GNUNET_assert (0 <= written);
   buf += written;
-  written = GNUNET_IDENTITY_write_public_key_to_buffer (rp, buf, rpk_len);
+  written = GNUNET_CRYPTO_write_public_key_to_buffer (rp, buf, rpk_len);
   GNUNET_assert (0 <= written);
   buf += written;
   tim->id = htonl (op->r_id);
@@ -1548,7 +1548,7 @@ GNUNET_RECLAIM_ticket_issue (
 struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_ticket_consume (
   struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *identity,
+  const struct GNUNET_CRYPTO_PrivateKey *identity,
   const struct GNUNET_RECLAIM_Ticket *ticket,
   GNUNET_RECLAIM_AttributeTicketResult cb,
   void *cb_cls)
@@ -1564,7 +1564,7 @@ GNUNET_RECLAIM_ticket_consume (
   op->atr_cb = cb;
   op->cls = cb_cls;
   op->r_id = h->r_id_gen++;
-  key_len = GNUNET_IDENTITY_private_key_get_length (identity);
+  key_len = GNUNET_CRYPTO_private_key_get_length (identity);
   tkt_len = GNUNET_RECLAIM_ticket_serialize_get_size (ticket);
   GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
   op->env = GNUNET_MQ_msg_extra (ctm,
@@ -1572,7 +1572,7 @@ GNUNET_RECLAIM_ticket_consume (
                                  GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET);
   ctm->key_len = htons (key_len);
   buf = (char*) &ctm[1];
-  GNUNET_IDENTITY_write_private_key_to_buffer (identity, buf, key_len);
+  GNUNET_CRYPTO_write_private_key_to_buffer (identity, buf, key_len);
   buf += key_len;
   ctm->tkt_len = htons (tkt_len);
   GNUNET_RECLAIM_write_ticket_to_buffer (ticket, buf, tkt_len);
@@ -1588,7 +1588,7 @@ GNUNET_RECLAIM_ticket_consume (
 struct GNUNET_RECLAIM_TicketIterator *
 GNUNET_RECLAIM_ticket_iteration_start (
   struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *identity,
+  const struct GNUNET_CRYPTO_PrivateKey *identity,
   GNUNET_SCHEDULER_TaskCallback error_cb,
   void *error_cb_cls,
   GNUNET_RECLAIM_TicketCallback proc,
@@ -1613,14 +1613,14 @@ GNUNET_RECLAIM_ticket_iteration_start (
   it->cls = proc_cls;
   it->r_id = rid;
 
-  key_len = GNUNET_IDENTITY_private_key_get_length (identity);
+  key_len = GNUNET_CRYPTO_private_key_get_length (identity);
   GNUNET_CONTAINER_DLL_insert_tail (h->ticket_it_head, h->ticket_it_tail, it);
   env = GNUNET_MQ_msg_extra (msg,
                              key_len,
                              
GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START);
   msg->id = htonl (rid);
   msg->key_len = htons (key_len);
-  GNUNET_IDENTITY_write_private_key_to_buffer (identity,
+  GNUNET_CRYPTO_write_private_key_to_buffer (identity,
                                                &msg[1],
                                                key_len);
   if (NULL == h->mq)
@@ -1691,7 +1691,7 @@ GNUNET_RECLAIM_ticket_iteration_stop (struct 
GNUNET_RECLAIM_TicketIterator *it)
 struct GNUNET_RECLAIM_Operation *
 GNUNET_RECLAIM_ticket_revoke (
   struct GNUNET_RECLAIM_Handle *h,
-  const struct GNUNET_IDENTITY_PrivateKey *identity,
+  const struct GNUNET_CRYPTO_PrivateKey *identity,
   const struct GNUNET_RECLAIM_Ticket *ticket,
   GNUNET_RECLAIM_ContinuationWithStatus cb,
   void *cb_cls)
@@ -1711,7 +1711,7 @@ GNUNET_RECLAIM_ticket_revoke (
   op->cls = cb_cls;
   op->r_id = rid;
   GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
-  key_len = GNUNET_IDENTITY_private_key_get_length (identity);
+  key_len = GNUNET_CRYPTO_private_key_get_length (identity);
   tkt_len = GNUNET_RECLAIM_ticket_serialize_get_size (ticket);
   op->env = GNUNET_MQ_msg_extra (msg,
                                  key_len + tkt_len,
@@ -1720,7 +1720,7 @@ GNUNET_RECLAIM_ticket_revoke (
   msg->key_len = htons (key_len);
   msg->tkt_len = htons (tkt_len);
   buf = (char*) &msg[1];
-  written = GNUNET_IDENTITY_write_private_key_to_buffer (identity,
+  written = GNUNET_CRYPTO_write_private_key_to_buffer (identity,
                                                          buf,
                                                          key_len);
   GNUNET_assert (0 <= written);
@@ -1741,8 +1741,8 @@ GNUNET_RECLAIM_ticket_serialize_get_size (const struct
                                           GNUNET_RECLAIM_Ticket *tkt)
 {
   size_t size = sizeof (tkt->rnd);
-  size += GNUNET_IDENTITY_public_key_get_length (&tkt->identity);
-  size += GNUNET_IDENTITY_public_key_get_length (&tkt->audience);
+  size += GNUNET_CRYPTO_public_key_get_length (&tkt->identity);
+  size += GNUNET_CRYPTO_public_key_get_length (&tkt->audience);
   return size;
 }
 
@@ -1756,7 +1756,7 @@ GNUNET_RECLAIM_read_ticket_from_buffer (const void 
*buffer,
   size_t read = 0;
   size_t left = len;
   if (GNUNET_SYSERR ==
-      GNUNET_IDENTITY_read_public_key_from_buffer (tmp,
+      GNUNET_CRYPTO_read_public_key_from_buffer (tmp,
                                                    left,
                                                    &tkt->identity,
                                                    &read))
@@ -1764,7 +1764,7 @@ GNUNET_RECLAIM_read_ticket_from_buffer (const void 
*buffer,
   left -= read;
   tmp += read;
   if (GNUNET_SYSERR ==
-      GNUNET_IDENTITY_read_public_key_from_buffer (tmp,
+      GNUNET_CRYPTO_read_public_key_from_buffer (tmp,
                                                    left,
                                                    &tkt->audience,
                                                    &read))
@@ -1788,14 +1788,14 @@ GNUNET_RECLAIM_write_ticket_to_buffer (const struct
   char *tmp = buffer;
   size_t left = len;
   ssize_t written = 0;
-  written = GNUNET_IDENTITY_write_public_key_to_buffer (&tkt->identity,
+  written = GNUNET_CRYPTO_write_public_key_to_buffer (&tkt->identity,
                                                         buffer,
                                                         left);
   if (0 > written)
     return written;
   left -= written;
   tmp += written;
-  written = GNUNET_IDENTITY_write_public_key_to_buffer (&tkt->audience,
+  written = GNUNET_CRYPTO_write_public_key_to_buffer (&tkt->audience,
                                                         tmp,
                                                         left);
   if (0 > written)
diff --git a/src/reclaim/test_did_helper.c b/src/reclaim/test_did_helper.c
index 02db28925..c11f47540 100644
--- a/src/reclaim/test_did_helper.c
+++ b/src/reclaim/test_did_helper.c
@@ -58,8 +58,8 @@ static const char *test_did_document_format_str =
   \"authentication\":[\"#key-1\"],\
   \"assertionMethod\":[\"#key-1\"]}";
 
-static struct GNUNET_IDENTITY_PrivateKey test_skey;
-static struct GNUNET_IDENTITY_PublicKey test_pkey;
+static struct GNUNET_CRYPTO_PrivateKey test_skey;
+static struct GNUNET_CRYPTO_PublicKey test_pkey;
 static struct json_t *test_did_document;
 static char *test_did_document_str;
 
@@ -75,7 +75,7 @@ test_GNUNET_DID_pkey_to_did ()
 void
 test_GNUNET_DID_did_to_pkey ()
 {
-  struct GNUNET_IDENTITY_PublicKey pkey;
+  struct GNUNET_CRYPTO_PublicKey pkey;
   DID_did_to_pkey ((char *) test_did, &pkey);
 
   GNUNET_assert (test_pkey.type = pkey.type);
@@ -112,11 +112,11 @@ int
 main ()
 {
   // Setup key
-  test_skey.type = htonl (GNUNET_IDENTITY_TYPE_EDDSA);
+  test_skey.type = htonl (GNUNET_PUBLIC_KEY_TYPE_EDDSA);
   memcpy (&(test_skey.eddsa_key),
           test_skey_bytes,
           sizeof(struct GNUNET_CRYPTO_EddsaPrivateKey));
-  GNUNET_IDENTITY_key_get_public (&test_skey, &test_pkey);
+  GNUNET_CRYPTO_key_get_public (&test_skey, &test_pkey);
 
   // Setup did document
   GNUNET_asprintf (&test_did_document_str,
diff --git a/src/regex/Makefile.am b/src/regex/Makefile.am
index b526a0c8c..cd96f2508 100644
--- a/src/regex/Makefile.am
+++ b/src/regex/Makefile.am
@@ -34,7 +34,7 @@ gnunet_service_regex_LDADD =  -lm \
  libgnunetregexblock.la \
  $(top_builddir)/src/dht/libgnunetdht.la \
  $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(GN_LIBINTL)
 
 lib_LTLIBRARIES = \
@@ -44,7 +44,7 @@ lib_LTLIBRARIES = \
 libgnunetregexblock_la_SOURCES = \
   regex_block_lib.c regex_block_lib.h
 libgnunetregexblock_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(XLIB) \
   $(LTLIBINTL)
 libgnunetregexblock_la_LDFLAGS = \
@@ -57,7 +57,7 @@ libgnunetregex_la_SOURCES = \
   regex_api_search.c \
   regex_ipc.h
 libgnunetregex_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 libgnunetregex_la_LDFLAGS = \
   $(GN_LIBINTL) \
   $(GN_LIB_LDFLAGS) \
@@ -71,9 +71,9 @@ libgnunet_plugin_block_regex_la_SOURCES = \
  plugin_block_regex.c
 libgnunet_plugin_block_regex_la_LIBADD = \
  libgnunetregexblock.la \
- $(top_builddir)/src/block/libgnunetblock.la \
- $(top_builddir)/src/block/libgnunetblockgroup.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/block/libgnunetblock.la \
+ $(top_builddir)/src/lib/block/libgnunetblockgroup.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 libgnunet_plugin_block_regex_la_LDFLAGS = \
  $(GN_LIBINTL) \
  $(GN_PLUGIN_LDFLAGS)
@@ -87,9 +87,9 @@ libgnunet_plugin_block_regex_la_LDFLAGS = \
 #  $(REGEX_INTERNAL) gnunet-regex-simulation-profiler.c
 #gnunet_regex_simulation_profiler_LDADD = \
 #  libgnunetregexblock.la \
-#  $(top_builddir)/src/util/libgnunetutil.la \
+#  $(top_builddir)/src/lib/util/libgnunetutil.la \
 #  $(top_builddir)/src/dht/libgnunetdht.la \
-#  $(top_builddir)/src/block/libgnunetblock.la \
+#  $(top_builddir)/src/lib/block/libgnunetblock.la \
 #  $(top_builddir)/src/statistics/libgnunetstatistics.la
 #endif
 
@@ -101,7 +101,7 @@ perf_regex_SOURCES = \
 perf_regex_LDADD = -lm \
   $(top_builddir)/src/dht/libgnunetdht.la \
   libgnunetregexblock.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la
 perf_regex_LDFLAGS = \
   $(GN_LIBINTL)
@@ -112,7 +112,7 @@ gnunet_daemon_regexprofiler_LDADD = -lm \
   $(top_builddir)/src/dht/libgnunetdht.la \
   libgnunetregexblock.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 gnunet_daemon_regexprofiler_LDFLAGS = \
   $(GN_LIBINTL)
 
@@ -135,21 +135,21 @@ test_regex_eval_api_LDADD = -lm \
   $(top_builddir)/src/dht/libgnunetdht.la \
   libgnunetregexblock.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_regex_integration_SOURCES = \
   test_regex_integration.c
 test_regex_integration_LDADD = -lm \
   libgnunetregex.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_regex_api_SOURCES = \
   test_regex_api.c
 test_regex_api_LDADD = -lm \
   libgnunetregex.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_regex_iterate_api_SOURCES = \
   $(REGEX_INTERNAL) test_regex_iterate_api.c
@@ -157,7 +157,7 @@ test_regex_iterate_api_LDADD = -lm \
   libgnunetregexblock.la \
   $(top_builddir)/src/dht/libgnunetdht.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_regex_proofs_SOURCES = \
   $(REGEX_INTERNAL_TEST) test_regex_proofs.c
@@ -165,7 +165,7 @@ test_regex_proofs_LDADD = -lm \
   $(top_builddir)/src/dht/libgnunetdht.la \
   libgnunetregexblock.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_regex_graph_api_SOURCES = \
   $(REGEX_INTERNAL_TEST) test_regex_graph_api.c
@@ -173,7 +173,7 @@ test_regex_graph_api_LDADD = -lm \
   $(top_builddir)/src/dht/libgnunetdht.la \
   libgnunetregexblock.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 
 EXTRA_DIST = \
diff --git a/src/rest/Makefile.am b/src/rest/Makefile.am
index 41b4c6508..e3952a45e 100644
--- a/src/rest/Makefile.am
+++ b/src/rest/Makefile.am
@@ -32,7 +32,7 @@ libgnunet_plugin_rest_copying_la_SOURCES = \
   plugin_rest_copying.c
 libgnunet_plugin_rest_copying_la_LIBADD = \
   libgnunetrest.la \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \
   $(LTLIBINTL) $(MHD_LIBS)
 libgnunet_plugin_rest_copying_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -42,7 +42,7 @@ libgnunet_plugin_rest_config_la_SOURCES = \
   plugin_rest_config.c
 libgnunet_plugin_rest_config_la_LIBADD = \
   libgnunetrest.la \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \
   $(LTLIBINTL) $(MHD_LIBS) -ljansson
 libgnunet_plugin_rest_config_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
@@ -53,14 +53,14 @@ libgnunet_plugin_rest_config_la_CFLAGS = $(MHD_CFLAGS) 
$(AM_CFLAGS)
 gnunet_rest_server_SOURCES = \
  gnunet-rest-server.c
 gnunet_rest_server_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL) $(MHD_LIBS)
 gnunet_rest_server_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS)
 
 libgnunetrest_la_SOURCES = \
   rest.c
 libgnunetrest_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIB) \
+  $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIB) \
   $(GN_LIBINTL) $(MHD_LIBS)
 libgnunetrest_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS) \
diff --git a/src/revocation/Makefile.am b/src/revocation/Makefile.am
index a375b7587..8afb58a80 100644
--- a/src/revocation/Makefile.am
+++ b/src/revocation/Makefile.am
@@ -25,9 +25,9 @@ libgnunet_plugin_block_revocation_la_SOURCES = \
   plugin_block_revocation.c
 libgnunet_plugin_block_revocation_la_LIBADD = \
   libgnunetrevocation.la \
-  $(top_builddir)/src/block/libgnunetblockgroup.la \
-  $(top_builddir)/src/block/libgnunetblock.la \
-  $(top_builddir)/src/util/libgnunetutil.la  \
+  $(top_builddir)/src/lib/block/libgnunetblockgroup.la \
+  $(top_builddir)/src/lib/block/libgnunetblock.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la  \
   $(top_builddir)/src/identity/libgnunetidentity.la  \
   $(LTLIBINTL)
 libgnunet_plugin_block_revocation_la_LDFLAGS = \
@@ -39,7 +39,7 @@ gnunet_revocation_SOURCES = \
 gnunet_revocation_LDADD = \
   libgnunetrevocation.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 gnunet_revocation_tvg_SOURCES = \
@@ -47,7 +47,7 @@ gnunet_revocation_tvg_SOURCES = \
 gnunet_revocation_tvg_LDADD = \
   libgnunetrevocation.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 test_revocation_lsd0001testvectors_SOURCES = \
@@ -56,14 +56,14 @@ test_revocation_lsd0001testvectors_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
        $(top_builddir)/src/identity/libgnunetidentity.la \
   libgnunetrevocation.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 lib_LTLIBRARIES = libgnunetrevocation.la
 
 libgnunetrevocation_la_SOURCES = \
   revocation_api.c revocation.h
 libgnunetrevocation_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(LIBGCRYPT_LIBS) \
   $(GN_LIBINTL) $(XLIB) -lgcrypt
@@ -85,7 +85,7 @@ gnunet_service_revocation_LDADD = \
   $(top_builddir)/src/setu/libgnunetsetu.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/identity/libgnunetidentity.la  \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   -lm \
   $(GN_LIBINTL)
 
@@ -95,7 +95,7 @@ test_revocation_LDADD = \
  $(top_builddir)/src/identity/libgnunetidentity.la \
  libgnunetrevocation.la \
  $(top_builddir)/src//core/libgnunetcore.la \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(top_builddir)/src/testbed/libgnunettestbed.la
 
 check_PROGRAMS = \
diff --git a/src/revocation/gnunet-revocation-tvg.c 
b/src/revocation/gnunet-revocation-tvg.c
index e8b0820bb..b59b7ba62 100644
--- a/src/revocation/gnunet-revocation-tvg.c
+++ b/src/revocation/gnunet-revocation-tvg.c
@@ -101,25 +101,25 @@ print_bytes (void *buf,
 
 
 static void
-run_with_key (struct GNUNET_IDENTITY_PrivateKey *id_priv)
+run_with_key (struct GNUNET_CRYPTO_PrivateKey *id_priv)
 {
-  struct GNUNET_IDENTITY_PublicKey id_pub;
+  struct GNUNET_CRYPTO_PublicKey id_pub;
   struct GNUNET_REVOCATION_PowP *pow;
   struct GNUNET_REVOCATION_PowCalculationHandle *ph;
   struct GNUNET_TIME_Relative exp;
   char ztld[128];
   ssize_t key_len;
 
-  GNUNET_IDENTITY_key_get_public (id_priv,
+  GNUNET_CRYPTO_key_get_public (id_priv,
                                   &id_pub);
   GNUNET_STRINGS_data_to_string (&id_pub,
-                                 GNUNET_IDENTITY_public_key_get_length (
+                                 GNUNET_CRYPTO_public_key_get_length (
                                    &id_pub),
                                  ztld,
                                  sizeof (ztld));
   fprintf (stdout, "\n");
   fprintf (stdout, "Zone identifier (ztype|zkey):\n");
-  key_len = GNUNET_IDENTITY_public_key_get_length (&id_pub);
+  key_len = GNUNET_CRYPTO_public_key_get_length (&id_pub);
   GNUNET_assert (0 < key_len);
   print_bytes (&id_pub, key_len, 8);
   fprintf (stdout, "\n");
@@ -178,16 +178,16 @@ run (void *cls,
      const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
-  struct GNUNET_IDENTITY_PrivateKey id_priv;
+  struct GNUNET_CRYPTO_PrivateKey id_priv;
 
-  id_priv.type = htonl (GNUNET_IDENTITY_TYPE_ECDSA);
+  id_priv.type = htonl (GNUNET_PUBLIC_KEY_TYPE_ECDSA);
   parsehex (d_pkey,(char*) &id_priv.ecdsa_key, sizeof (id_priv.ecdsa_key), 1);
 
   fprintf (stdout, "Zone private key (d, big-endian):\n");
   print_bytes_ (&id_priv.ecdsa_key, sizeof(id_priv.ecdsa_key), 8, 1);
   run_with_key (&id_priv);
   printf ("\n");
-  id_priv.type = htonl (GNUNET_IDENTITY_TYPE_EDDSA);
+  id_priv.type = htonl (GNUNET_PUBLIC_KEY_TYPE_EDDSA);
   parsehex (d_edkey,(char*) &id_priv.eddsa_key, sizeof (id_priv.eddsa_key), 0);
 
   fprintf (stdout, "Zone private key (d):\n");
diff --git a/src/revocation/gnunet-revocation.c 
b/src/revocation/gnunet-revocation.c
index 853ca0f71..9667e7655 100644
--- a/src/revocation/gnunet-revocation.c
+++ b/src/revocation/gnunet-revocation.c
@@ -323,8 +323,8 @@ calculate_pow (void *cls)
 static void
 ego_callback (void *cls, struct GNUNET_IDENTITY_Ego *ego)
 {
-  struct GNUNET_IDENTITY_PublicKey key;
-  const struct GNUNET_IDENTITY_PrivateKey *privkey;
+  struct GNUNET_CRYPTO_PublicKey key;
+  const struct GNUNET_CRYPTO_PrivateKey *privkey;
   struct GNUNET_REVOCATION_PowCalculationHandle *ph = NULL;
   size_t psize;
 
@@ -343,7 +343,7 @@ ego_callback (void *cls, struct GNUNET_IDENTITY_Ego *ego)
               GNUNET_DISK_fn_read (filename, proof_of_work,
                                    GNUNET_REVOCATION_MAX_PROOF_SIZE))))
   {
-    ssize_t ksize = GNUNET_IDENTITY_public_key_get_length (&key);
+    ssize_t ksize = GNUNET_CRYPTO_public_key_get_length (&key);
     if (0 > ksize)
     {
       fprintf (stderr,
@@ -411,14 +411,14 @@ run (void *cls,
      const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
-  struct GNUNET_IDENTITY_PublicKey pk;
+  struct GNUNET_CRYPTO_PublicKey pk;
   size_t psize;
 
   cfg = c;
   if (NULL != test_ego)
   {
     if (GNUNET_OK !=
-        GNUNET_IDENTITY_public_key_from_string (test_ego,
+        GNUNET_CRYPTO_public_key_from_string (test_ego,
                                                 &pk))
     {
       fprintf (stderr, _ ("Public key `%s' malformed\n"), test_ego);
diff --git a/src/revocation/gnunet-service-revocation.c 
b/src/revocation/gnunet-service-revocation.c
index 2cee70857..3755b87e5 100644
--- a/src/revocation/gnunet-service-revocation.c
+++ b/src/revocation/gnunet-service-revocation.c
@@ -250,7 +250,7 @@ handle_query_message (void *cls,
                       const struct QueryMessage *qm)
 {
   struct GNUNET_SERVICE_Client *client = cls;
-  struct GNUNET_IDENTITY_PublicKey zone;
+  struct GNUNET_CRYPTO_PublicKey zone;
   struct GNUNET_MQ_Envelope *env;
   struct QueryResponseMessage *qrm;
   struct GNUNET_HashCode hc;
@@ -260,7 +260,7 @@ handle_query_message (void *cls,
 
   key_len = ntohl (qm->key_len);
   if ((GNUNET_SYSERR ==
-       GNUNET_IDENTITY_read_public_key_from_buffer (&qm[1], key_len,
+       GNUNET_CRYPTO_read_public_key_from_buffer (&qm[1], key_len,
                                                     &zone, &read)) ||
       (read != key_len))
   {
@@ -344,11 +344,11 @@ publicize_rm (const struct RevokeMessage *rm)
   ssize_t pklen;
   const struct GNUNET_REVOCATION_PowP *pow
     = (const struct GNUNET_REVOCATION_PowP *) &rm[1];
-  const struct GNUNET_IDENTITY_PublicKey *pk
-    = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
+  const struct GNUNET_CRYPTO_PublicKey *pk
+    = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1];
 
   /** FIXME yeah this works, but should we have a key length somewhere? */
-  pklen = GNUNET_IDENTITY_public_key_get_length (pk);
+  pklen = GNUNET_CRYPTO_public_key_get_length (pk);
   if (0 > pklen)
   {
     GNUNET_break_op (0);
@@ -879,7 +879,7 @@ run (void *cls,
   uint64_t left;
   struct RevokeMessage *rm;
   struct GNUNET_HashCode hc;
-  const struct GNUNET_IDENTITY_PublicKey *pk;
+  const struct GNUNET_CRYPTO_PublicKey *pk;
 
   GNUNET_CRYPTO_hash ("revocation-set-union-application-id",
                       strlen ("revocation-set-union-application-id"),
@@ -983,8 +983,8 @@ run (void *cls,
     struct GNUNET_REVOCATION_PowP *pow = (struct
                                           GNUNET_REVOCATION_PowP *) &rm[1];
     ssize_t ksize;
-    pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
-    ksize = GNUNET_IDENTITY_public_key_get_length (pk);
+    pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1];
+    ksize = GNUNET_CRYPTO_public_key_get_length (pk);
     if (0 > ksize)
     {
       GNUNET_break_op (0);
diff --git a/src/revocation/plugin_block_revocation.c 
b/src/revocation/plugin_block_revocation.c
index 7de4fafe9..9686f23ff 100644
--- a/src/revocation/plugin_block_revocation.c
+++ b/src/revocation/plugin_block_revocation.c
@@ -94,7 +94,7 @@ block_plugin_revocation_check_block (void *cls,
   const struct RevokeMessage *rm = block;
   const struct GNUNET_REVOCATION_PowP *pow
     = (const struct GNUNET_REVOCATION_PowP *) &rm[1];
-  struct GNUNET_IDENTITY_PublicKey pk;
+  struct GNUNET_CRYPTO_PublicKey pk;
   size_t pklen;
   size_t left;
 
@@ -115,7 +115,7 @@ block_plugin_revocation_check_block (void *cls,
   }
   left = block_size - sizeof (*rm) - sizeof (*pow);
   if (GNUNET_SYSERR ==
-      GNUNET_IDENTITY_read_public_key_from_buffer (&pow[1],
+      GNUNET_CRYPTO_read_public_key_from_buffer (&pow[1],
                                                    left,
                                                    &pk,
                                                    &pklen))
@@ -204,7 +204,7 @@ block_plugin_revocation_get_key (void *cls,
   const struct RevokeMessage *rm = block;
   const struct GNUNET_REVOCATION_PowP *pow
     = (const struct GNUNET_REVOCATION_PowP *) &rm[1];
-  struct GNUNET_IDENTITY_PublicKey pk;
+  struct GNUNET_CRYPTO_PublicKey pk;
   size_t pklen;
   size_t left;
 
@@ -224,7 +224,7 @@ block_plugin_revocation_get_key (void *cls,
     return GNUNET_NO;
   }
   left = block_size - sizeof (*rm) - sizeof (*pow);
-  if (GNUNET_SYSERR == GNUNET_IDENTITY_read_public_key_from_buffer (&pow[1],
+  if (GNUNET_SYSERR == GNUNET_CRYPTO_read_public_key_from_buffer (&pow[1],
                                                                     left,
                                                                     &pk,
                                                                     &pklen))
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c
index 819c34b71..3b7d83710 100644
--- a/src/revocation/revocation_api.c
+++ b/src/revocation/revocation_api.c
@@ -160,7 +160,7 @@ handle_revocation_query_response (void *cls,
  */
 struct GNUNET_REVOCATION_Query *
 GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                         const struct GNUNET_IDENTITY_PublicKey *key,
+                         const struct GNUNET_CRYPTO_PublicKey *key,
                          GNUNET_REVOCATION_Callback func,
                          void *func_cls)
 {
@@ -189,10 +189,10 @@ GNUNET_REVOCATION_query (const struct 
GNUNET_CONFIGURATION_Handle *cfg,
   }
   q->func = func;
   q->func_cls = func_cls;
-  key_len = GNUNET_IDENTITY_public_key_get_length (key);
+  key_len = GNUNET_CRYPTO_public_key_get_length (key);
   env = GNUNET_MQ_msg_extra (qm, key_len,
                              GNUNET_MESSAGE_TYPE_REVOCATION_QUERY);
-  GNUNET_IDENTITY_write_public_key_to_buffer (key, &qm[1], key_len);
+  GNUNET_CRYPTO_write_public_key_to_buffer (key, &qm[1], key_len);
   qm->key_len = htonl (key_len);
   GNUNET_MQ_send (q->mq,
                   env);
@@ -406,16 +406,16 @@ struct GNUNET_REVOCATION_SignaturePurposePS *
 REV_create_signature_message (const struct GNUNET_REVOCATION_PowP *pow)
 {
   struct GNUNET_REVOCATION_SignaturePurposePS *spurp;
-  const struct GNUNET_IDENTITY_PublicKey *pk;
+  const struct GNUNET_CRYPTO_PublicKey *pk;
   size_t ksize;
 
-  pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
-  ksize = GNUNET_IDENTITY_public_key_get_length (pk);
+  pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1];
+  ksize = GNUNET_CRYPTO_public_key_get_length (pk);
   spurp = GNUNET_malloc (sizeof (*spurp) + ksize);
   spurp->timestamp = pow->timestamp;
   spurp->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_REVOCATION);
   spurp->purpose.size = htonl (sizeof(*spurp) + ksize);
-  GNUNET_IDENTITY_write_public_key_to_buffer (pk,
+  GNUNET_CRYPTO_write_public_key_to_buffer (pk,
                                               (char*) &spurp[1],
                                               ksize);
   return spurp;
@@ -424,18 +424,18 @@ REV_create_signature_message (const struct 
GNUNET_REVOCATION_PowP *pow)
 
 enum GNUNET_GenericReturnValue
 check_signature_identity (const struct GNUNET_REVOCATION_PowP *pow,
-                          const struct GNUNET_IDENTITY_PublicKey *key)
+                          const struct GNUNET_CRYPTO_PublicKey *key)
 {
   struct GNUNET_REVOCATION_SignaturePurposePS *spurp;
   unsigned char *sig;
   size_t ksize;
   int ret;
 
-  ksize = GNUNET_IDENTITY_public_key_get_length (key);
+  ksize = GNUNET_CRYPTO_public_key_get_length (key);
   spurp = REV_create_signature_message (pow);
   sig = ((unsigned char*) &pow[1] + ksize);
   ret =
-    GNUNET_IDENTITY_signature_verify_raw_ (
+    GNUNET_CRYPTO_signature_verify_raw_ (
       GNUNET_SIGNATURE_PURPOSE_GNS_REVOCATION,
       &spurp->purpose,
       sig,
@@ -448,9 +448,9 @@ check_signature_identity (const struct 
GNUNET_REVOCATION_PowP *pow,
 enum GNUNET_GenericReturnValue
 check_signature (const struct GNUNET_REVOCATION_PowP *pow)
 {
-  const struct GNUNET_IDENTITY_PublicKey *pk;
+  const struct GNUNET_CRYPTO_PublicKey *pk;
 
-  pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
+  pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1];
   return check_signature_identity (pow, pk);
 }
 
@@ -468,7 +468,7 @@ GNUNET_REVOCATION_check_pow (const struct 
GNUNET_REVOCATION_PowP *pow,
                              unsigned int difficulty,
                              struct GNUNET_TIME_Relative epoch_duration)
 {
-  char buf[sizeof(struct GNUNET_IDENTITY_PublicKey)
+  char buf[sizeof(struct GNUNET_CRYPTO_PublicKey)
            + sizeof (struct GNUNET_TIME_AbsoluteNBO)
            + sizeof (uint64_t)] GNUNET_ALIGN;
   struct GNUNET_HashCode result;
@@ -482,9 +482,9 @@ GNUNET_REVOCATION_check_pow (const struct 
GNUNET_REVOCATION_PowP *pow,
   unsigned int epochs;
   uint64_t pow_val;
   ssize_t pklen;
-  const struct GNUNET_IDENTITY_PublicKey *pk;
+  const struct GNUNET_CRYPTO_PublicKey *pk;
 
-  pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
+  pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1];
 
   /**
    * Check if signature valid
@@ -507,7 +507,7 @@ GNUNET_REVOCATION_check_pow (const struct 
GNUNET_REVOCATION_PowP *pow,
   GNUNET_memcpy (&buf[sizeof(uint64_t)],
                  &pow->timestamp,
                  sizeof (uint64_t));
-  pklen = GNUNET_IDENTITY_public_key_get_length (pk);
+  pklen = GNUNET_CRYPTO_public_key_get_length (pk);
   if (0 > pklen)
   {
     GNUNET_break (0);
@@ -566,12 +566,12 @@ GNUNET_REVOCATION_check_pow (const struct 
GNUNET_REVOCATION_PowP *pow,
 
 
 enum GNUNET_GenericReturnValue
-sign_pow_identity (const struct GNUNET_IDENTITY_PrivateKey *key,
+sign_pow_identity (const struct GNUNET_CRYPTO_PrivateKey *key,
                    struct GNUNET_REVOCATION_PowP *pow)
 {
   struct GNUNET_TIME_Absolute ts = GNUNET_TIME_absolute_get ();
   struct GNUNET_REVOCATION_SignaturePurposePS *rp;
-  const struct GNUNET_IDENTITY_PublicKey *pk;
+  const struct GNUNET_CRYPTO_PublicKey *pk;
   size_t ksize;
   char *sig;
 
@@ -581,12 +581,12 @@ sign_pow_identity (const struct 
GNUNET_IDENTITY_PrivateKey *key,
    */
   ts = GNUNET_TIME_absolute_subtract (ts,
                                       GNUNET_TIME_UNIT_WEEKS);
-  pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
-  ksize = GNUNET_IDENTITY_public_key_get_length (pk);
+  pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1];
+  ksize = GNUNET_CRYPTO_public_key_get_length (pk);
   pow->timestamp = GNUNET_TIME_absolute_hton (ts);
   rp = REV_create_signature_message (pow);
   sig = ((char*) &pow[1]) + ksize;
-  int result = GNUNET_IDENTITY_sign_raw_ (key,
+  int result = GNUNET_CRYPTO_sign_raw_ (key,
                                           &rp->purpose,
                                           (void*) sig);
   GNUNET_free (rp);
@@ -598,13 +598,13 @@ sign_pow_identity (const struct 
GNUNET_IDENTITY_PrivateKey *key,
 
 
 enum GNUNET_GenericReturnValue
-sign_pow (const struct GNUNET_IDENTITY_PrivateKey *key,
+sign_pow (const struct GNUNET_CRYPTO_PrivateKey *key,
           struct GNUNET_REVOCATION_PowP *pow)
 {
-  struct GNUNET_IDENTITY_PublicKey *pk;
+  struct GNUNET_CRYPTO_PublicKey *pk;
 
-  pk = (struct GNUNET_IDENTITY_PublicKey *) &pow[1];
-  GNUNET_IDENTITY_key_get_public (key, pk);
+  pk = (struct GNUNET_CRYPTO_PublicKey *) &pow[1];
+  GNUNET_CRYPTO_key_get_public (key, pk);
   return sign_pow_identity (key, pow);
 }
 
@@ -616,7 +616,7 @@ sign_pow (const struct GNUNET_IDENTITY_PrivateKey *key,
  * @param[out] pow starting point for PoW calculation (not yet valid)
  */
 void
-GNUNET_REVOCATION_pow_init (const struct GNUNET_IDENTITY_PrivateKey *key,
+GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_PrivateKey *key,
                             struct GNUNET_REVOCATION_PowP *pow)
 {
   GNUNET_assert (GNUNET_OK == sign_pow (key, pow));
@@ -672,18 +672,18 @@ cmp_pow_value (const void *a, const void *b)
 enum GNUNET_GenericReturnValue
 GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc)
 {
-  char buf[sizeof(struct GNUNET_IDENTITY_PublicKey)
+  char buf[sizeof(struct GNUNET_CRYPTO_PublicKey)
            + sizeof (uint64_t)
            + sizeof (uint64_t)] GNUNET_ALIGN;
   struct GNUNET_HashCode result;
-  const struct GNUNET_IDENTITY_PublicKey *pk;
+  const struct GNUNET_CRYPTO_PublicKey *pk;
   unsigned int zeros;
   int ret;
   uint64_t pow_nbo;
   ssize_t ksize;
 
   pc->current_pow++;
-  pk = (const struct GNUNET_IDENTITY_PublicKey *) &(pc->pow[1]);
+  pk = (const struct GNUNET_CRYPTO_PublicKey *) &(pc->pow[1]);
 
   /**
    * Do not try duplicates
@@ -696,7 +696,7 @@ GNUNET_REVOCATION_pow_round (struct 
GNUNET_REVOCATION_PowCalculationHandle *pc)
   GNUNET_memcpy (&buf[sizeof(uint64_t)],
                  &pc->pow->timestamp,
                  sizeof (uint64_t));
-  ksize = GNUNET_IDENTITY_public_key_get_length (pk);
+  ksize = GNUNET_CRYPTO_public_key_get_length (pk);
   GNUNET_assert (0 < ksize);
   GNUNET_memcpy (&buf[sizeof(uint64_t) * 2],
                  pk,
@@ -750,13 +750,13 @@ GNUNET_REVOCATION_proof_get_size (const struct 
GNUNET_REVOCATION_PowP *pow)
 {
   size_t size;
   size_t ksize;
-  const struct GNUNET_IDENTITY_PublicKey *pk;
+  const struct GNUNET_CRYPTO_PublicKey *pk;
 
   size = sizeof (struct GNUNET_REVOCATION_PowP);
-  pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
-  ksize = GNUNET_IDENTITY_public_key_get_length (pk);
+  pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1];
+  ksize = GNUNET_CRYPTO_public_key_get_length (pk);
   size += ksize;
-  size += GNUNET_IDENTITY_signature_get_raw_length_by_type (pk->type);
+  size += GNUNET_CRYPTO_signature_get_raw_length_by_type (pk->type);
   return size;
 }
 
diff --git a/src/revocation/test_revocation.c b/src/revocation/test_revocation.c
index e6dd1a0db..0fc3ac7e5 100644
--- a/src/revocation/test_revocation.c
+++ b/src/revocation/test_revocation.c
@@ -38,8 +38,8 @@ struct TestPeer
   struct GNUNET_TESTBED_Operation *core_op;
   struct GNUNET_IDENTITY_Handle *idh;
   const struct GNUNET_CONFIGURATION_Handle *cfg;
-  const struct GNUNET_IDENTITY_PrivateKey *privkey;
-  struct GNUNET_IDENTITY_PublicKey pubkey;
+  const struct GNUNET_CRYPTO_PrivateKey *privkey;
+  struct GNUNET_CRYPTO_PublicKey pubkey;
   struct GNUNET_CRYPTO_EcdsaSignature sig;
   struct GNUNET_IDENTITY_Operation *create_id_op;
   struct GNUNET_IDENTITY_EgoLookup *ego_lookup;
@@ -148,7 +148,7 @@ static void
 ego_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
 {
   static int completed = 0;
-  const struct GNUNET_IDENTITY_PrivateKey *privkey;
+  const struct GNUNET_CRYPTO_PrivateKey *privkey;
 
   if ((NULL != ego) && (cls == &testpeers[0]))
   {
@@ -194,7 +194,7 @@ ego_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
 
 static void
 identity_create_cb (void *cls,
-                    const struct GNUNET_IDENTITY_PrivateKey *pk,
+                    const struct GNUNET_CRYPTO_PrivateKey *pk,
                     enum GNUNET_ErrorCode ec)
 {
   static int completed = 0;
@@ -238,13 +238,13 @@ identity_completion_cb (void *cls,
   testpeers[0].create_id_op = GNUNET_IDENTITY_create (testpeers[0].idh,
                                                       "client",
                                                       NULL,
-                                                      
GNUNET_IDENTITY_TYPE_ECDSA,
+                                                      
GNUNET_PUBLIC_KEY_TYPE_ECDSA,
                                                       &identity_create_cb,
                                                       &testpeers[0]);
   testpeers[1].create_id_op = GNUNET_IDENTITY_create (testpeers[1].idh,
                                                       "toberevoked",
                                                       NULL,
-                                                      
GNUNET_IDENTITY_TYPE_ECDSA,
+                                                      
GNUNET_PUBLIC_KEY_TYPE_ECDSA,
                                                       &identity_create_cb,
                                                       &testpeers[1]);
 }
diff --git a/src/revocation/test_revocation_testvectors.c 
b/src/revocation/test_revocation_testvectors.c
index 355576fb7..a669e1b7e 100644
--- a/src/revocation/test_revocation_testvectors.c
+++ b/src/revocation/test_revocation_testvectors.c
@@ -239,9 +239,9 @@ parsehex (char *src, char *dst, size_t dstlen, int invert)
 int
 main ()
 {
-  struct GNUNET_IDENTITY_PrivateKey priv;
-  struct GNUNET_IDENTITY_PublicKey pub;
-  struct GNUNET_IDENTITY_PublicKey pub_parsed;
+  struct GNUNET_CRYPTO_PrivateKey priv;
+  struct GNUNET_CRYPTO_PublicKey pub;
+  struct GNUNET_CRYPTO_PublicKey pub_parsed;
   struct GNUNET_TIME_Relative exprel;
   struct GNUNET_REVOCATION_PowP *pow;
   char m[8096];
@@ -255,8 +255,8 @@ main ()
     parsehex (rtvs[i].d,(char*) &priv.ecdsa_key, sizeof (priv.ecdsa_key),
               (GNUNET_GNSRECORD_TYPE_PKEY == ntohl (pub_parsed.type)) ? 1 : 0);
     priv.type = pub_parsed.type;
-    GNUNET_IDENTITY_key_get_public (&priv, &pub);
-    if (0 != memcmp (&pub, &pub_parsed, GNUNET_IDENTITY_public_key_get_length (
+    GNUNET_CRYPTO_key_get_public (&priv, &pub);
+    if (0 != memcmp (&pub, &pub_parsed, GNUNET_CRYPTO_public_key_get_length (
                        &pub)))
     {
       printf ("Wrong pubkey.\n");
@@ -266,7 +266,7 @@ main ()
       break;
     }
     GNUNET_STRINGS_data_to_string (&pub,
-                                   GNUNET_IDENTITY_public_key_get_length (
+                                   GNUNET_CRYPTO_public_key_get_length (
                                      &pub),
                                    ztld,
                                    sizeof (ztld));
diff --git a/src/rps/Makefile.am b/src/rps/Makefile.am
index db3174a82..bf34a29d7 100644
--- a/src/rps/Makefile.am
+++ b/src/rps/Makefile.am
@@ -20,7 +20,7 @@ gnunet_rps_SOURCES = \
 
 gnunet_rps_LDADD = \
   libgnunetrps.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(XLIB) $(GN_LIBINTL)
 
 lib_LTLIBRARIES = libgnunetrps.la
@@ -33,7 +33,7 @@ libgnunetrps_la_SOURCES = \
   rps_api.c rps.h
 libgnunetrps_la_LIBADD = \
   $(top_builddir)/src/nse/libgnunetnse.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL) $(XLIB)
 libgnunetrps_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)   \
@@ -60,7 +60,7 @@ gnunet_service_rps_SOURCES = \
 
 gnunet_service_rps_LDADD = \
   libgnunetrps.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/cadet/libgnunetcadet.la \
   $(top_builddir)/src/nse/libgnunetnse.la \
@@ -95,7 +95,7 @@ rps_test_src = \
 
 #ld_rps_test_lib = \
 #      libgnunetrps.la \
-#  $(top_builddir)/src/util/libgnunetutil.la \
+#  $(top_builddir)/src/lib/util/libgnunetutil.la \
 #  $(top_builddir)/src/statistics/libgnunetstatistics.la \
 #  $(top_builddir)/src/testbed/libgnunettestbed.la \
 #  -lm
@@ -108,19 +108,19 @@ endif
 test_service_rps_view_SOURCES = \
   gnunet-service-rps_view.h gnunet-service-rps_view.c \
   test_service_rps_view.c
-test_service_rps_view_LDADD = $(top_builddir)/src/util/libgnunetutil.la
+test_service_rps_view_LDADD = $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_service_rps_custommap_SOURCES = \
   gnunet-service-rps_custommap.h gnunet-service-rps_custommap.c \
   test_service_rps_custommap.c
 test_service_rps_custommap_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_service_rps_sampler_elem_SOURCES = \
   gnunet-service-rps_sampler_elem.h gnunet-service-rps_sampler_elem.c \
   rps-test_util.h rps-test_util.c \
   test_service_rps_sampler_elem.c
-test_service_rps_sampler_elem_LDADD = $(top_builddir)/src/util/libgnunetutil.la
+test_service_rps_sampler_elem_LDADD = 
$(top_builddir)/src/lib/util/libgnunetutil.la
 
 #test_rps_single_req_SOURCES = $(rps_test_src)
 #test_rps_single_req_LDADD = $(ld_rps_test_lib)
@@ -158,7 +158,7 @@ test_service_rps_sampler_elem_LDADD = 
$(top_builddir)/src/util/libgnunetutil.la
 #gnunet_rps_profiler_LDADD = \
 #  $(top_builddir)/src/statistics/libgnunetstatistics.la \
 #  libgnunetrps.la \
-#  $(top_builddir)/src/util/libgnunetutil.la \
+#  $(top_builddir)/src/lib/util/libgnunetutil.la \
 #  $(top_builddir)/src/testbed/libgnunettestbed.la \
 #  -lm
 
diff --git a/src/scalarproduct/Makefile.am b/src/scalarproduct/Makefile.am
index 8b3b160c6..ef9f8b245 100644
--- a/src/scalarproduct/Makefile.am
+++ b/src/scalarproduct/Makefile.am
@@ -27,7 +27,7 @@ lib_LTLIBRARIES = \
 gnunet_scalarproduct_SOURCES = \
   gnunet-scalarproduct.c
 gnunet_scalarproduct_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   libgnunetscalarproduct.la \
   $(LIBGCRYPT_LIBS) \
   -lgcrypt \
@@ -37,7 +37,7 @@ gnunet_service_scalarproduct_alice_SOURCES = \
   gnunet-service-scalarproduct.h \
   gnunet-service-scalarproduct_alice.c
 gnunet_service_scalarproduct_alice_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/cadet/libgnunetcadet.la \
   $(top_builddir)/src/seti/libgnunetseti.la \
   $(LIBGCRYPT_LIBS) \
@@ -48,7 +48,7 @@ gnunet_service_scalarproduct_bob_SOURCES = \
   gnunet-service-scalarproduct.h \
   gnunet-service-scalarproduct_bob.c
 gnunet_service_scalarproduct_bob_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/cadet/libgnunetcadet.la \
   $(top_builddir)/src/seti/libgnunetseti.la \
   $(LIBGCRYPT_LIBS) \
@@ -59,7 +59,7 @@ gnunet_service_scalarproduct_ecc_alice_SOURCES = \
   gnunet-service-scalarproduct-ecc.h \
   gnunet-service-scalarproduct-ecc_alice.c
 gnunet_service_scalarproduct_ecc_alice_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/cadet/libgnunetcadet.la \
   $(top_builddir)/src/seti/libgnunetseti.la \
   $(LIBGCRYPT_LIBS) \
@@ -71,7 +71,7 @@ gnunet_service_scalarproduct_ecc_bob_SOURCES = \
   gnunet-service-scalarproduct-ecc.h \
   gnunet-service-scalarproduct-ecc_bob.c
 gnunet_service_scalarproduct_ecc_bob_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/cadet/libgnunetcadet.la \
   $(top_builddir)/src/seti/libgnunetseti.la \
   $(LIBGCRYPT_LIBS) \
@@ -83,7 +83,7 @@ libgnunetscalarproduct_la_SOURCES = \
   scalarproduct_api.c \
   scalarproduct.h
 libgnunetscalarproduct_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(LIBGCRYPT_LIBS) \
   -lgcrypt \
@@ -112,5 +112,5 @@ endif
 test_ecc_scalarproduct_SOURCES = \
  test_ecc_scalarproduct.c
 test_ecc_scalarproduct_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   -lsodium
diff --git a/src/secretsharing/Makefile.am b/src/secretsharing/Makefile.am
index 3a86236cd..30b3f8057 100644
--- a/src/secretsharing/Makefile.am
+++ b/src/secretsharing/Makefile.am
@@ -30,7 +30,7 @@ lib_LTLIBRARIES = \
 #  libgnunetsecretsharing.la \
 #  $(top_builddir)/src/testing/libgnunettesting.la \
 #  $(top_builddir)/src/testbed/libgnunettestbed.la \
-#  $(top_builddir)/src/util/libgnunetutil.la \
+#  $(top_builddir)/src/lib/util/libgnunetutil.la \
 #  $(GN_LIBINTL)
 
 gnunet_service_secretsharing_SOURCES = \
@@ -39,7 +39,7 @@ gnunet_service_secretsharing_SOURCES = \
  secretsharing_protocol.h
 gnunet_service_secretsharing_CFLAGS = $(AM_CFLAGS)
 gnunet_service_secretsharing_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/consensus/libgnunetconsensus.la \
   $(LIBGCRYPT_LIBS) \
   $(GN_LIBINTL)
@@ -49,7 +49,7 @@ libgnunetsecretsharing_la_SOURCES = \
   secretsharing_common.c \
   secretsharing.h
 libgnunetsecretsharing_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LIBGCRYPT_LIBS) \
   $(LTLIBINTL)
 libgnunetsecretsharing_la_LDFLAGS = \
@@ -68,7 +68,7 @@ test_secretsharing_api_SOURCES = \
 test_secretsharing_api_LDADD = \
   libgnunetsecretsharing.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 EXTRA_DIST = \
   test_secretsharing.conf
diff --git a/src/service/Makefile.am b/src/service/Makefile.am
new file mode 100644
index 000000000..d94046cde
--- /dev/null
+++ b/src/service/Makefile.am
@@ -0,0 +1,2 @@
+SUBDIRS = \
+       util
diff --git a/src/service/util/.gitignore b/src/service/util/.gitignore
new file mode 100644
index 000000000..9e00297f1
--- /dev/null
+++ b/src/service/util/.gitignore
@@ -0,0 +1,2 @@
+gnunet-service-resolver
+test_resolver_api.nc
diff --git a/src/service/util/Makefile.am b/src/service/util/Makefile.am
new file mode 100644
index 000000000..ecd1f5e1b
--- /dev/null
+++ b/src/service/util/Makefile.am
@@ -0,0 +1,47 @@
+# This Makefile.am is in the public domain
+AM_CPPFLAGS = -I$(top_srcdir)/src/include
+
+plugindir = $(libdir)/gnunet
+
+libexecdir= $(pkglibdir)/libexec/
+
+pkgcfgdir= $(pkgdatadir)/config.d/
+
+if USE_COVERAGE
+  AM_CFLAGS = --coverage -O0
+  XLIB = -lgcov
+endif
+
+libexec_PROGRAMS = \
+ gnunet-service-resolver
+
+if ENABLE_TEST_RUN
+AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
+TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+endif
+
+gnunet_service_resolver_SOURCES = \
+ gnunet-service-resolver.c
+gnunet_service_resolver_LDADD = \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
+  $(GN_LIBINTL)
+if HAVE_GETADDRINFO_A
+gnunet_service_resolver_LDADD += -lanl
+endif
+
+
+check_PROGRAMS = \
+ test_resolver_api.nc
+
+# Declare .nc (NO-CONCURRENCY) as a test extension so that we can impart
+# sequential execution order for them
+TEST_EXTENSIONS = .nc
+test_test_client_unix.log: test_client.log
+
+test_resolver_api_nc_SOURCES = \
+ test_resolver_api.c
+test_resolver_api_nc_LDADD = \
+ $(top_builddir)/src/lib/util/libgnunetutil.la
+
+EXTRA_DIST = \
+  test_resolver_api_data.conf
diff --git a/src/util/gnunet-service-resolver.c 
b/src/service/util/gnunet-service-resolver.c
similarity index 99%
rename from src/util/gnunet-service-resolver.c
rename to src/service/util/gnunet-service-resolver.c
index 77b57c72b..8d57738ed 100644
--- a/src/util/gnunet-service-resolver.c
+++ b/src/service/util/gnunet-service-resolver.c
@@ -28,7 +28,7 @@
 #include "gnunet_util_lib.h"
 #include "gnunet_protocols.h"
 #include "gnunet_statistics_service.h"
-#include "resolver.h"
+#include "../../lib/util/resolver.h"
 
 
 /**
diff --git a/src/util/test_resolver_api.c b/src/service/util/test_resolver_api.c
similarity index 100%
rename from src/util/test_resolver_api.c
rename to src/service/util/test_resolver_api.c
diff --git a/src/util/test_resolver_api_data.conf 
b/src/service/util/test_resolver_api_data.conf
similarity index 100%
rename from src/util/test_resolver_api_data.conf
rename to src/service/util/test_resolver_api_data.conf
diff --git a/src/set/Makefile.am b/src/set/Makefile.am
index a9e39a728..7433226a3 100644
--- a/src/set/Makefile.am
+++ b/src/set/Makefile.am
@@ -27,7 +27,7 @@ lib_LTLIBRARIES = \
 gnunet_set_profiler_SOURCES = \
  gnunet-set-profiler.c
 gnunet_set_profiler_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   libgnunetset.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
@@ -38,7 +38,7 @@ gnunet_set_ibf_profiler_SOURCES = \
  gnunet-set-ibf-profiler.c \
  ibf.c
 gnunet_set_ibf_profiler_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 gnunet_service_set_SOURCES = \
@@ -49,18 +49,18 @@ gnunet_service_set_SOURCES = \
  gnunet-service-set_union_strata_estimator.c 
gnunet-service-set_union_strata_estimator.h \
  gnunet-service-set_protocol.h
 gnunet_service_set_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/cadet/libgnunetcadet.la \
-  $(top_builddir)/src/block/libgnunetblock.la \
+  $(top_builddir)/src/lib/block/libgnunetblock.la \
   libgnunetset.la \
   $(GN_LIBINTL)
 
 libgnunetset_la_SOURCES = \
   set_api.c set.h
 libgnunetset_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunetset_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)
@@ -79,28 +79,28 @@ endif
 test_set_api_SOURCES = \
  test_set_api.c
 test_set_api_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetset.la
 
 test_set_union_result_symmetric_SOURCES = \
  test_set_union_result_symmetric.c
 test_set_union_result_symmetric_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetset.la
 
 test_set_intersection_result_full_SOURCES = \
  test_set_intersection_result_full.c
 test_set_intersection_result_full_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetset.la
 
 test_set_union_copy_SOURCES = \
  test_set_union_copy.c
 test_set_union_copy_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetset.la
 
@@ -110,9 +110,9 @@ plugin_LTLIBRARIES = \
 libgnunet_plugin_block_set_test_la_SOURCES = \
   plugin_block_set_test.c
 libgnunet_plugin_block_set_test_la_LIBADD = \
-  $(top_builddir)/src/block/libgnunetblock.la \
-  $(top_builddir)/src/block/libgnunetblockgroup.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/block/libgnunetblock.la \
+  $(top_builddir)/src/lib/block/libgnunetblockgroup.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunet_plugin_block_set_test_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
diff --git a/src/seti/Makefile.am b/src/seti/Makefile.am
index 6b0df430b..6292dce0a 100644
--- a/src/seti/Makefile.am
+++ b/src/seti/Makefile.am
@@ -26,7 +26,7 @@ lib_LTLIBRARIES = \
 gnunet_seti_profiler_SOURCES = \
  gnunet-seti-profiler.c
 gnunet_seti_profiler_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   libgnunetseti.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
@@ -37,18 +37,18 @@ gnunet_service_seti_SOURCES = \
  gnunet-service-seti.c \
  gnunet-service-seti_protocol.h
 gnunet_service_seti_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/cadet/libgnunetcadet.la \
-  $(top_builddir)/src/block/libgnunetblock.la \
+  $(top_builddir)/src/lib/block/libgnunetblock.la \
   libgnunetseti.la \
   $(GN_LIBINTL)
 
 libgnunetseti_la_SOURCES = \
   seti_api.c seti.h
 libgnunetseti_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunetseti_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)
@@ -64,7 +64,7 @@ endif
 test_seti_api_SOURCES = \
  test_seti_api.c
 test_seti_api_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetseti.la
 
@@ -74,9 +74,9 @@ plugin_LTLIBRARIES = \
 libgnunet_plugin_block_seti_test_la_SOURCES = \
   plugin_block_seti_test.c
 libgnunet_plugin_block_seti_test_la_LIBADD = \
-  $(top_builddir)/src/block/libgnunetblock.la \
-  $(top_builddir)/src/block/libgnunetblockgroup.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/block/libgnunetblock.la \
+  $(top_builddir)/src/lib/block/libgnunetblockgroup.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunet_plugin_block_seti_test_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
diff --git a/src/setu/Makefile.am b/src/setu/Makefile.am
index 377fe82c3..32ccc7b26 100644
--- a/src/setu/Makefile.am
+++ b/src/setu/Makefile.am
@@ -27,7 +27,7 @@ lib_LTLIBRARIES = \
 gnunet_setu_profiler_SOURCES = \
  gnunet-setu-profiler.c
 gnunet_setu_profiler_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   libgnunetsetu.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
@@ -38,7 +38,7 @@ gnunet_setu_ibf_profiler_SOURCES = \
  gnunet-setu-ibf-profiler.c \
  ibf.c
 gnunet_setu_ibf_profiler_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 gnunet_service_setu_SOURCES = \
@@ -47,18 +47,18 @@ gnunet_service_setu_SOURCES = \
  gnunet-service-setu_strata_estimator.c gnunet-service-setu_strata_estimator.h 
\
  gnunet-service-setu_protocol.h
 gnunet_service_setu_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/cadet/libgnunetcadet.la \
-  $(top_builddir)/src/block/libgnunetblock.la \
+  $(top_builddir)/src/lib/block/libgnunetblock.la \
   libgnunetsetu.la \
   $(GN_LIBINTL)
 
 libgnunetsetu_la_SOURCES = \
   setu_api.c setu.h
 libgnunetsetu_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunetsetu_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)
@@ -75,7 +75,7 @@ endif
 test_setu_api_SOURCES = \
  test_setu_api.c
 test_setu_api_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetsetu.la
 
@@ -83,7 +83,7 @@ test_setu_api_LDADD = \
 perf_setu_api_SOURCES = \
  perf_setu_api.c
 perf_setu_api_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetsetu.la
 
@@ -94,9 +94,9 @@ plugin_LTLIBRARIES = \
 libgnunet_plugin_block_setu_test_la_SOURCES = \
   plugin_block_setu_test.c
 libgnunet_plugin_block_setu_test_la_LIBADD = \
-  $(top_builddir)/src/block/libgnunetblock.la \
-  $(top_builddir)/src/block/libgnunetblockgroup.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/block/libgnunetblock.la \
+  $(top_builddir)/src/lib/block/libgnunetblockgroup.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunet_plugin_block_setu_test_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
diff --git a/src/sq/Makefile.am b/src/sq/Makefile.am
index 80911db7a..a77a380af 100644
--- a/src/sq/Makefile.am
+++ b/src/sq/Makefile.am
@@ -16,7 +16,7 @@ libgnunetsq_la_SOURCES = \
   sq_query_helper.c \
   sq_result_helper.c
 libgnunetsq_la_LIBADD = -lsqlite3 \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 libgnunetsq_la_LDFLAGS = \
  $(GN_LIBINTL) \
  $(GN_LIB_LDFLAGS) \
@@ -34,5 +34,5 @@ test_sq_SOURCES = \
   test_sq.c
 test_sq_LDADD = \
   libgnunetsq.la \
-  $(top_builddir)/src/util/libgnunetutil.la  \
+  $(top_builddir)/src/lib/util/libgnunetutil.la  \
   -lsqlite3 $(XLIB)
diff --git a/src/statistics/Makefile.am b/src/statistics/Makefile.am
index 52f382156..ed4796274 100644
--- a/src/statistics/Makefile.am
+++ b/src/statistics/Makefile.am
@@ -18,7 +18,7 @@ lib_LTLIBRARIES = libgnunetstatistics.la
 libgnunetstatistics_la_SOURCES = \
   statistics_api.c statistics.h
 libgnunetstatistics_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL) $(XLIB)
 libgnunetstatistics_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)   \
@@ -34,14 +34,14 @@ gnunet_statistics_SOURCES = \
  gnunet-statistics.c
 gnunet_statistics_LDADD = \
   libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 gnunet_service_statistics_SOURCES = \
  gnunet-service-statistics.c
 gnunet_service_statistics_LDADD = \
   libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 check_PROGRAMS = \
@@ -59,25 +59,25 @@ test_statistics_api_SOURCES = \
  test_statistics_api.c
 test_statistics_api_LDADD = \
   libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_statistics_api_loop_SOURCES = \
  test_statistics_api_loop.c
 test_statistics_api_loop_LDADD = \
   libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_statistics_api_watch_SOURCES = \
  test_statistics_api_watch.c
 test_statistics_api_watch_LDADD = \
   libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_statistics_api_watch_zero_value_SOURCES = \
  test_statistics_api_watch_zero_value.c
 test_statistics_api_watch_zero_value_LDADD = \
   libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 if HAVE_PYTHON
 check_SCRIPTS = \
diff --git a/src/template/Makefile.am b/src/template/Makefile.am
index 4d2e58083..8db34b330 100644
--- a/src/template/Makefile.am
+++ b/src/template/Makefile.am
@@ -24,13 +24,13 @@ noinst_PROGRAMS = \
 gnunet_template_SOURCES = \
  gnunet-template.c
 gnunet_template_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 gnunet_service_template_SOURCES = \
  gnunet-service-template.c
 gnunet_service_template_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 
@@ -45,4 +45,4 @@ endif
 test_template_api_SOURCES = \
  test_template_api.c
 test_template_api_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index c8b9cd2d1..fe7de2399 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -25,7 +25,7 @@ lib_LTLIBRARIES = \
 gnunet_cmds_helper_SOURCES = \
   gnunet-cmds-helper.c
 gnunet_cmds_helper_LDADD = $(XLIB) \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  libgnunettesting.la \
  $(LTLIBINTL) $(Z_LIBS)
 
@@ -51,7 +51,7 @@ libgnunettesting_la_SOURCES = \
   testing_api_traits.c
 libgnunettesting_la_LIBADD = \
  $(top_builddir)/src/arm/libgnunetarm.la \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(LTLIBINTL)
 libgnunettesting_la_LDFLAGS = \
  $(GN_LIB_LDFLAGS) \
@@ -67,13 +67,13 @@ gnunet_testing_SOURCES = \
  gnunet-testing.c
 gnunet_testing_LDADD = \
  libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(GN_LIBINTL)
 
 list_keys_SOURCES = \
  list-keys.c
 list_keys_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(GN_LIBINTL)
 
 
@@ -97,38 +97,38 @@ test_testing_start_with_config_SOURCES = \
  test_testing_start_with_config.c
 test_testing_start_with_config_LDADD = \
  libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/hello/libgnunethello.la 
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/hello/libgnunethello.la 
 
 test_testing_portreservation_SOURCES = \
  test_testing_portreservation.c
 test_testing_portreservation_LDADD = \
  libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_testing_peerstartup_SOURCES = \
  test_testing_peerstartup.c
 test_testing_peerstartup_LDADD = \
  libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_testing_peerstartup2_SOURCES = \
  test_testing_peerstartup2.c
 test_testing_peerstartup2_LDADD = \
  libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_testing_servicestartup_SOURCES = \
  test_testing_servicestartup.c
 test_testing_servicestartup_LDADD = \
  libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 test_testing_sharedservices_SOURCES = \
  test_testing_sharedservices.c
 test_testing_sharedservices_LDADD = \
  libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 EXTRA_DIST = \
   test_testing_defaults.conf \
diff --git a/src/topology/Makefile.am b/src/topology/Makefile.am
index 6ec2ba137..c8086b74d 100644
--- a/src/topology/Makefile.am
+++ b/src/topology/Makefile.am
@@ -23,8 +23,8 @@ gnunet_daemon_topology_LDADD = \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/transport/libgnunettransportapplication.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/hello/libgnunethello.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 
@@ -41,7 +41,7 @@ test_gnunet_daemon_topology_SOURCES = \
 test_gnunet_daemon_topology_LDADD = \
  $(top_builddir)/src/testbed/libgnunettestbed.la \
  $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/lib/util/libgnunetutil.la
 
 EXTRA_DIST = \
  test_gnunet_daemon_topology_data.conf
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 9815e0f01..0828f7c04 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -48,9 +48,9 @@ libgnunettransporttesting2_la_LIBADD = \
   libgnunettransportcore.la \
   $(top_builddir)/src/arm/libgnunetarm.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
+  $(top_builddir)/src/lib/hello/libgnunethello.la \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 libgnunettransporttesting2_la_LDFLAGS = \
   $(GN_LIBINTL) \
   $(GN_LIB_LDFLAGS) \
@@ -59,7 +59,7 @@ libgnunettransporttesting2_la_LDFLAGS = \
 libgnunettransportapplication_la_SOURCES = \
   transport_api2_application.c
 libgnunettransportapplication_la_LIBADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(LTLIBINTL)
 libgnunettransportapplication_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)  \
@@ -69,7 +69,7 @@ libgnunettransportapplication_la_LDFLAGS = \
 libgnunettransportcore_la_SOURCES = \
   transport_api2_core.c
 libgnunettransportcore_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 libgnunettransportcore_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)  \
@@ -78,7 +78,7 @@ libgnunettransportcore_la_LDFLAGS = \
 libgnunettransportcommunicator_la_SOURCES = \
   transport_api2_communication.c
 libgnunettransportcommunicator_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 libgnunettransportcommunicator_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)  \
@@ -88,7 +88,7 @@ libgnunettransportcommunicator_la_LDFLAGS = \
 libgnunettransportmonitor_la_SOURCES = \
   transport_api2_monitor.c
 libgnunettransportmonitor_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 libgnunettransportmonitor_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)  \
@@ -130,7 +130,7 @@ gnunet_communicator_unix_SOURCES = \
 gnunet_communicator_unix_LDADD = \
   libgnunettransportcommunicator.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/lib/util/libgnunetutil.la
 
 gnunet_communicator_tcp_SOURCES = \
  gnunet-communicator-tcp.c
@@ -139,7 +139,7 @@ gnunet_communicator_tcp_LDADD = \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/nat/libgnunetnatnew.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LIBGCRYPT_LIBS)
 
 gnunet_communicator_udp_SOURCES = \
@@ -149,7 +149,7 @@ gnunet_communicator_udp_LDADD = \
   libgnunettransportcommunicator.la \
   $(top_builddir)/src/nat/libgnunetnatnew.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LIBGCRYPT_LIBS)
 
 if HAVE_EXPERIMENTAL
@@ -162,7 +162,7 @@ gnunet_communicator_quic_LDADD = \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/nat/libgnunetnatnew.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   -lquiche \
   $(LIBGCRYPT_LIBS)
 endif
@@ -172,17 +172,17 @@ endif
 # gnunet-transport.c
 #gnunet_transport_LDADD = \
 #  libgnunettransport.la \
-#  $(top_builddir)/src/hello/libgnunethello.la \
-#  $(top_builddir)/src/util/libgnunetutil.la \
+#  $(top_builddir)/src/lib/hello/libgnunethello.la \
+#  $(top_builddir)/src/lib/util/libgnunetutil.la \
 #  $(GN_LIBINTL)
 
 gnunet_service_transport_SOURCES = \
  gnunet-service-transport.c transport.h
 gnunet_service_transport_LDADD = \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
+  $(top_builddir)/src/lib/hello/libgnunethello.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LIBGCRYPT_LIBS) \
   $(GN_LIBINTL)
 
@@ -203,9 +203,9 @@ libgnunet_test_transport_plugin_cmd_nat_upnp_la_LIBADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
+  $(top_builddir)/src/lib/hello/libgnunethello.la \
   $(top_builddir)/src/arm/libgnunetarm.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunet_test_transport_plugin_cmd_nat_upnp_la_LDFLAGS = \
   $(GN_PLUGIN_LDFLAGS)
@@ -219,9 +219,9 @@ 
libgnunet_test_transport_plugin_cmd_udp_backchannel_la_LIBADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
+  $(top_builddir)/src/lib/hello/libgnunethello.la \
   $(top_builddir)/src/arm/libgnunetarm.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunet_test_transport_plugin_cmd_udp_backchannel_la_LDFLAGS = \
   $(GN_PLUGIN_LDFLAGS)
@@ -235,9 +235,9 @@ libgnunet_test_transport_plugin_cmd_simple_send_la_LIBADD = 
\
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
+  $(top_builddir)/src/lib/hello/libgnunethello.la \
   $(top_builddir)/src/arm/libgnunetarm.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunet_test_transport_plugin_cmd_simple_send_la_LDFLAGS = \
   $(GN_PLUGIN_LDFLAGS)
@@ -251,9 +251,9 @@ 
libgnunet_test_transport_plugin_cmd_simple_send_performance_la_LIBADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
+  $(top_builddir)/src/lib/hello/libgnunethello.la \
   $(top_builddir)/src/arm/libgnunetarm.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunet_test_transport_plugin_cmd_simple_send_performance_la_LDFLAGS = \
   $(GN_PLUGIN_LDFLAGS)
@@ -267,9 +267,9 @@ 
libgnunet_test_transport_plugin_cmd_simple_send_broadcast_la_LIBADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
+  $(top_builddir)/src/lib/hello/libgnunethello.la \
   $(top_builddir)/src/arm/libgnunetarm.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunet_test_transport_plugin_cmd_simple_send_broadcast_la_LDFLAGS = \
   $(GN_PLUGIN_LDFLAGS)
@@ -283,9 +283,9 @@ 
libgnunet_test_transport_plugin_cmd_simple_send_dv_la_LIBADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
+  $(top_builddir)/src/lib/hello/libgnunethello.la \
   $(top_builddir)/src/arm/libgnunetarm.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunet_test_transport_plugin_cmd_simple_send_dv_la_LDFLAGS = \
   $(GN_PLUGIN_LDFLAGS)
@@ -331,8 +331,8 @@ test_transport_start_with_config_SOURCES = \
  test_transport_start_with_config.c
 test_transport_start_with_config_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/hello/libgnunethello.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/hello/libgnunethello.la \
  libgnunettransportcore.la \
  libgnunettransporttesting2.la
 
@@ -341,7 +341,7 @@ test_communicator_basic_unix_SOURCES = \
 test_communicator_basic_unix_LDADD = \
  libgnunettransporttesting2.la \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(top_builddir)/src/statistics/libgnunetstatistics.la
 
 test_communicator_basic_tcp_SOURCES = \
@@ -349,7 +349,7 @@ test_communicator_basic_tcp_SOURCES = \
 test_communicator_basic_tcp_LDADD = \
  libgnunettransporttesting2.la \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(top_builddir)/src/statistics/libgnunetstatistics.la
 
 test_communicator_basic_udp_SOURCES = \
@@ -357,7 +357,7 @@ test_communicator_basic_udp_SOURCES = \
 test_communicator_basic_udp_LDADD = \
  libgnunettransporttesting2.la \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(top_builddir)/src/statistics/libgnunetstatistics.la
 
 test_communicator_basic_quic_SOURCES = \
@@ -365,7 +365,7 @@ test_communicator_basic_quic_SOURCES = \
 test_communicator_basic_quic_LDADD = \
  libgnunettransporttesting2.la \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(top_builddir)/src/statistics/libgnunetstatistics.la
 
 test_communicator_rekey_tcp_SOURCES = \
@@ -373,7 +373,7 @@ test_communicator_rekey_tcp_SOURCES = \
 test_communicator_rekey_tcp_LDADD = \
  libgnunettransporttesting2.la \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(top_builddir)/src/statistics/libgnunetstatistics.la
 
 test_communicator_rekey_udp_SOURCES = \
@@ -381,7 +381,7 @@ test_communicator_rekey_udp_SOURCES = \
 test_communicator_rekey_udp_LDADD = \
  libgnunettransporttesting2.la \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(top_builddir)/src/statistics/libgnunetstatistics.la
 
 test_communicator_backchannel_udp_SOURCES = \
@@ -389,7 +389,7 @@ test_communicator_backchannel_udp_SOURCES = \
 test_communicator_backchannel_udp_LDADD = \
  libgnunettransporttesting2.la \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(top_builddir)/src/statistics/libgnunetstatistics.la
 
 test_communicator_bidirect_tcp_SOURCES = \
@@ -397,14 +397,14 @@ test_communicator_bidirect_tcp_SOURCES = \
 test_communicator_bidirect_tcp_LDADD = \
  libgnunettransporttesting2.la \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
  $(top_builddir)/src/statistics/libgnunetstatistics.la
 
 test_transport_api2_tcp_SOURCES = \
  test_transport_api2.c
 test_transport_api2_tcp_LDADD = \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la  \
+ $(top_builddir)/src/lib/hello/libgnunethello.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la  \
  libgnunettransporttesting2.la
 
 EXTRA_DIST = \
diff --git a/src/vpn/Makefile.am b/src/vpn/Makefile.am
index a5bbb6e22..38a7e8b3f 100644
--- a/src/vpn/Makefile.am
+++ b/src/vpn/Makefile.am
@@ -33,14 +33,14 @@ bin_PROGRAMS = \
 gnunet_helper_vpn_SOURCES = \
   gnunet-helper-vpn.c
 gnunet_helper_vpn_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 gnunet_service_vpn_SOURCES = \
  gnunet-service-vpn.c
 gnunet_service_vpn_LDADD = \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/cadet/libgnunetcadet.la \
   $(top_builddir)/src/regex/libgnunetregex.la \
   $(GN_LIBINTL)
@@ -51,13 +51,13 @@ gnunet_vpn_SOURCES = \
  gnunet-vpn.c
 gnunet_vpn_LDADD = \
   libgnunetvpn.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(GN_LIBINTL)
 
 libgnunetvpn_la_SOURCES = \
  vpn_api.c vpn.h
 libgnunetvpn_la_LIBADD = \
- $(top_builddir)/src/util/libgnunetutil.la $(XLIB)
+ $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIB)
 libgnunetvpn_la_LDFLAGS = \
   $(GN_LIBINTL) \
   $(GN_LIB_LDFLAGS)
diff --git a/src/zonemaster/Makefile.am b/src/zonemaster/Makefile.am
index 635c195ed..3a3b150e2 100644
--- a/src/zonemaster/Makefile.am
+++ b/src/zonemaster/Makefile.am
@@ -22,10 +22,10 @@ gnunet_service_zonemaster_SOURCES = \
  gnunet-service-zonemaster.c
 gnunet_service_zonemaster_LDADD = \
   $(top_builddir)/src/dht/libgnunetdht.la \
-  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/identity/libgnunetidentity.la  \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/lib/util/libgnunetutil.la \
   $(top_builddir)/src/namestore/libgnunetnamestore.la \
   $(top_builddir)/src/namecache/libgnunetnamecache.la \
   $(GN_LIBINTL) \
diff --git a/src/zonemaster/gnunet-service-zonemaster.c 
b/src/zonemaster/gnunet-service-zonemaster.c
index a4eb13004..7c763576d 100644
--- a/src/zonemaster/gnunet-service-zonemaster.c
+++ b/src/zonemaster/gnunet-service-zonemaster.c
@@ -146,7 +146,7 @@ struct RecordPublicationJob
   /**
    * The zone key to sign the block with
    */
-  struct GNUNET_IDENTITY_PrivateKey zone;
+  struct GNUNET_CRYPTO_PrivateKey zone;
 
   /**
    * The block to sign
@@ -809,7 +809,7 @@ dht_put_continuation (void *cls)
  * @return DHT PUT handle, NULL on error
  */
 static void
-dispatch_job (const struct GNUNET_IDENTITY_PrivateKey *key,
+dispatch_job (const struct GNUNET_CRYPTO_PrivateKey *key,
               const char *label,
               const struct GNUNET_GNSRECORD_Data *rd,
               unsigned int rd_count,
@@ -1036,7 +1036,7 @@ zone_iteration_finished (void *cls)
  */
 static void
 handle_record (void *cls,
-               const struct GNUNET_IDENTITY_PrivateKey *key,
+               const struct GNUNET_CRYPTO_PrivateKey *key,
                const char *label,
                unsigned int rd_count,
                const struct GNUNET_GNSRECORD_Data *rd,
@@ -1123,7 +1123,7 @@ publish_zone_dht_start (void *cls)
  * @param rd_public_count number of records in @a rd_public
  */
 static void
-dispatch_job_monitor (const struct GNUNET_IDENTITY_PrivateKey *key,
+dispatch_job_monitor (const struct GNUNET_CRYPTO_PrivateKey *key,
                       const char *label,
                       const struct GNUNET_GNSRECORD_Data *rd,
                       unsigned int rd_count,
@@ -1201,7 +1201,7 @@ dispatch_job_monitor (const struct 
GNUNET_IDENTITY_PrivateKey *key,
  */
 static void
 handle_monitor_event (void *cls,
-                      const struct GNUNET_IDENTITY_PrivateKey *zone,
+                      const struct GNUNET_CRYPTO_PrivateKey *zone,
                       const char *label,
                       unsigned int rd_count,
                       const struct GNUNET_GNSRECORD_Data *rd,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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