@assert_crypto_availability
def encrypt_data(token, secret, data):
 iv = os.urandom(16)
 aes_key = generate_aes_key(token, secret)
 cipher = AES.new(aes_key, AES.MODE_CFB, iv)
 data = json.dumps(data)
 encoded_data = base64.b64encode((iv + cipher.encrypt(data)))
 encoded_data = (ENCRYPT_MARKER + encoded_data)
 return encoded_data

@ assert_crypto_availability def encrypt_data ( token , secret , data ) : iv = os . urandom ( 16 ) aes_key = generate_aes_key ( token , secret ) cipher = AES . new ( aes_key , AES . MODE_CFB , iv ) data = json . dumps ( data ) encoded_data = base64 . b64encode ( ( iv + cipher . encrypt ( data ) ) ) encoded_data = ( ENCRYPT_MARKER + encoded_data ) return encoded_data
encryptes the data with the given secret key .