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

前端 未结 4 415
旧巷少年郎
旧巷少年郎 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:17

    Three years after you asked the question, I stumbled across your posting, because I just had to implement something similiar. What you will need in this case is an encryption mode to break the message into key sized chunks, because of the maximum message length. You will also need block padding to pad each block of the message (oposed to message padding that is usually applied to something like DES,3DES,AES). Not easy, but possible. You need to make sure that each padded block is smaller than the maximum allowed size. For block padding you could use for example OAEP or PKCS_V1_5. As encryption mode you could use ECB (not secure but works) or something more elaborated. (see wikipedia and encryption modes).

    if you have a good crypto API you should be able to set the encryption mode and block/message padding and just throw the message at it.

提交回复
热议问题