0

My question is implementation-irrelevant, but I am giving implementation details anyway: I am working with Delphi 10.2 TurboPower LockBox 2 (https://github.com/jarto/lockbox2) implementaion. This is quite popular library for Delphi and that is why I am expecting that it works reasonably well and that is why my question is not about possible failures in the particular implementation but is more about the way RSA works.

I have 8 character string and I am encrypting it with the public key RSA 1024, and the resulting string ir 172 bytes long. How can I decrypt with the private key RSA 1024, if https://stackoverflow.com/a/5868456/1375882 suggest that the maximum length of the message should not exceed 62 bytes?

I is possible to generate shorter encryptions (less than 60 bytes) with RSA 1024 to be on the safe side that I can decrypt them in reasonable time?

While I can decrypt the 172 byte message with the private key within some seconds. I am experiencing the problem in the other direction encryption with the private key is fast, the the decryption of the 172 byte string with the public key is unreasonably long - more than 10 minutes and even then the result is not achieved.

So - I guess that the referenced SO advice about the maximum length of 62 bytes should be observed, but how can I observe this rule if encryption generates strings that are 172 bytes longs?

TomR
  • 2,696
  • 6
  • 34
  • 87
  • 1
    You have several misunderstandings. Firstly, your RSA 1024 encryption output is 128 bytes, not 172. What you're counting as 172 bytes is probably the base64 encoding of the RSA output. Secondly, the limit on plaintext size is for *encryption*. Decryption will return whatever was encrypted. Thirdly, that plaintext limit varies depending on the padding scheme used. Finally, I don't understand your claim about slow signature verification. – President James K. Polk Sep 26 '22 at 13:38
  • 1
    If you're going to use one software package to encrypt something and another to decrypt the same information, you need to know the exact details of the technology used. Unfortunately, cryptography research is strong on math and extremely bad on usability, leading to problems like this. RSA _on its own_ is just not very useful, and it doesn't fit neatly into a set of lego bricks that are designed to work together. – MSalters Sep 26 '22 at 13:48

0 Answers0