可以通过HTTP发送RSA加密数据吗? [英] Can RSA Encrypted Data be Sent Over HTTP?

查看:374
本文介绍了可以通过HTTP发送RSA加密数据吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序使用RSA加密数据,通过HTTP发送到远程服务器。当然数据是byte []形式。可以安全地将其转换为字符串,URL编码,并在URL的查询中发送?还是需要编码?

解决方案

是的,当然。这里没有RSA特有的;您只是上传二进制数据。




  • 在GET查询字符串中发送:是的,您可以对其进行URL编码(或base64 - 编码,然后URL编码),只要它不是太长 - 一些客户端和服务器具有URL长度限制。


  • 您可以POST任何长度的数据;您可以将POST作为原始二进制,假设另一端可以处理它 - 即您可以绕过框架中将尝试将其解析为参数变量的部分,或者再次以URL编码/ base-64编码的URL编码。 / p>


  • 您可以将其包装成文件上传(multipart / form-data)和POST。再次任何长度的数据,这将只是base64编码,所以可能会更短一些。它也将更容易集成到您的服务器应用程序框架中,因为它可能内置文件上传支持。



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.

这篇关于可以通过HTTP发送RSA加密数据吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