What is the limit to the amount of data that can be encrypted with RSA?

前端 未结 4 437
旧巷少年郎
旧巷少年郎 2020-12-13 15:19

Typically it is recommended that RSA be used to encrypt a symmetric key, which is then used to encrypt the \"payload\".

What is the practical (or theoretical) limit

4条回答
  •  情歌与酒
    2020-12-13 16:05

    The limit is more or less infinite, but as you say yourself, this is not how asymmetric crypto should be used. The methods used to implement an asymmetrical crypto system are orders of magnitude slower than those for symmetric crypto (such as AES, TrippleDES, PRESENT, ...). So why would you do that? Use your asymmetric crypto to establish a key (using a secure key establishment protocol, don't invent one) and then encrypt your data with a symmetric algorithm using the established key.

    On an related note: why would you encrypt with another public key? As the name says, it's supposed to be public. An attacker can't do anything with it if he gets his hands on it.

    [Edit] One thing you should definitely check is if the functions you use implement padding (preferably RSAES-OAEP). Otherwise your public key will encrypt to the same output every time and thus an adversary spying in on your communication can still learn that it is you who is transmitting something, even though he can't see which public key it is you are transmitting.

提交回复
热议问题