SPL::blob aesencrypt(const SPL::blob &key, const SPL::blob& input_data) {
	int outputLen = 0;
	const int len = input_data.getSize();
	unsigned char  output[len + BYTES_PER_BLOCK];
	crypto(key.getData(),input_data.getData(),input_data.getSize(),&(output[0]),&outputLen,true);
	SPL::blob myblob(output,outputLen);;
    return myblob;
}
SPL::blob aesdecrypt(const SPL::blob& key, const SPL::blob &input_data) {
	int outputLen = 0;
	const int len = input_data.getSize();
	// allocate a little extra space
	unsigned char output[len+BYTES_PER_BLOCK];
	 crypto(key.getData(),input_data.getData(),input_data.getSize(),&(output[0]), &outputLen,false);
	SPL::blob myblob(output,outputLen);
	return myblob;
}
	void AsyncDataItem::setData(SPL::blob & raw, bool delimited)
	{
		uint64_t size = raw.getSize();

		if(!delimited) {
			bufferSize_.setOCursor(0);
			bufferSize_.addUInt64(size);
		}

		if(raw.ownsData()) {
			buffer_.adoptData(raw.releaseData(size), size);
		}
		else {
			buffer_.adoptData(const_cast<unsigned char *>(raw.getData()), size);
		}

	}