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


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

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


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

示例1: transportInit

bool transportInit() {
	// Start up the radio library
	_rf24.begin();

	if (!_rf24.isPVariant()) {
		return false;
	}
	_rf24.setAutoAck(1);
	_rf24.setAutoAck(BROADCAST_PIPE,false); // Turn off auto ack for broadcast
	_rf24.enableAckPayload();
	_rf24.setChannel(MY_RF24_CHANNEL);
	_rf24.setPALevel(_paLevel);
	if (!_rf24.setDataRate(MY_RF24_DATARATE)) {
		return false;
	}
	_rf24.setRetries(5,15);
	_rf24.setCRCLength(RF24_CRC_16);
	_rf24.enableDynamicPayloads();

	// All nodes listen to broadcast pipe (for FIND_PARENT_RESPONSE messages)
	_rf24.openReadingPipe(BROADCAST_PIPE, TO_ADDR(BROADCAST_ADDRESS));


	#if defined(MY_RF24_ENABLE_ENCRYPTION)
		_aes.set_key(_psk, 16); //set up AES-key
	#endif

	//_rf24.printDetails();

	return true;
}
开发者ID:arturmon,项目名称:IboardEthernetGateway,代码行数:31,代码来源:MyTransportNRF24.cpp

示例2: transportInit

bool transportInit() {

	#if defined(MY_RF24_ENABLE_ENCRYPTION)
		hwReadConfigBlock((void*)_psk, (void*)EEPROM_RF_ENCRYPTION_AES_KEY_ADDRESS, 32);
		//set up AES-key
		_aes.set_key(_psk, 32);
		// Make sure it is purged from memory when set
		memset(_psk, 0, 32);
		//set up AES IV
		hwReadConfigBlock((void*)IVCl,(void*)EEPROM_RF_ENCRYPTION_AES_IV_ADDRESS,8);
		_aes.set_IV(IVCl);
	#endif

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

示例3: 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

示例4: transportInit

bool transportInit(void)
{
#if defined(MY_RF24_ENABLE_ENCRYPTION)
	uint8_t RF24_psk[16];
#ifdef MY_ENCRYPTION_SIMPLE_PASSWD
	(void)memset(RF24_psk, 0, 16);
	(void)memcpy(RF24_psk, MY_ENCRYPTION_SIMPLE_PASSWD, strnlen(MY_ENCRYPTION_SIMPLE_PASSWD, 16));
#else
	hwReadConfigBlock((void *)RF24_psk, (void *)EEPROM_RF_ENCRYPTION_AES_KEY_ADDRESS, 16);
#endif
	//set up AES-key
	RF24_aes.set_key(RF24_psk, 16);
	// Make sure it is purged from memory when set
	(void)memset(RF24_psk, 0, 16);
#endif

#if defined(MY_RX_MESSAGE_BUFFER_FEATURE)
	RF24_registerReceiveCallback( transportRxCallback );
#endif
	return RF24_initialize();
}
开发者ID:beosro,项目名称:MySensors,代码行数:21,代码来源:MyTransportRF24.cpp


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