how to use RSA to encrypt files (huge data) in C#

后端 未结 6 2064
悲&欢浪女
悲&欢浪女 2020-11-28 02:38

I\'m new to encryption. I need to implement asymmetric encryption algorithm, which i think it uses private/public key. I started using a sample of RSACryptoServiceProvider.

6条回答
  •  [愿得一人]
    2020-11-28 02:56

    The .NET implementations of RSA (and all public/private key algorithms) do not support large blocks of data - because that's not the aim of public/private key.

    Instead what you would do is generate a new symmetric key and use that to encrypt the data. Then you use public/private key to encrypt the symmetric key and exchange it with the other party securely. They then decrypt the symmetric key and use it to unencrypt your data.

提交回复
热议问题