This commit is contained in:
2026-05-21 08:07:16 +08:00
parent 90908cf018
commit 84d8874a38
32 changed files with 271 additions and 27 deletions
+3
View File
@@ -12,6 +12,7 @@
*
* 注意:encrypted_output缓冲区至少需要 (strlen(json_data) / 16 + 1) * 16 * 4/3 + 10 字节
*/
// 函数作用:对 JSON 字符串执行 AES-CBC 加密和 Base64 编码,生成可上传服务端的密文。
uint32_t Crypto_EncryptJSON(const char* json_data, char* encrypted_output);
/**
@@ -21,6 +22,7 @@ uint32_t Crypto_EncryptJSON(const char* json_data, char* encrypted_output);
* @param output_size 输出缓冲区大小
* @return 明文字节数,失败返回0
*/
// 函数作用:对 Base64 编码的 AES-CBC 密文进行解码和解密,输出 JSON 明文。
uint32_t Crypto_DecryptJSON(const char* encrypted_base64, char* plain_output, uint32_t output_size);
/**
@@ -34,6 +36,7 @@ uint32_t Crypto_DecryptJSON(const char* encrypted_base64, char* plain_output, ui
* @brief 初始化加密模块
* 设置密钥和IV(初始化向量)
*/
// 函数作用:初始化加密模块使用的固定密钥、IV 和底层 AES 上下文。
void Crypto_Init(void);
#endif // _CRYPTO_H_