加密/解密大文件(.NET) [英] Encrypting/Decrypting large files (.NET)

查看:224
本文介绍了加密/解密大文件(.NET)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要加密,存储和再后来解密大型文件。什么是这样做的最好方法是什么?我听说RSA加密是昂贵的,并建议使用RSA加密的AES密钥,然后使用AES密钥对大文件进行加密。以实例任何建议将是巨大的。

I have to encrypt, store and then later decrypt large files. What is the best way of doing that? I heard RSA encryption is expensive and was advised to use RSA to encrypt an AES key and then use the AES key to encrypt the large files. Any suggestions with example will be great.

推荐答案

通常你所描述的是使用时,数据将在一台计算机(如服务器)进行加密,然后由另一台机器(客户端)解密的策略。服务器将使用对称密钥加密(用于性能)与新生成的密钥加密的数据,并进行加密用的公共密钥(匹配一个客户端的私有密钥)​​这个对称密钥。服务器向客户机发送将加密的数据和加密的对称密钥。客户端可以解密对称密钥,它是私有密钥,然后使用这个对称密钥解密数据。 如果你加密和解密在同一台机器上的数据可能没有什么意义,同时使用RSA和AES,你会不会想通过加密密钥到另一台计算机。

Generally the strategy you have described is used when data will be encrypted on one machine (like a server) and then decrypted by another machine (client). The server will encrypt the data using symmetric key encryption (for performance) with a newly generated key and encrypt this symmetric key with a public key (matching a client's private key). The server sends the client both the encrypted data and the encrypted symmetric key. The client can decrypt the symmetric key with it's private key and then use this symmetric key for decrypting the data. If you are encrypting and decrypting the data on the same machine it may not make sense to use both RSA and AES as you would not be trying to pass the encryption key to another machine.

这篇关于加密/解密大文件(.NET)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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