public function prepareEncrypting(&$error)
	{
		$header = $this->getHeader();
		$header->masterSeed = random_bytes(self::SEED_LEN);
		$header->transformSeed = random_bytes(self::SEED_LEN);
		$header->encryptionIV = random_bytes(16);
		$header->randomStreamKey = random_bytes(self::SEED_LEN);
		$header->startBytes = random_bytes(self::STARTBYTES_LEN);

		if($header->randomStream == KdbxHeader::RANDOMSTREAM_SALSA20)
		{
			$this->_randomStream = Salsa20Stream::create(
				hash(self::HASH, $header->randomStreamKey, true),
				self::SALSA20_IV);
			if($this->_randomStream == null)
			{
				$error = "Kdbx file encrypt: random stream parameters error.";
				return false;
			}
		}

		$result = $header->toBinary(self::HASH);

		if(!self::headerCheck($header))
		{
			$error = "Kdbx file encrypt: header check failed.";
			return false;
		}

		$this->_headerBinary = $result;
		return true;
	}