当前位置: 首页>>代码示例>>C++>>正文


C++ AES::cbc_encrypt方法代码示例

本文整理汇总了C++中AES::cbc_encrypt方法的典型用法代码示例。如果您正苦于以下问题:C++ AES::cbc_encrypt方法的具体用法?C++ AES::cbc_encrypt怎么用?C++ AES::cbc_encrypt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AES的用法示例。


在下文中一共展示了AES::cbc_encrypt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: transportSend

bool transportSend(const uint8_t to, const void *data, const uint8_t len, const bool noACK)
{
#if defined(MY_RF24_ENABLE_ENCRYPTION)
	// copy input data because it is read-only
	(void)memcpy(RF24_dataenc,data,len);
	// has to be adjusted, WIP!
	RF24_aes.set_IV(0);
	const uint8_t finalLength = len > 16 ? 32 : 16;
	//encrypt data
	RF24_aes.cbc_encrypt(RF24_dataenc, RF24_dataenc, finalLength / 16);
	return RF24_sendMessage(to, RF24_dataenc, finalLength, noACK);
#else
	return RF24_sendMessage(to, data, len, noACK);
#endif
}
开发者ID:beosro,项目名称:MySensors,代码行数:15,代码来源:MyTransportRF24.cpp

示例2: transportSend

bool transportSend(uint8_t recipient, const void* data, uint8_t len) {
	#if defined(MY_RF24_ENABLE_ENCRYPTION)
		// copy input data because it is read-only
		memcpy(_dataenc,data,len);
		len = len > 16 ? 32 : 16;
		#if defined(MY_GATEWAY_FEATURE)
			SdReadNodeData(RF24_getNodeID(), nd);
			_aes.set_key(nd.AES_256,32);
			_aes.set_IV(nd.IV);
		#else
		#endif
		//encrypt data
		_aes.set_IV(IVCl);
		_aes.cbc_encrypt(_dataenc, _dataenc, len/16);
		bool status = RF24_sendMessage( recipient, _dataenc, len );
	#else
		bool status = RF24_sendMessage( recipient, data, len );
	#endif

	return status;
}
开发者ID:Marthin-,项目名称:MySecureSensors2,代码行数:21,代码来源:MyTransportNRF24.cpp

示例3: transportSend

bool transportSend(uint8_t to, const void* data, uint8_t len) {
	#if defined(MY_RF24_ENABLE_ENCRYPTION)
		memcpy(_dataenc,data,len); // copy input data because it is read-only

		_aes.set_IV(0);//not sure if necessary
		len = len > 16 ? 32 : 16;
		_aes.cbc_encrypt(_dataenc, _dataenc, len/16); //encrypt
	#endif

	// Make sure radio has powered up

	_rf24.powerUp();
	_rf24.stopListening();
	_rf24.openWritingPipe(TO_ADDR(to));
	#if defined(MY_RF24_ENABLE_ENCRYPTION)
		bool ok = _rf24.write(_dataenc, len, to == BROADCAST_ADDRESS);
	#else
		bool ok = _rf24.write(data, len, to == BROADCAST_ADDRESS);
	#endif
	_rf24.startListening();
	return ok;
}
开发者ID:arturmon,项目名称:IboardEthernetGateway,代码行数:22,代码来源:MyTransportNRF24.cpp


注:本文中的AES::cbc_encrypt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。