I'm working on an idea of a license system. Where I generate an encrypted file which contains an bundle identifier and a date. This license file will be shipped with my static library. The static library must check the license file and will only accept a valid one for it to work.
I wrote a simple script which uses OpenSSL
to encrypt the file with a private .pem
file. And I've generated a public key (.pub)
from that private key.
Now I would like to decrypt the file with the public key. But I cannot seem to find any usable examples online. The documentations seems pretty scarce.
A push in the right direction would be appreciated.
edit:
Here I read that I can only encrypt with a public key and only decrypt with a private key. But that would not work for my situation I think? I cannot distribute the private key in the static library. Since then one could generate their own license files.
Am I going about this wrong?
Hmm, here it states that is does work both ways.