I have already wriiten a cross platform (Windows, Linux, Mac) C++ licensing library. The code is tested and runs in production.
The cryptographic library used is Botan.
I will provide you with the functions with source code with running sample. Some of the functions:
Algos: Sha256, AES-128/CBC, RSA 2048 Bit
string LexRandomString(int length );
string LexEncrypter(string &plainText);
bool LexFileEncrypter(STRING &filePath, string &data);
string LexDecrypter(string &encryptedText);
string LexFileDecrypter(STRING &filePath);
string LexHexHash(string data);
string LexHexEncode(string data);
string LexHexDecode(string data);
bool GenerateRSAKeyPair(string &privKey, string &pubKey);
bool LexRSAVerifier(string &hash, string &signature, string &pubKey);
string LexRSASigner(string &hash, string &privKey, string passphrase);
bool LexRSAEncrypter(string &data, string &pubKey, string &encData);
bool LexRSADecrypter(string &data, string &privKey, string &hexKey, string &passphrase);