From 3e3c78b01a872fdb445a76250145c6e1a31056e2 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Mon, 20 Mar 2017 21:34:54 -0300 Subject: [feature] improve error messages on preamble check --- client/src/leap/soledad/client/_crypto.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'client/src') diff --git a/client/src/leap/soledad/client/_crypto.py b/client/src/leap/soledad/client/_crypto.py index 66b26521..7d9b3a05 100644 --- a/client/src/leap/soledad/client/_crypto.py +++ b/client/src/leap/soledad/client/_crypto.py @@ -386,13 +386,16 @@ class BlobDecryptor(object): # we can refuse to process something that is in the future or # too far in the past (1984 would be nice, hehe) if sch != ENC_SCHEME.symkey: - raise InvalidBlob('invalid scheme') + raise InvalidBlob('Invalid scheme: %s' % sch) if meth != ENC_METHOD.aes_256_gcm: - raise InvalidBlob('invalid encryption scheme') + raise InvalidBlob('Invalid encryption scheme: %s' % meth) if rev != self.rev: - raise InvalidBlob('invalid revision') + msg = 'Invalid revision. Expected: %s, was: %s' % (self.rev, rev) + raise InvalidBlob(msg) if doc_id != self.doc_id: - raise InvalidBlob('invalid doc id') + msg = 'Invalid doc_id. ' + + 'Expected: %s, was: %s' % (self.doc_id, doc_id) + raise InvalidBlob(msg) return preamble, iv -- cgit v1.2.3