Skip to content

Commit cc22312

Browse files
committed
refactor: use task_id to derive key instead of constructing nonce
- Now the pieces of one task use the same key and nonce - Key is derived from (the primary key, task_id), so every task uses different key - EncryptReader will seek corresponding offset to encrypt piece plaintext - When export encrypted files, we can decrypt whole file stream instead of decrypting every single piece Signed-off-by: chohee <[email protected]>
1 parent 5d196fb commit cc22312

File tree

10 files changed

+241
-300
lines changed

10 files changed

+241
-300
lines changed

Cargo.lock

Lines changed: 14 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dragonfly-client-storage/Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,16 @@ bincode = "1.3.3"
3434
walkdir = "2.5.0"
3535

3636
# encryption
37-
# chacha20poly1305 = { version = "0.10", features = ["std"] }
3837
aes = "0.8"
3938
ctr = "0.9"
40-
# chacha20 = "0.9.1"
4139
cipher = "0.4"
4240
rand = "0.8"
41+
hkdf = "0.12.4"
42+
sha2 = "0.10.9"
43+
# TODO: version
44+
generic-array = "0.14.7"
45+
# [patch.crates-io]
46+
# generic-array = { version = "0.14.7" }
4347

4448
[dev-dependencies]
4549
tempfile.workspace = true

0 commit comments

Comments
 (0)