我需要为我的项目创建Aes加密的随机密钥,并且需要将密钥存储在我的SqlLite数据库中,当我需要密钥时,我需要从db获取它并转换为相同类型以使用我的解密
我正在使用以下代码:
unsigned char key_bytes[16];
RAND_bytes(key_bytes, sizeof(key_bytes));
string key = string((char *)key_bytes, sizeof(key_bytes));
cout << key << endl;
它让我回答: ԌwHeM&GT;
我不知道如何在我的db中存储这个返回值。我需要一个字符串值。
我的参考链接也是http://www.zedwood.com/article/cpp-openssl-aes-gcm-code-sample