加密与解密
我想实现以下场景 客户端应用程序将具有以下功能 1)获取图像作为参数 2)将其转换为数组的字节 3)加密 调用 Web 服务并将该数组字节传递给该服务
Service 将有一个函数,该函数将 1)接收数组的字节作为参数 2)解密它 3)从该数组字节生成图像。
1)我应该使用什么来加密数据以及如何有任何示例应用程序或文章可以帮助我。 2)对称或非对称加密 3)我将面临的任何问题
i want to implement following scenario
Client Application will have function which will
1)get a image as parameter
2)convert it into byte of array
3)encrypt it
call a web service and pass this byte of array to that service
Service Will have a function which will
1)recieve byte of array as parameter
2)decrypt it it
3)generate image from that byte of array.
1)what i should use to encrypt data and how is there any sample application or article which can help me.
2)symmetric or asymmetric encryption
3)any issue which i will face
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据您是否遇到密钥交换问题,您可以使用对称(更快)或非对称(不需要安全通道来交换密钥)加密。无论哪种情况,您都应该使用经过良好测试的加密库,而不是尝试从加密原语中推出自己的加密库。
更重要的是,您需要问自己为什么要自己进行此加密而不是让 HTTPS 处理它。如果您需要的只是一个安全通道,那么您极不可能比 HTTPS 做得更好。
Depending on whether you have a key exchange problem, you could use either symmetric (faster) or asymmetric (don't need a secure channel to exchange keys) encryption. In either case, you should be using a well-tested crypto library and not trying to roll your own from crypto primitives.
More importantly, you need to ask yourself why you're doing this encryption yourself instead of letting HTTPS handle it. If all you need is a secure channel, you're extremely unlikely to be able to do a better job than HTTPS.
如果加密的唯一目的是通过网络传递对象,则最好使用 WCF(或您使用的任何通信基础)提供的标准加密。
你不需要自己处理它。
在 WCF 中,您必须安装证书,因此如果客户端数量不受限制,那么这不是一个好的做法。
如果你想实现自己的加密 - 有很多 API - 但你真正的问题将是密钥管理(这实际上与以前是相同的问题......)
对于选择对称或非对称 - 再次 - 它将来自您的密钥管理选项
It if the sole purpose of the encryption is to pass the object over the wire - than use a standard encryption provided by WCF (or whatever communication foundation you use).
You don't need to deal with it yourself.
in WCF you'll have to install certificate so if there is unlimited number of clients it wouldn't be good practice.
if you want to implement your own encryption - there are plenty of APIs for that - but your real problem will be key management (which is actually the same problem as before...)
For choosing Symmetric or a-Symmetric - again - it will be derived from your key management options