Ejemplo n.º 1
0
 def inner(request, *args, **kwargs):
     try:
         decrypted_body = rsa_decrypt(request.body, SERVER_KEY)
         request.decrypted_json = json.loads(decrypted_body)
         return view_func(request, *args, **kwargs)
     except ValueError:
         msg = "This endpoint expects a JSON object, " "encrypted with the server's public RSA key"
         return HttpResponseBadRequest(msg)
Ejemplo n.º 2
0
 def inner(request, *args, **kwargs):
     try:
         decrypted_body = rsa_decrypt(request.body, SERVER_KEY)
         request.decrypted_json = json.loads(decrypted_body)
         return view_func(request, *args, **kwargs)
     except ValueError:
         msg = ("This endpoint expects a JSON object, "
                "encrypted with the server's public RSA key")
         return HttpResponseBadRequest(msg)
Ejemplo n.º 3
0
 def decrypt_from_server(self, encrypted):
     decrypted = crypto.rsa_decrypt(encrypted, self.client_key)
     return json.loads(decrypted)
Ejemplo n.º 4
0
def decrypt(message, private_key):
    json_string = rsa_decrypt(message, private_key)
    return json.loads(json_string)
Ejemplo n.º 5
0
 def decrypt_from_server(self, encrypted):
     decrypted = crypto.rsa_decrypt(encrypted, self.client_key)
     return json.loads(decrypted)