def encrypt_view(request): msg = request.json() key = msg["key"] plain_text = request.json_body["plain_text"] cipher_suite = get_cipher_suite(key) cipher_text = cipher_suite.encrypt(plain_text) return {"cipher_text", cipher_text}
def decrypt_view(request): key = request.json()["key"] cipher_text = request.json_body["cipher_text"] cipher_suite = get_cipher_suite(key) plain_text = cipher_suite.decrypt(cipher_text) return {"plain_text", plain_text}