|
| 1 | +# TimeCrypt |
| 2 | + |
| 3 | +TimeCrypt, a system that provides scalable and real-time analytics over large volumes of encrypted time series data. |
| 4 | +In TimeCrypt, data is encrypted end-to-end, and authorized parties can only decrypt and verify queries within their authorized access scope. |
| 5 | + |
| 6 | +TimeCrypt achieves its competitive performance through a careful design of cryptographic primitives tailored for time series data workloads. |
| 7 | +Most important it introduces a partially homomorphic-encryption-based access control scheme (HEAC) that allows computations on the encrypted data. |
| 8 | +HEAC, in essence is based on a symmetric homomorphic encryption. |
| 9 | +However, we improve its performance by a factor of 2x for time series workloads by mapping keys to time and optimizing it for in-range ciphertext aggregations. |
| 10 | + |
| 11 | +With those aggregations the server can pre compute statistical responses over large amounts of data without any knowledge about the plain text in near plain text speed. |
| 12 | +Given this the client can then compute even more sophisticated statistical results. |
| 13 | +For example a client can calculate the average over a set of data points with just one division if the server already provides the sum and count of the data points. |
| 14 | + |
| 15 | +See [the Paper](https://www.usenix.org/system/files/nsdi20-paper-burkhalter.pdf) for more details. |
| 16 | + |
| 17 | +## Structure of the repository |
| 18 | +This repository is split into three parts: |
| 19 | +- [**timecrypt-crypto**](timecrypt-crypto/README.md): The cryptographic library for TimeCrypt. It contains of the partially homomorphic-encryption-based access control scheme (HEAC) for different key lengths as well as the key derivation tree implementations. |
| 20 | +- [**timecrypt-server**](timecrypt-server/README.md): A prototypical implementation of a TimeCrypt server that stores its data in Cassandra. The server takes care of storing the cunks of raw data as well as the digests of aggregatable meta data. |
| 21 | +- [**timecrypt-client**](timecrypt-client/README.md): A example implementation of a client. The client provides a [Java-API](timecrypt-client/src/main/java/ch/ethz/dsg/timecrypt/TimeCryptClient.java) for interacting with TimeCrypt as well as an [interactive (the cli-client)](timecrypt-client/src/main/java/ch/ethz/dsg/timecrypt/CliClient.java) and [non-interactive CLI implementation (the testbed)](timecrypt-client/src/main/java/ch/ethz/dsg/timecrypt/TestBed.java) that simulates a producer like an IoT device. |
| 22 | + |
| 23 | +For more information see the individual README files in the folders. |
| 24 | + |
| 25 | +## Quickstart |
| 26 | +The easiest way to get a TimeCrypt server running in no time is to start it with `docker-compose`. |
| 27 | + |
| 28 | +``` |
| 29 | +docker-compose up --build |
| 30 | +``` |
| 31 | + |
| 32 | +This will build the project inside a Docker container, create an Docker network for the server and Cassandra and will start both. |
| 33 | + |
| 34 | +Afterwards you have a running TimeCrypt server and just need to connect a client to it. |
| 35 | + |
| 36 | +If you just want to see a Producer in action you can run a testbed client in Docker with: |
| 37 | + |
| 38 | +``` |
| 39 | +docker run --network=timecrypt-network eth/timecrypt producer |
| 40 | +``` |
| 41 | + |
| 42 | +For an interactive CLI client session run: |
| 43 | +``` |
| 44 | +docker run --network=timecrypt-network -it eth/timecrypt client |
| 45 | +``` |
| 46 | + |
| 47 | +The client will automatically create a new key store for the cryptographic material of TimeCrypt. The password for this key store will be taken from the `TIMECRYPT_KEYSTORE_PASSWORD` environment variable. If you want to provide an own password you can do so by |
| 48 | + |
| 49 | +You will afterwards be prompted to create a new profile for storing the confidential data of the streams as well as connection information. For this you can safely use the provided default options. |
| 50 | + |
| 51 | +## Build & run on local system |
| 52 | +To build the project without Docker you will need the following prerequisites on your system: |
| 53 | +- Maven |
| 54 | +- A JDK >= Java version 11 |
| 55 | +- libssl-dev and cmake for building the OpenSSL support (can be skipped by deactivating the `aes-openssl-native` profile of maven (`-P \!aes-openssl-native`)) |
| 56 | + |
| 57 | +The root folder of this repository contains a multi-module build to run it start |
| 58 | +``` |
| 59 | +mvn package |
| 60 | +``` |
| 61 | +it will resolve all dependencies and build the project. Afterwards you can find the following JARs |
| 62 | + - **Server:** `timecrypt-server/target/timecrypt-server-jar-with-dependencies.jar` |
| 63 | + - **Client:** `timecrypt-client/target/timecrypt-testbed-jar-with-dependencies.jar` |
| 64 | + - **Producer / Testbed:** `timecrypt-client/target/timecrypt-client-jar-with-dependencies.jar` |
| 65 | + |
| 66 | +### Server |
| 67 | +To start the server you need to provide a connection to a Cassandra database (or run the server with an in memory only data storage by providing `TIMECRYPT_IN_MEMORY=true` as environment variable). |
| 68 | +You can provide the Host and port of your Cassandra Server by providing the environment variables `TIMECRYPT_CASSANDRA_HOST` and `TIMECRYPT_CASSANDRA_PORT`. The default values for connecting to the database are host: `127.0.0.1` and port: `9042`. For more configuration options see the [README of the server](timecrypt-server/README.md). |
| 69 | + |
| 70 | +### Client |
| 71 | +The client provides an interactive way to create streams, add data points and execute queries on the TimeCrypt server. |
| 72 | + |
| 73 | +On startup the client will ask you to create a Keystore and a profile. |
| 74 | +The key store is used for secure storing all TimeCrypt related keys. |
| 75 | +The profile will be used to store all private metadata about streams (e.g. their start timestamp or the meaning of their aggregatable meta data (digests)). |
| 76 | +It also provides login information for the TimeCrypt server. |
| 77 | + |
| 78 | +During the creation of the profile you can select the host and port of the TimeCrypt server. |
| 79 | + |
| 80 | +### Testbed |
| 81 | +The Testbed provides a variety of options for interacting with a TimeCrypt server for an overview invoke it with the `-h` option or see the [README of the client](timecrypt-client/README.md). |
| 82 | + |
| 83 | +## AES-NI |
| 84 | +This repository offers native encryption support for the Intel AES - New Instructions(AES-NI) which is hardware-based encryption/decryption that may provide enough acceleration to offset the application performance. However: The build might fail if your system does not support it. |
| 85 | + |
| 86 | +AES-NI is supported from the Intel Westmere processors (mid of 2010 / beginning of 2011) onwards. |
| 87 | +To check if you have AES-NI on your Linux-based system run: |
| 88 | + |
| 89 | +``` |
| 90 | +cat /proc/cpuinfo | grep -iq aes && echo 'AES-NI supported' || echo 'no AES-NI support' |
| 91 | +``` |
| 92 | + |
| 93 | +On non Linux systems you can install the `cpuid` util search for `aes` in its output as it is advised in the [AES-NI documentation](https://software.intel.com/sites/default/files/m/d/4/1/d/8/AES-NI_Java_Linux_Testing_Configuration_Case_Study.pdf). |
| 94 | + |
| 95 | +If your system does not support AES-NI you can disable it during build with the profile switch (`-P \!aesni-native`) e.g.: |
| 96 | + |
| 97 | +``` |
| 98 | +mvn package -P \!aesni-native |
| 99 | +
|
| 100 | +``` |
| 101 | + |
| 102 | +## Development |
| 103 | + |
| 104 | +In order to not confuse your IDE you might want to develop in the individual `timecrypt-*` folders. |
| 105 | +To satisfy the dependencies to the crypto library run run: |
| 106 | +``` |
| 107 | +mvn install |
| 108 | +``` |
| 109 | +in the root folder before development. |
0 commit comments