6850N/A--- glance-12.0.0.0rc1/glance/common/crypt.py.~1~ 2016-03-16 06:18:49.000000000 -0700
6850N/A+++ glance-12.0.0.0rc1/glance/common/crypt.py 2016-03-30 02:26:55.580507508 -0700
6850N/A@@ -18,14 +18,28 @@ Routines for URL-safe encrypting/decrypt
2521N/A-from Crypto.Cipher import AES
2521N/A-from Crypto.Random import random
5403N/A+from M2Crypto.EVP import Cipher
6850N/A+from glance.common import exception
2521N/A+ raise exception.Invalid(msg)
2521N/A- sr = random.StrongRandom()
6850N/A plaintext = encodeutils.to_utf8(plaintext)
6850N/A key = encodeutils.to_utf8(key)
2521N/A- init_vector = Random.get_random_bytes(16)
2521N/A+ init_vector = os.urandom(16)
2521N/A+ padded = cipher.update(str(plaintext))
2521N/A+ padded = padded + cipher.final()
6850N/A encoded = base64.urlsafe_b64encode(init_vector + padded)
6850N/A encoded = encoded.decode('ascii')
6850N/A ciphertext = encodeutils.to_utf8(ciphertext)
6850N/A key = encodeutils.to_utf8(key)
6850N/A ciphertext = base64.urlsafe_b64decode(ciphertext)
2521N/A- padded = cypher.decrypt(ciphertext[16:])
6850N/A- text = padded[:padded.rfind(b'\0')]
2521N/A+ padded = cipher.update(ciphertext[16:])
6850N/A+ text = padded + cipher.final()
6850N/A text = text.decode('utf-8')