Skip to content
Snippets Groups Projects
Unverified Commit 112a0c7a authored by Awais Qureshi's avatar Awais Qureshi Committed by GitHub
Browse files

Merge pull request #21694 from edx/awais786/BOM-437

BOM-437
parents 09d5c876 76bead17
No related merge requests found
......@@ -64,6 +64,10 @@ class UsernameCipher(object):
@staticmethod
def encrypt(username):
initialization_vector = os.urandom(AES_BLOCK_SIZE_BYTES)
if not isinstance(initialization_vector, (bytes, bytearray)):
initialization_vector = initialization_vector.encode('utf-8')
aes_cipher = UsernameCipher._get_aes_cipher(initialization_vector)
encryptor = aes_cipher.encryptor()
padder = PKCS7(AES.block_size).padder()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment