Skip to content

Commit

Permalink
Merge pull request #70 from Cosmian/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
bgrieder authored Aug 3, 2023
2 parents 257ee8f + 58026ff commit fce3735
Show file tree
Hide file tree
Showing 24 changed files with 699 additions and 1,742 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"rust-analyzer.cargo.features": ["in_memory"]
}
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to this project will be documented in this file.

## [5.0.0] - 2023-07-21

### Features

- Changed the Search, Upsert and Compact API from mutable to immutable
- Upsert now returns the set of new keywords added to the Entry Table

### Bug Fixes

- add missing `async` keyword for compact callbacks
- fix `list_removed_locations` doc

## [4.0.3] - 2023-07-11

### Features
Expand Down
53 changes: 38 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,42 +1,65 @@
[package]
name = "cosmian_findex"
version = "4.0.3"
version = "5.0.0"
authors = [
"Chloé Hébant <[email protected]>",
"Bruno Grieder <[email protected]>",
"Célia Corsin <[email protected]>",
"Emmanuel Coste <[email protected]>",
"Théophile Brézot <[email protected]>",
"Chloé Hébant <[email protected]>",
"Bruno Grieder <[email protected]>",
"Célia Corsin <[email protected]>",
"Emmanuel Coste <[email protected]>",
"Théophile Brézot <[email protected]>",
]
categories = ["cosmian::crypto"]
edition = "2021"
keywords = ["SSE"]
license = "MIT/Apache-2.0"
license-file = "LICENSE.md"
repository = "https://github.com/Cosmian/findex/"
description = "Symmetric Searchable Encryption"

[lib]
crate-type = ["cdylib", "rlib", "staticlib"]
crate-type = ["cdylib", "lib", "staticlib"]
name = "cosmian_findex"
path = "src/lib.rs"

[[bench]]
harness = false
name = "benches"

[features]
in_memory = []
live_compact = []

[dependencies]
base64 = "0.21.2"
cosmian_crypto_core = { version = "9.0.0", features = ["aes", "sha3", "ser"], default-features = false }
cosmian_crypto_core = { version = "9.0.0", features = [
"aes",
"sha3",
"ser",
], default-features = false }
rand = "0.8"
tiny-keccak = { version = "2.0.2", features = ["kmac", "sha3"] }
zeroize = "1.5"

[dev-dependencies]
actix-rt = "2.8"
criterion = { version = "0.4", features = ["html_reports", "async_futures"], default_features = false }
criterion = { version = "0.4", features = [
"html_reports",
"async_futures",
], default_features = false }
futures = "0.3"
serde_json = "1.0"

[[bench]]
harness = false
name = "benches"
required-features = ["in_memory"]

[[test]]
name = "test_in_memory"
required-features = ["in_memory"]

[[test]]
name = "non_regression"
required-features = ["in_memory"]

[[example]]
name = "search"
required-features = ["in_memory"]

[[example]]
name = "upsert"
required-features = ["in_memory"]
30 changes: 14 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

![Build status](https://github.com/Cosmian/findex/actions/workflows/ci.yml/badge.svg)
![Build status](https://github.com/Cosmian/findex/actions/workflows/build.yml/badge.svg)
![latest version](<https://img.shields.io/crates/v/cosmian_findex.svg>)
![latest version](https://img.shields.io/crates/v/cosmian_findex.svg)

Findex aims to solve the following problem:

> How to securely recover the *location* of an encrypted data matching a given
> *keyword*?
> How to securely recover the _location_ of an encrypted data matching a given
> _keyword_?
It is a cryptographic protocol designed to securely make search queries on an
untrusted cloud server. Thanks to its encrypted indexes, large databases can
Expand All @@ -20,35 +20,33 @@ Findex is part of Cosmian Cloudproof Encryption.
- [Getting started](#getting-started)
- [Building and testing](#building-and-testing)
- [Findex indexes](#findex-indexes)
* [Two indexing strategies](#two-indexing-strategies)
- [Two indexing strategies](#two-indexing-strategies)
- [Benchmarks](#benchmarks)
- [Documentation](#documentation)

<!-- tocstop -->

## Getting started

Findex allows to index values by keywords. These values can be locations (UIDs
Findex allows indexing values by keywords. These values can be locations (UIDs
of an encrypted database, URLs, paths, etc.).

Using Findex API one can:

- index or desindex values by keywords via the `FindexUpsert` trait;
- index or deindex values by keywords via the `FindexUpsert` trait;
- search for keywords via the `FindexSearch` trait;
- compact the indexes via the `FindexCompact` trait.

These traits can be automatically implemented and a macro is provided to help
with the syntax. The default parameters (the ones used by the macro) are
defined in [`parameters.rs`](./src/parameters.rs).

Findex delegates to the user the implementation of *callbacks* to manipulate
the indexes. This makes Findex compatible with any database technology since no
database specific code is part of it. Implementation is done via the
Findex delegates to the user the implementation of _callbacks_ to manipulate
the indexes. This makes Findex compatible with any database technology since no database-specific code is part of it. Implementation is done via the
`FindexCallbacks` trait. See [`callbacks.md`](./callbacks.md) for details on
the implementation of the callbacks.

See [`in_memory_example.rs`](./src/in_memory_example.rs) for a example of
implementation.
See `in_memory_example.rs` for an example of implementation.

## Building and testing

Expand All @@ -72,7 +70,7 @@ cargo bench --all-features

## Findex indexes

Findex relies on two server side indexes:
Findex relies on two server-side indexes:

- **Entry Table**: provides the values needed to fetch the correct locations
from the Chain Table. Each indexing keyword matches a line in the Entry
Expand All @@ -84,8 +82,8 @@ Findex relies on two server side indexes:
stored by blocks of fixed length and the same number of blocks is stored in
each line (padding is added where necessary).

Findex indexes are key value stores which structure is given in the following
tables, with $K_{w_i}$ the ephemeral key associated to a keyword $w_i$,
Findex indexes are key-value stores whose structure is given in the following
tables, with $K_{w_i}$ the ephemeral key associated with a keyword $w_i$,
$H_{w_i}$ the hash of $w_i$ and $UID_{last}$ the last UID of the chain of
indexed values associated to $w_i$.

Expand Down Expand Up @@ -214,7 +212,7 @@ More client/server interactions are needed for the graph solution: the depth of
the graph (4 in this example) compared to 1 for the naive solution and 2 for
the mixed solution.

In the other hand, the graph solution optimizes the size of the Chain Table.
On the other hand, the graph solution optimizes the size of the Chain Table.

<table>
<tr>
Expand Down Expand Up @@ -292,7 +290,7 @@ In the other hand, the graph solution optimizes the size of the Chain Table.

## Benchmarks

The benchmarks presented in this section are run on a Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz.
The benchmarks presented in this section are run on an Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz.

- [Findex in memory (no database)](./benches/BENCHMARKS.md)

Expand Down
5 changes: 1 addition & 4 deletions benches/benches.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#[cfg(not(feature = "in_memory"))]
compile_error!("Benches require the `in_memory` feature.");

use std::collections::{HashMap, HashSet};

use cosmian_crypto_core::CsRng;
Expand Down Expand Up @@ -48,7 +45,7 @@ fn bench_search(c: &mut Criterion) {
//
// Prepare indexes to be search
//
let mut findex = FindexInMemory::default();
let findex = FindexInMemory::default();
block_on(findex.add(&master_key, &label, locations_and_words)).expect("msg");

println!("Entry Table length: {}", findex.entry_table_len());
Expand Down
Loading

0 comments on commit fce3735

Please sign in to comment.