工具/软件:
我正在尝试加密数据,加密工作正常有时,如果断开与服务器的连接,并尝试与服务器连接加密工作正常.
有时、在不断开与服务器的连接的情况下、CryptoCC32XX_encrypt 函数也会返回 NULL。
CryptoCC32XX_EncryptMethod 方法= CryptoCC32XX_AES_ECB;
void EncryptData (无符号字符*inputBuf、char *outputBuf、char *encryptionKey)
{
int32_t =-1;
aesCCMParams.AES.pkey =(const uint8_t*)(encryptionKey);
解密参数= aesCCMParams;
size_t padded_len = 0;
size_t encryptedDataLength = 0;
size_t decryptedDataLength = 0;
PKCS7_PAD (inputBuf、strlen (inputBuf)、&fadded_len);
RetVal = CryptoCC32XX_encrypt (cryptoHandle1、method、inputBuf、
strlen (inputBuf)、outputBuf、
&encryptedDataLength、&aesCCMParams);
if (retval = 0)
{
RetVal = CryptoCC32XX_Decuty (cryptoHandle1、method、outputBuf、
strlen (outputBuf)、&checkBuf、
解密数据长度、&decryptParams);
}
暴露
{
hStatus =失败;
}
}
在这种情况下、加密密钥是正确的、我接收到的填充长度也是正确的。 但 CryptoCC32XX_encrypt 函数的 outputbuf 为空、我没有收到任何数据。 加密状态返回错误。