summaryrefslogtreecommitdiffstats
path: root/combox/crypto.py
diff options
context:
space:
mode:
authorSiddharth Ravikumar <sravik@bgsu.edu>2015-02-26 02:03:39 -0500
committerSiddharth Ravikumar <sravik@bgsu.edu>2015-02-26 02:03:39 -0500
commit115df22474879c0c4cd418c5956247d3c5c721f9 (patch)
treee3506a8938594b53132c62c7d241a615cdae1eb4 /combox/crypto.py
parent2511b80565206f40f7059376ab876999c7adaae7 (diff)
modded combox.crypto.decrypt_and_glue - added new arg called `write'
- 'write' is set to True by set default. - If `write' is set, then the reconstructed file content is written to disk.
Diffstat (limited to 'combox/crypto.py')
-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