summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--combox/crypto.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/combox/crypto.py b/combox/crypto.py
index 273de71..e7752d2 100644
--- a/combox/crypto.py
+++ b/combox/crypto.py
@@ -127,14 +127,14 @@ def split_and_encrypt(fpath, config, fcontent=None):
write_shards(ciphered_shards, nodes, f_basename)
-def decrypt_and_glue(fpath, config):
+def decrypt_and_glue(fpath, config, write=True):
"""
Reads encrypted shards, decrypts and glues them.
fpath: The path to file that has to be decrypted & glued from the nodes.
config: The dictionary containing the combox configuration information.
-
+ write: If set, writes the reconstructed file's content to disk.
"""
rel_path = relative_path(fpath, config)
@@ -152,5 +152,8 @@ def decrypt_and_glue(fpath, config):
# glue them together
f_content = glue_data(f_parts)
- # write the glued content to fpath
- write_file(f, f_content)
+ if write:
+ # write the glued content to fpath
+ write_file(f, f_content)
+
+ return f_content