Crate libpep

Crate libpep 

Source
Expand description

§libpep: Library for polymorphic pseudonymization and encryption

This library implements PEP cryptography based on ElGamal encrypted messages.

In the ElGamal scheme, a message M can be encrypted for a receiver which has public key Y associated with it, belonging to secret key y. Using the PEP cryptography, these encrypted messages can blindly be transcrypted from one key to another, by a central semi-trusted party, without the need to decrypt the message inbetween. Meanwhile, if the message contains an identifier of a data subject, this identifier can be pseudonymized. This enables end-to-end encrypted data sharing with built-in pseudonymization. Since at the time of initial encryption, the future recipient does not need to be specified, data sharing can be done asynchronously. This means that encrypted data can be stored long-term before it is shared at any point in the future.

This library provides both a base API for ElGamal encryption and the PEP primitives, and a core API for pseudonymization and rekeying (i.e. transcryption) of Pseudonyms and Attributes using this cryptographic concept.

The PEP framework was initially described in the article by Eric Verheul and Bart Jacobs, Polymorphic Encryption and Pseudonymisation in Identity Management and Medical Research. In Nieuw Archief voor Wiskunde (NAW), 5/18, nr. 3, 2017, p. 168-172. PDF

This library implements an extension of the PEP framework, called n-PEP, described in the article by Job Doesburg, Bernard van Gastel and Erik Poll (to be published).

§Feature flags

Note: The python and wasm features are mutually exclusive. If both are enabled, neither binding module will be compiled. This is because PyO3 builds a cdylib that links to the Python interpreter, while wasm-bindgen builds a cdylib targeting WebAssembly - they have incompatible linking requirements.

Modules§

arithmetic
Implementation of arithmetic operations on Curve25519 with Ristretto, using the curve25519-dalek library.
base
Low-level cryptographic primitives for ElGamal encryption and (n)-PEP operations. This module is intended for non-standard uses cases where the individual (n)-PEP primitives are needed.
core
High-level API specifying Pseudonyms and Attributes, and transcryption (pseudonymization or rekeying) of their encrypted versions between different contexts. This module is intended for most use cases where a single trusted party (transcryptor) is responsible for pseudonymization and rekeying. The API is designed to be user-friendly and safe.
distributed
Distributed n-PEP with wrappers for high-level PEPSystems (transcryptors) and PEPClients. This module is intended for use cases where transcryption is performed by n parties and trust is distributed among them (i.e. no single party is trusted but the system remains secure as long as at least 1 party remains honest).

Macros§

pep_json
Macro for creating PEPJSONValue objects with a JSON-like syntax.