I understand that in asymmetric crypto systems:
- The public key is generally used to encrypt data and only the private key can be used to decrypt that data.
- It's trivial to derive a public key from the private key (see this SO question).
Firstly, is this correct?
My goal is to supply data with my application that is difficult to decrypt and impossible to change, and so I want to be able to encrypt my data using a private key (which only I have) and allow my application to decrypt that data during runtime (hiding the public key as much as possible).
I understand that this isn't fool-proof, however, I want to stop casual re-use of the data supplied with my application.
Can anyone suggest an algorithm (preferably part of openssl) that can be used to achieve my goal? Looking at RSA_private_encypt
, for example, shows that the encrypted data is of size RSA_size()
(something like 128-bytes), which is because that function is used to generate signatures, not encrypted data. Is there a private encryption algorithm that generates data equal to the size of the plaintext data?