SDCODE's avatar

Send encrypted payload with images using AJAX and decrypt in Laravel

Send form data and images using AJAX in encrypted payload field. In Laravel controller, decrypt the payload and access form data and images securely.

Hide form data from Network tab and process encrypted data and images safely in controller.

0 likes
4 replies
Tray2's avatar

If you are using HTTPS (as you should) the traffic is already encrypted.

Glukinho's avatar

Hide form data from Network tab

It's impossible. As long as browser sends a data this data can't be hidden from a browser. A browser must know what it is sending.

Nobody between a browser and server can see your transferred data if you use HTTPS (I believe you do).

JussiMannisto's avatar

Hide form data from Network tab

While you could manually encrypt data on the client before sending it, it doesn't add any meaningful protection:

  1. Like @tray2 said, https already encrypts traffic from outsiders.
  2. If unencrypted data is handled on the client, the user already has access to it.
  3. If you're encrypting data on the client side, the user has access to the encryption key.

Anything that's sent to the client is available to the user. What would be the intended purpose of this encryption?

martinbean's avatar

@sdcode Why? What problem are you trying to solve here?

There’s absolutely no point encrypting a payload before sending it to your server because if you’re using SSL (and you should be), then the payload already will be encrypted when transmitted. And if you’re encrypting before sending, then the encryption algorithm (as well as any keys) is going to be visible client-side, so someone using your app could decrypt the payload any way (not that it matters since it’s probably data they’ve entered and submitted making up the payload).

So again: what’s the actual problem you’re trying to solve here?

Please or to participate in this conversation.