Skip to content

Commit cacd9fb

Browse files
committed
chore: merge branch 'release/v2.0.1'
2 parents c047f1c + 1abca5c commit cacd9fb

File tree

16 files changed

+1259
-1137
lines changed

16 files changed

+1259
-1137
lines changed

.github/workflows/ci.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,62 @@ jobs:
6565
mypy examples/cover_crypt
6666
- name: Run tests
6767
run: |
68+
python tests/non_regression_cover_crypt.py --test --write
6869
python -m unittest tests/test*.py
70+
- name: Upload non-regression test vectors
71+
uses: actions/upload-artifact@v3
72+
with:
73+
name: cloudproof_python
74+
path: |
75+
./tests/data/export/non_regression_vector.json
76+
./tests/data/export/sqlite.db
77+
retention-days: 1
78+
if-no-files-found: error
79+
80+
cloudproof_java:
81+
needs: test
82+
uses: Cosmian/reusable_workflows/.github/workflows/cloudproof_java_in_docker.yml@develop
83+
with:
84+
branch: develop
85+
target: x86_64-unknown-linux-gnu
86+
extension: so
87+
destination: linux-x86-64
88+
os: ubuntu-20.04
89+
kms-version: 4.2.0
90+
copy_fresh_build: false
91+
copy_regression_files: |
92+
cp ./cloudproof_python/non_regression_vector.json src/test/resources/cover_crypt/non_regression/python_non_regression_vector.json
93+
cp ./cloudproof_python/sqlite.db src/test/resources/findex/non_regression/python_sqlite.db
94+
95+
cloudproof_js:
96+
needs: test
97+
uses: Cosmian/reusable_workflows/.github/workflows/cloudproof_js.yml@develop
98+
with:
99+
branch: develop
100+
target: wasm32-unknown-unknown
101+
kms-version: 4.2.0
102+
copy_fresh_build: false
103+
copy_regression_files: |
104+
cp ./cloudproof_python/non_regression_vector.json tests/data/cover_crypt/non_regression/python_non_regression_vector.json
105+
cp ./cloudproof_python/sqlite.db tests/data/findex/non_regression/python_sqlite.db
106+
107+
cloudproof_flutter:
108+
needs:
109+
- test
110+
uses: Cosmian/reusable_workflows/.github/workflows/cloudproof_flutter.yml@develop
111+
with:
112+
branch: develop
113+
target: x86_64-unknown-linux-gnu
114+
extension: so
115+
copy_fresh_build: false
116+
copy_regression_files: |
117+
cp ./cloudproof_python/non_regression_vector.json test/resources/cover_crypt/non_regression/python_non_regression_vector.json
118+
cp ./cloudproof_python/sqlite.db test/resources/findex/non_regression/python_sqlite.db
119+
120+
cleanup:
121+
needs:
122+
- cloudproof_flutter
123+
- cloudproof_java
124+
- cloudproof_js
125+
uses: Cosmian/reusable_workflows/.github/workflows/cleanup_cache.yml@main
126+
secrets: inherit

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- name: Install dependencies
4343
run: |
4444
python -m pip install --upgrade pip
45-
pip install -r requirements.txt
45+
scripts/ci_install_pyo3_builds.sh
4646
pip install -r docs/requirements.txt
4747
- name: Build package
4848
run: |

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22

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

5+
## [2.0.1] - 2023-02-27
6+
7+
### Documentation
8+
9+
- Update examples with `progress_callback`
10+
11+
### Testing
12+
13+
- Fix int conversions for new regressions tests
14+
- Renew non-reg cover_crypt tests
15+
- Uniformize findex dataset
16+
17+
### Ci
18+
19+
- Add cross tests
20+
- Clean github cache for each completed PR
21+
522
## [2.0.0] - 2023-02-03
623

724
### Features

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,30 @@ The library provides a Python API to the **Cloudproof Encryption** product of th
77

