使用公钥加密大文件 [英] Encrypting large files using a public key

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

问题描述

我需要使用公钥加密一个 100KB 的文件.我一直在阅读一些帖子,声称使用公钥直接加密大文件是不切实际的,首选方法是使用对称密钥加密文件,然后使用公钥加密此对称密钥.似乎一种幼稚的解决方案是将大文件分解成碎片并使用相同的公钥对每个文件进行加密.我的问题是这个解决方案是否以及为什么是错误的?

I need to encrypt a 100KB file using a public key. I've been reading some posts claiming that it is not practical to directly encrypt large files using a public key, and that the preferred method is to encrypt the file using a symmetric key and then encrypt this symmetric key using the public key. It seems that a naive solution would be to break the large file to pieces and encrypt each one of them using the same public key. My question is whether and why this solution is wrong?

推荐答案

您提到的混合方法(生成随机对称密钥,使用它来加密数据,并仅对密钥进行非对称加密)具有巨大的性能优势.

The hybrid approach you mention (generate a random symmetric key, use this to encrypt the data, and encrypt only the key asymmetrically) has a massive performance advantage.

您也可以将大文件分解成碎片并使用相同的公钥加密每个文件",这没有任何问题,但速度要慢得多.

You could "break the large file to pieces and encrypt each one of them using the same public key" as well, there is nothing wrong with that, but it is much slower.

这篇关于使用公钥加密大文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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