提交 9fbd87dc 编写于 作者: Z zjfsharp

fix 字符串遇到0截断问题

上级 82275ca1
......@@ -10,6 +10,8 @@ const static int MAGIC_NUMBER_LEN = 6;
const static int VERSION_LEN = 1;
const static int TAG_LEN = 128;
const static int CONSTANT_AES_GCM_KEY_LEN = 32;
}
......
......@@ -34,7 +34,7 @@ std::string SystemUtils::random_str(int len) {
}
int SystemUtils::check_key_match(const char* key, const char* filepath) {
std::string aes_key_iv(key);
std::string aes_key_iv(key, key + constant::CONSTANT_AES_GCM_KEY_LEN);
std::string sha256_aes_key_iv = util::crypto::SHA256Utils::sha256_string(aes_key_iv);
unsigned char* data_pos = (unsigned char*) malloc(sizeof(unsigned char) * 64);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册