(message)
return plaintext_bytes.decode('utf8')
Base64-decode and AES-decrypt ASCII `message`.

    Uses Django SECRET_KEY as AES key.

    >>> settings.SECRET_KEY = 'xyzzy'
    >>> b64_aes_decrypt('Vh2Tmlnr5+out2PQDefkuS9+9GtIsiEX8YBA0T/V87I=')
    'Around you is a forest.'
Base64-decode and AES-decrypt ASCII `message`.
Base64 - decode and AES - decrypt ASCII message .
def b64_aes_decrypt(message):
    """
    Base64-decode and AES-decrypt ASCII `message`.

    Uses Django SECRET_KEY as AES key.

    >>> settings.SECRET_KEY = 'xyzzy'
    >>> b64_aes_decrypt('Vh2Tmlnr5+out2PQDefkuS9+9GtIsiEX8YBA0T/V87I=')
    'Around you is a forest.'

    """
    if isinstance(settings.SECRET_KEY, bytes):
        secret_key_bytes = settings.SECRET_KEY
    else:
        secret_key_bytes = settings.SECRET_KEY.encode('ascii')
    aes_key = simple_pad(secret_key_bytes, AES_BLOCK_SIZE)[:AES_KEY_MAX_LEN]
    aes = AES.new(aes_key, AES.MODE_ECB)

    ciphertext_bytes = b64decode(message)
    padded_plaintext_bytes = aes.decrypt(ciphertext_bytes)
    plaintext_bytes = unpad(padded_plaintext_bytes)
    return plaintext_bytes.decode('utf8')
def b64_aes_decrypt ( message ) : if isinstance ( settings . SECRET_KEY , bytes ) : secret_key_bytes = settings . SECRET_KEY else : secret_key_bytes = settings . SECRET_KEY . encode ( 'ascii' ) aes_key = simple_pad ( secret_key_bytes , AES_BLOCK_SIZE ) [ : AES_KEY_MAX_LEN ] aes = AES . new ( aes_key , AES . MODE_ECB ) ciphertext_bytes = b64decode ( message ) padded_plaintext_bytes = aes . decrypt ( ciphertext_bytes ) plaintext_bytes = unpad ( padded_plaintext_bytes ) return plaintext_bytes . decode ( 'utf8' )