@staticmethod<EOL><INDENT>def decrypt(payload, private_key):<DEDENT>
cipher = PKCS1_v1_5.new(private_key)<EOL>aes_key_str = cipher.decrypt(b64decode(payload.get("<STR_LIT>")), sentinel=None)<EOL>aes_key = json.loads(aes_key_str.decode("<STR_LIT:utf-8>"))<EOL>key = b64decode(aes_key.get("<STR_LIT:key>"))<EOL>iv = b64decode(aes_key.get("<STR_LIT>"))<EOL>encrypted_magic_envelope = b64decode(payload.get("<STR_LIT>"))<EOL>encrypter = AES.new(key, AES.MODE_CBC, iv)<EOL>content = encrypter.decrypt(encrypted_magic_envelope)<EOL>return etree.fromstring(pkcs7_unpad(content))<EOL>
Decrypt an encrypted JSON payload and return the Magic Envelope document inside.