88
<!-- toc -->
99

10+
- [Licensing](#licensing)
11+
- [Cryptographic primitives](#cryptographic-primitives)
1012
- [Getting started](#getting-started)
1113
- [Demo](#demo)
1214
- [Building and testing](#building-and-testing)
1315
- [Versions Correspondence](#versions-correspondence)
1416

1517
<!-- tocstop -->
1618

19+
## Licensing
20+
21+
The library is available under a dual licensing scheme Affero GPL/v3 and commercial. See [LICENSE.md](LICENSE.md) for details.
22+
23+
## Cryptographic primitives
24+
25+
The library is based on:
26+
27+
- [CoverCrypt](https://github.com/Cosmian/cover_crypt) algorithm which allows
28+
creating ciphertexts for a set of attributes and issuing user keys with access
29+
policies over these attributes. `CoverCrypt` offers Post-Quantum resistance.
30+
31+
- [Findex](https://github.com/Cosmian/findex) which is a cryptographic protocol designed to securely make search queries on
32+
an untrusted cloud server. Thanks to its encrypted indexes, large databases can
33+
1734
## Getting started
1835

1936
This library requires `Python >= 3.7`.
@@ -69,7 +86,7 @@ This library depends on [CoverCrypt](https://github.com/Cosmian/cover_crypt) and
6986

7087
This table shows the minimum version correspondence between the various components.
7188

72-
| `cloudproof_py` | CoverCrypt | Findex | KMS |
73-
| --------------- | ---------- | ------ | ----- |
74-
| >=2.0.0 | 10.0.0 | 2.0.1 | 4.2.0 |
75-
| >=1.0.0 | 8.0.1 | 2.0.0 | - |
89+
| `cloudproof_py` | CoverCrypt | Findex | KMS |
90+
| --------------- | ---------- | ----------- | ----- |
91+
| >=2.0.0 | 10.0.0 | 2.0.1,2.1.0 | 4.2.0 |
92+
| >=1.0.0 | 8.0.1 | 2.0.0 | - |

examples/cli_demo/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
cloudproof-py==1.0
1+
cloudproof-py==2.0
22
termcolor==2.1.1
33
types-termcolor==1.1.6

examples/cover_crypt/main.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,20 @@ async def main(use_kms: bool = True):
1313
policy.add_axis(
1414
PolicyAxis(
1515
"Security Level",
16-
[("Protected", False), ("Confidential", False), ("Top Secret", False)],
17-
hierarchical=True,
16+
[
17+
("Protected", False),
18+
("Confidential", False),
19+
# the following attribute is hybridized allowing post-quantum resistance
20+
("Top Secret", True),
21+
],
22+
hierarchical=True, # this is a hierarchical axis
1823
)
1924
)
2025
policy.add_axis(
2126
PolicyAxis(
2227
"Department",
2328
[("FIN", False), ("MKG", False), ("HR", False)],
24-
hierarchical=False,
29+
hierarchical=False, # this is NOT a hierarchical axis
2530
)
2631
)
2732

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cloudproof-py==1.0
1+
cloudproof-py==2.0

examples/findex_upsert_search/main.py

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# -*- coding: utf-8 -*-
2+
import argparse
3+
from typing import Dict, List, Union
4+
25
from findex_dict import FindexDict
36
from findex_redis import FindexRedis
47
from findex_sqlite import FindexSQLite
5-
from cloudproof_py import findex
6-
from typing import Union
7-
import argparse
8+
9+
from cloudproof_py.findex import MasterKey, Label, IndexedValue, Findex, utils
810

911
# Simple database containing the firstname and lastname of each user.
1012
# Each line has a corresponding UID: 1, 2 or 3.
@@ -19,13 +21,13 @@ def main(backend: str = "Dict"):
1921
print("Database to index:", data)
2022

2123
# Initialize a symmetric key
22-
master_key = findex.MasterKey.random()
24+
master_key = MasterKey.random()
2325

2426
# Initialize a random label
25-
label = findex.Label.random()
27+
label = Label.random()
2628

2729
# Instance the class implementing the required callbacks
28-
findex_interface: Union[findex.Findex.FindexUpsert, findex.Findex.FindexSearch]
30+
findex_interface: Union[Findex.FindexUpsert, Findex.FindexSearch]
2931
if backend == "Redis":
3032
findex_interface = FindexRedis()
3133
elif backend == "SQLite":
@@ -37,7 +39,7 @@ def main(backend: str = "Dict"):
3739
indexed_values_and_keywords = {}
3840
for uid, keywords in data.items():
3941
# Convert database UIDs to IndexedValue expected by Findex
40-
location = findex.IndexedValue.from_location(uid.encode("utf-8"))
42+
location = IndexedValue.from_location(uid.encode("utf-8"))
4143
# This location has 2 keywords associated: the firstname and lastname
4244
indexed_values_and_keywords[location] = keywords
4345

@@ -60,21 +62,21 @@ def main(backend: str = "Dict"):
6062

6163
# Create the alias `Joe` for `John`
6264
alias_graph = {
63-
findex.IndexedValue.from_keyword(b"John"): ["Joe"],
65+
IndexedValue.from_keyword(b"John"): ["Joe"],
6466
}
6567
findex_interface.upsert(alias_graph, master_key, label)
6668

6769
# Now searching `Joe` will return the same location as `John`
68-
print("Search for Joe:")
70+
print("Search with aliases:")
6971
print("\t", findex_interface.search(["Joe"], master_key, label))
7072

7173
# Generate an auto-completion graph:
7274
# For example, with the word `Wilkins`, one could upsert the following aliases:
7375
# ["Wil" => "Wilk", "Wilk" => "Wilki", "Wilki" => "Wilkin", "Wilkin" => "Wilkins"].
74-
# A search for the Keyword Thi will then return the Location of `Wilkins`.
76+
# A search for the Keyword "Wil" will then return the Location of `Wilkins`.
7577

7678
# CloudProof provides a helper function to generate such graph
77-
auto_completion_graph = findex.utils.generate_auto_completion(
79+
auto_completion_graph = utils.generate_auto_completion(
7880
["Martin", "Martial", "Wilkins"]
7981
)
8082
findex_interface.upsert(auto_completion_graph, master_key, label)
@@ -87,6 +89,17 @@ def main(backend: str = "Dict"):
8789
# `Mar` points to both Martin's and Martial's locations.
8890
# `Wil` only points to Wilkins' location.
8991

92+
print("Search using the `progress_callback`: ")
93+
94+
def echo_progress_callback(res: Dict[str, List[IndexedValue]]) -> bool:
95+
print("\t Partial results:", res)
96+
return True
97+
98+
found_locations = findex_interface.search(
99+
["Mar"], master_key, label, progress_callback=echo_progress_callback
100+
)
101+
print("\t Final results:", found_locations)
102+
90103

91104
if __name__ == "__main__":
92105

@@ -111,5 +124,5 @@ def main(backend: str = "Dict"):
111124
print("Using in-memory SQLite")
112125
main("SQLite")
113126
else:
114-
print("Using in-memory dictionnaries")
127+
print("Using in-memory dictionaries")
115128
main("Dict")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
cloudproof-py==1.0
1+
cloudproof-py==2.0
22
redis>=4.3
33
types_redis>=4.3

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cloudproof_py = ["py.typed", "*.pyi"]
77

88
[project]
99
name = "cloudproof_py"
10-
version = "2.0.0"
10+
version = "2.0.1"
1111
authors = [{ name = "Cosmian Tech", email = "tech@cosmian.com" }]
1212
description = "Python library for Cosmian Cloud Proof"
1313
readme = "README.md"

0 commit comments

Comments
 (0)