I was wondering if anyone knows of a way to deterministically encrypt a value in Ruby using an asymmetric encryption algorithm.
For most use-cases one only cares that when you encrypt 'A' you get 'A' back when you decrypt it, that is you do not care about the encrypted value itself. You only care about the full roundtrip.
However, for an application that I'm developing I really need the output to be deterministic. That is, I need to encrypt something with RSA without a variable padding.
When I attempt to encrypt a value with OpenSSL::PKey::RSA::NO_PADDING
an error is returned:
OpenSSL::PKey::RSAError Exception: data too small for key size
Anyone has an idea on how I can get a deterministic encrypted value using RSA?
Best regards,
DBA