cubicweb/crypto.py
branch3.26
changeset 12615 7abe23cbfda1
parent 11767 432f87a63057
child 12616 bfab695b740a
--- a/cubicweb/crypto.py	Thu May 16 01:23:51 2019 +0200
+++ b/cubicweb/crypto.py	Thu May 16 17:17:42 2019 +0200
@@ -36,12 +36,13 @@
 
 def encrypt(data, seed):
     string = pickle.dumps(data)
-    string = string + '*' * (8 - len(string) % 8)
+    string = string + b'*' * (8 - len(string) % 8)
     string = b64encode(_cypherer(seed).encrypt(string))
-    return unicode(string)
+    return string.decode('utf-8')
 
 
 def decrypt(string, seed):
+    string = string.encode('utf-8')
     # pickle ignores trailing characters so we do not need to strip them off
     string = _cypherer(seed).decrypt(b64decode(string))
     return pickle.loads(string)