summaryrefslogtreecommitdiff
path: root/client/src/leap
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/leap')
-rw-r--r--client/src/leap/soledad/client/_crypto.py15
-rw-r--r--client/src/leap/soledad/client/api.py42
-rw-r--r--client/src/leap/soledad/client/http_target/send.py2
-rw-r--r--client/src/leap/soledad/client/sqlcipher.py1
4 files changed, 7 insertions, 53 deletions
diff --git a/client/src/leap/soledad/client/_crypto.py b/client/src/leap/soledad/client/_crypto.py
index deba5590..cee4f0f4 100644
--- a/client/src/leap/soledad/client/_crypto.py
+++ b/client/src/leap/soledad/client/_crypto.py
@@ -128,14 +128,14 @@ def decrypt_sym(data, key, iv):
return plaintext
-
class BlobEncryptor(object):
"""
Encrypts a payload associated with a given Document.
"""
- def __init__(self, doc_info, content_fd, result=None, secret=None, iv=None):
+ def __init__(self, doc_info, content_fd, result=None, secret=None,
+ iv=None):
if iv is None:
iv = os.urandom(16)
else:
@@ -181,12 +181,12 @@ class BlobEncryptor(object):
def write(data):
self._preamble.write(data)
self._hmac.write(data)
-
+
current_time = int(time.time())
write(b'\x80')
write(struct.pack(
- 'Qbb',
+ 'Qbb',
current_time,
ENC_SCHEME.symkey,
ENC_METHOD.aes_256_ctr))
@@ -299,12 +299,11 @@ class AESEncryptor(object):
cipher = _get_aes_ctr_cipher(key, iv)
self.encryptor = cipher.encryptor()
-
+
if fd is None:
fd = BytesIO()
self.fd = fd
-
self.done = False
def write(self, data):
@@ -334,7 +333,6 @@ class HMACWriter(object):
self.result.write(self._hmac.digest())
-
class VerifiedEncrypter(object):
implements(interfaces.IConsumer)
@@ -346,7 +344,7 @@ class VerifiedEncrypter(object):
def write(self, data):
enc_chunk = self.crypter.write(data)
self.hmac.write(enc_chunk)
-
+
class AESDecryptor(object):
@@ -369,7 +367,6 @@ class AESDecryptor(object):
self.done = False
self.deferred = defer.Deferred()
-
def write(self, data):
decrypted = self.decryptor.update(data)
self.fd.write(decrypted)
diff --git a/client/src/leap/soledad/client/api.py b/client/src/leap/soledad/client/api.py
index de44f526..8ce77d24 100644
--- a/client/src/leap/soledad/client/api.py
+++ b/client/src/leap/soledad/client/api.py
@@ -131,7 +131,7 @@ class Soledad(object):
def __init__(self, uuid, passphrase, secrets_path, local_db_path,
server_url, cert_file, shared_db=None,
- auth_token=None, defer_encryption=False, syncable=True):
+ auth_token=None, syncable=True):
"""
Initialize configuration, cryptographic keys and dbs.
@@ -168,11 +168,6 @@ class Soledad(object):
Authorization token for accessing remote databases.
:type auth_token: str
- :param defer_encryption:
- Whether to defer encryption of documents, or do it
- inline while syncing.
- :type defer_encryption: bool
-
:param syncable:
If set to ``False``, this database will not attempt to synchronize
with remote replicas (default is ``True``)
@@ -343,40 +338,6 @@ class Soledad(object):
"""
return self._dbpool.runU1DBQuery(meth, *args, **kw)
- #def stream_encryption(self, result, doc):
- #print 'streaming encryption'
- #contentfd = StringIO()
- #contentfd.write(str(doc.get_json()))
- #contentfd.seek(0)
-#
- #sikret = self._secrets.remote_storage_secret
- #docinfo = DocInfo(doc.doc_id, doc.rev)
-#
- # -------------------------------------------------------
- # TODO need to pass a fd to stage this!!!
- # in the long run, we could connect this to the uploader
- # but in the meantime, I thikn it's easy if we just
- # serialize this to disk.
- #
- # To do this:
- # 1. open a file, with a known name:
- # soledad/staging/docid@rev.bin
- # 2. pass that fd to BlobEncrypter as result (it's a fd)
- # 3. On the upload part of the sync, just open again a read-only fd
- # to this staging path and read it.
- # that's the encrypted blob, ready to upload!
- # -------------------------------------------------------
-#
- #crypter = BlobEncryptor(
- #docinfo, contentfd, secret=sikret)
- #del doc
-#
-#
- #d = crypter.encrypt()
- #d.addCallback(lambda _: result)
- #return d
-
-
def put_doc(self, doc):
"""
Update a document.
@@ -841,7 +802,6 @@ class Soledad(object):
token = property(_get_token, _set_token, doc='The authentication Token.')
-
#
# ISecretsStorage
#
diff --git a/client/src/leap/soledad/client/http_target/send.py b/client/src/leap/soledad/client/http_target/send.py
index e562a128..431f06f6 100644
--- a/client/src/leap/soledad/client/http_target/send.py
+++ b/client/src/leap/soledad/client/http_target/send.py
@@ -42,8 +42,6 @@ class HTTPDocSender(object):
# Any class inheriting from this one should provide a meaningful attribute
# if the sync status event is meant to be used somewhere else.
- staging_path = os.path.join(get_path_prefix(), 'leap', 'soledad', 'staging')
-
uuid = 'undefined'
userid = 'undefined'
diff --git a/client/src/leap/soledad/client/sqlcipher.py b/client/src/leap/soledad/client/sqlcipher.py
index 8cbc3aea..618b17b9 100644
--- a/client/src/leap/soledad/client/sqlcipher.py
+++ b/client/src/leap/soledad/client/sqlcipher.py
@@ -266,7 +266,6 @@ class SQLCipherDatabase(sqlite_backend.SQLitePartialExpandDatabase):
'ALTER TABLE document '
'ADD COLUMN syncable BOOL NOT NULL DEFAULT TRUE')
-
#
# SQLCipher API methods
#