尊敬的团队:
大家好!
我正在致力于 AES-CCM 实现以实现安全的数据传输。 我参考了所提供的示例代码并复制了中的 AES-CCM 代码片段 empty_LP_EM_CC2340R5_freertos_ticlang 默认项目。
这是我的测试函数:
空隙 testEncCCM ()
{
AESCM_Handle 句柄;
CryptoKey cryptoKey;
INT_fast16_t encryptionResult;
uint8_t nonce[]="Thissansonce";
uint8_t aad[]="此字符串将经过身份验证但未加密。";
uint8_t 明文[]="此字符串将经过加密和身份验证。";
uint8_t mac[16]={0};
uint8_t 密文[sizeof (明文)]={0};
uint8_t keyingMaterial[32]={0x00、0x01、0x02、0x03、0x04、 0x05、0x06、0x07、
0x08、0x09、0x0A、0x0B、0x0C、 0x0D、0x0E、0x0F、
0x10、0x11、0x12、0x13、0x14、 0x15、0x16、0x17、
0x18、0x19、0x1A、0x1B、0x1C、 0x1D、0x1E、0x1F};
aesccm_init();
句柄= AESCCM_OPEN (0、NULL);
if (handle == NULL){
//处理错误
}
CryptoKeyPlaintext_initKey (&cryptoKey、keyingMaterial、sizeof (keyingMaterial));
AESCM_OneStepOperation 操作;
AESCM_OneStepOperation_init (&operation);
operation.key = cryptoKey (&C);
operation.aad = aad;
operation.aadLength = sizeof (aad);
operation.input =纯文本;
operation.output =加密文本;
operation.inputLength = sizeof (纯文本);
operation.nonce =一次性;
operation.nonceLength = sizeof (nonce);
operation.mac = mac;
operation.macLength = sizeof (mac);
encryptionResult = AESCM_oneStepEncrypt (handle、&operation);
if (encryptionResult != AESCM_STATUS_SUCCESS ){
//处理错误
}
AESCM_CLOSE (句柄);
}
我想讨论两件事
1. 如何验证加密的输出(即 Cypher Text 和 MAC) :是否有任何工具或计算机程序可以验证用于加密和描述的输出。
2. 与实施相关-我只想使用 AES-CCM 来确保传输数据的安全 : 目前我正在发送 UART 接收的数据(*reff. 至 AS 明文 )对中央设备透明。 我需要发送吗 明文 Data to Encryption (数据到加密)功能首先将加密数据存储到另一个缓冲区中、然后传输数据或以其他方式传输数据。
如果您需要更多信息,请告诉我
谢谢。此致、
Harinder Singh







