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?

0

There are 0 best solutions below