Menu

text to encrypt max lenght for Rsa

2013-03-27
2013-03-27
  • Mario Pilesi

    Mario Pilesi - 2013-03-27

    Why the text to encrypt max lenght for Rsa is 87 and not 117 how explained qui: http://goo.gl/vkkmJ ?
    How to calc this lenght?

     
  • Jonah (pidder)

    Jonah (pidder) - 2013-03-27

    As described in the thread you mentioned and also in this topic, the total number of input bytes processed may not be more than k-11, where k is the RSA key's modulus size in bytes. That limits the message size to 117 bytes for RSA 1024 and 245 bytes for RSA 2048, respectively.

    pidcrypt's rsa.encrypt() performs a BASE64 encoding of the clear text before the actual encryption, in order to ensure 8bit characters. BASE64-encoding of an 87 bytes string results in 117 bytes, while an 88 bytes string already yields 121 bytes.

    If you want to skip the BASE64 encoding prior to encryption you can use pidcrypt's rsa.encryptRaw()

     
  • Mario Pilesi

    Mario Pilesi - 2013-03-27

    ty, really interesting.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.