From 2ef514b02fa37a0a2ebac0bb9668543e29033a7f Mon Sep 17 00:00:00 2001 From: drebs Date: Thu, 25 Apr 2013 19:38:44 -0300 Subject: Fix symmetric encryption when syncing. Also does: * Remove all crypto methods from LeapDocument. * Encode 'encryption_scheme' inside the document JSON. * Add functions for encrypting and decrypting. * Fix LeapSyncTarget so its connection actually returns a LeapSyncTarget. * Fix symmetric encryption when syncing: - don't try to encrypt tombstone documents. * Fix symmetric decryption when syncing: - Only try do decrypt if the incoming document has an '_encryption_scheme' entry with value equal to EncryptionSchemes.PUBKEY. * Fix doc skipping for non-syncable docs. * Fix tests that compared raw content with encrypted content. --- src/leap/soledad/tests/test_couch.py | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'src/leap/soledad/tests/test_couch.py') diff --git a/src/leap/soledad/tests/test_couch.py b/src/leap/soledad/tests/test_couch.py index cdf9c9ff..456bc080 100644 --- a/src/leap/soledad/tests/test_couch.py +++ b/src/leap/soledad/tests/test_couch.py @@ -17,7 +17,6 @@ except ImportError: import json # noqa from leap.soledad.backends.leap_backend import ( LeapDocument, - EncryptionSchemes, ) @@ -412,30 +411,5 @@ class CouchDatabaseStorageTests(CouchDBTestCase): content = self._fetch_u1db_data(db) self.assertEqual(db._replica_uid, content['replica_uid']) - def test_store_encryption_scheme(self): - db = couch.CouchDatabase('http://localhost:' + str(self.wrapper.port), - 'u1db_tests') - doc = db.create_doc_from_json(tests.simple_doc) - # assert that docs have no encryption_scheme by default - self.assertEqual(EncryptionSchemes.NONE, doc.encryption_scheme) - # assert that we can store a different value - doc.encryption_scheme = EncryptionSchemes.PUBKEY - db.put_doc(doc) - self.assertEqual( - EncryptionSchemes.PUBKEY, - db.get_doc(doc.doc_id).encryption_scheme) - # assert that we can store another different value - doc.encryption_scheme = EncryptionSchemes.SYMKEY - db.put_doc(doc) - self.assertEqual( - EncryptionSchemes.SYMKEY, - db.get_doc(doc.doc_id).encryption_scheme) - # assert that we can store the default value - doc.encryption_scheme = EncryptionSchemes.NONE - db.put_doc(doc) - self.assertEqual( - EncryptionSchemes.NONE, - db.get_doc(doc.doc_id).encryption_scheme) - load_tests = tests.load_with_scenarios -- cgit v1.2.3