Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can RSA Encrypted Data be Sent Over HTTP?

My application encrypts data with RSA to be sent to a remote server over HTTP. Of course the data is in byte[] form. Can it safely be converted to a string, url encoded, and sent in the query of the URL? Or does it need to be encoded?

like image 608
Jonah Avatar asked Mar 15 '11 19:03

Jonah


1 Answers

Yes, of course. There's nothing RSA-specific here; you're just uploading binary data.

  • Sent in a GET query string: yes, you can URL encode it (or base64-encode it then URL encode it) provided it isn't too long - some clients and servers have URL length limits.

  • You can POST any length of data; you can POST as raw binary assuming the other end can handle it - i.e. you can bypass the parts of your framework that will attempt to parse it into parameter variables - or again as URL encoded / base-64-encoded-URL-encoded.

  • You can wrap it up as a file upload (multipart/form-data) and POST that. Again any length of data, and this will be base64 encoded only so might work out a bit shorter. It will also be easier to integrate into your server app framework as it'll likely have file upload support built-in.

like image 137
Rup Avatar answered Oct 17 '22 13:10

Rup