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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With