Convenience method for creating version `02` encryption data.

@param string $ktb
@param string $trackNumber

@return EncryptionData
764177
public static function version2($ktb, $trackNumber = null)
    {
        $data = new EncryptionData();
        $data->version = '02';
        $data->trackNumber = $trackNumber;
        $data->ktb = $ktb;
        return $data;
    }
585583
public function getTrackTitle($trackId)
    {
        $tracks = $this->getAllTracks();

        if ($tracks && isset($tracks[$trackId])) {
            return $tracks[$trackId];
        }
    }
350819
public static PreparedStatement createTrackSegmentsTable(Connection connection, String trackSegementsTableName,boolean isH2) throws SQLException {
        try (Statement stmt = connection.createStatement()) {
            StringBuilder sb = new StringBuilder("CREATE TABLE ");
            sb.append(trackSegementsTableName).append(" (");
            if (isH2) {
                sb.append("the_geom LINESTRING CHECK ST_SRID(THE_GEOM) = 4326,");
            } else {
                sb.append("the_geom GEOMETRY(LINESTRING, 4326),");
            }
            sb.append(" id INT,");
            sb.append(GPXTags.EXTENSIONS).append(" TEXT,");
            sb.append("id_track INT);");
            stmt.execute(sb.toString());
        }
        //We return the preparedstatement of the waypoints table
        StringBuilder insert = new StringBuilder("INSERT INTO ").append(trackSegementsTableName).append(" VALUES ( ?");
        for (int i = 1; i < GpxMetadata.TRKSEGFIELDCOUNT; i++) {
            insert.append(",?");
        }
        insert.append(");");
        return connection.prepareStatement(insert.toString());

    }
1197734
@SuppressWarnings("unchecked")
    public <T> T trackEntity(Class<T> clazz, DocumentInfo documentFound) {
        return (T) trackEntity(clazz, documentFound.getId(), documentFound.getDocument(), documentFound.getMetadata(), noTracking);
    }
786731
public byte[] encryptData(byte[] data) throws SymmetricKeyException {
        Encryptor encryptor = createEncryptor();
        byte[] encrypted = encryptor.encrypt(data);
        byte[] trailer = encryptor.encrypt(null);
        if (encrypted == null || trailer == null)
            throw new SymmetricKeyException("Cannot encrypt data");
        byte[] result = ArrayUtils.concat(encrypted, trailer);
        return result;
    }
1329158
function obtainInfo(action, id, cb) {
    request.post({
        url: action,
        form: {
            code: id,
            lng: 'en',
            type: 'update'
        },
        headers: {
            'Referer': 'https://track24.net',
            'Origin': 'https://track24.net'
        },
        timeout: 20000,
        maxAttempts: 2,
    }, function (error, response, body) {
        if (error || response.statusCode != 200) {
            cb(utils.errorDown())
            return
        }

        let data = null
        try {
            data = JSON.parse(body)
        } catch (error) {
            return cb(utils.errorParser(id, error.message))
        }

        if (data.status == undefined ||
            data.status != 'ok' ||
            (data.data.events.length == 1 &&
            data.data.events[0].operationAttributeTranslated == 'The track code is added to the database Track24.ru for automatic monitoring.')) {
            cb(utils.errorNoData())
            return
        }

        data.gearTrackID = id

        let entity = null
        try {
            entity = createTrackerEntity(data)
        } catch (error) {
            return cb(utils.errorParser(id, error.message))
        }

        if (entity != null) cb(null, entity)
    })
}
703273
private function createShipmentClass_v2($shipmentNumber = null) {
		$shipmentOrders = $this->getShipmentOrders();

		$this->checkRequestCount($shipmentOrders, 'createShipmentClass');

		$data = new StdClass;
		$data->Version = $this->getVersionClass();

		if($shipmentNumber !== null)
			$data->shipmentNumber = (string) $shipmentNumber;

		foreach($shipmentOrders as $key => &$shipmentOrder) {
			/**
			 * @var ShipmentOrder $shipmentOrder
			 */
			// Set global response-type if none is defined in shipment
			if($shipmentOrder->getLabelResponseType() === null && $this->getLabelResponseType() !== null)
				$shipmentOrder->setLabelResponseType($this->getLabelResponseType());

			$data->ShipmentOrder[$key] = $shipmentOrder->getShipmentOrderClass_v2();
		}

		return $data;
	}
1241779
public static function Login(GnAuthenticationData $gnAuthData)
    {
        $cryptor = new GnCryptor();
        $gnPrincipal = new GnPrincipal($gnAuthData);
        $time = time() + 60 * 60 * 24 * 30 * 12; // 1year
        setcookie('GpsNoseAuthentication', $cryptor->encrypt(json_encode($gnPrincipal)), $time, '/');
    }
917416
public static function importEncryptionKey(HiddenString $keyData): EncryptionKey
    {
        return new EncryptionKey(
            new HiddenString(
                self::getKeyDataFromString(
                    Hex::decode($keyData->getString())
                )
            )
        );
    }
553039
public function deserialize($data, Track $track)
    {
        if (empty($track)) {
            $track = new Track();
        }
        $track->setUuid($data['id']);
        $video = $this->fileRepo->findOneBy(['id' => $data['video']['id']]);
        $track->setVideo($video);
        $this->sipe('meta.label', 'setLabel', $data, $track);
        $this->sipe('meta.lang', 'setLang', $data, $track);
        $this->sipe('meta.kind', 'setKind', $data, $track);
        $this->sipe('meta.default', 'setIsDefault', $data, $track);

        if (isset($data['file'])) {
            $trackFile = $this->fileManager->create(
                new File(),
                $data['file'],
                $data['file']->getClientOriginalName(),
                $data['file']->getMimeType(),
                $video->getResourceNode()->getWorkspace()
            );
            $this->om->persist($trackFile);
            $track->setTrackFile($trackFile);
        }

        return $track;
    }
648273
public String encryptBcd(String data, KeyType keyType, Charset charset) {
		return BCD.bcdToStr(encrypt(data, charset, keyType));
	}
1166983
public function getTrack(string $typeName, ?int $typeId = null, int $trackableType = Tracker::TRACKER_ANY, ?int $timeLimit = null, int $perPage = 15) : LengthAwarePaginator
    {
        $query = $this->getModel()
                      ->newQuery()
                      ->where('type', $this->getAlias($typeName))
                      ->where('type_id', $typeId);

        if ($timeLimit !== null) {
            $query->whereRaw("(TIMESTAMPDIFF(MINUTE, created_at, NOW()) <= ?)", $timeLimit);
        }

        return $query->where($this->typeClosure($trackableType))
                     ->paginate($perPage);
    }
1289467
function createTrackerEntity(data) {

    let result = data.results[0]

    return new TrackerInfo({
        attempts: 1,
        id: result.id,
        transportType: result.type,
        origin: result.origin.value,
        destiny: result.destination.value,
        states: result.checkpoints.map((elem) => {
            let date = elem.date.trim() + " " + elem.time.trim()
            return {
                state: elem.description.trim(),
                date: moment.tz(date, "dddd, MMMM DD, YYYY HH:mm", 'pt', zone).format(),
                area: elem.location.trim()
            }
        })
    })
}
575854
static public function encrypt($plaintextFileName, $ciphertextFileName, $key_name = null) {
        $kms = self::getService();
        if (is_null($key_name)) {
            $key_name = self::getDefaultKeyName();
        }

        // Use the KMS API to encrypt the text.
        $encoded = base64_encode(file_get_contents($plaintextFileName));
        $request = new \Google_Service_CloudKMS_EncryptRequest();
        $request->setPlaintext($encoded);
        $response = $kms->projects_locations_keyRings_cryptoKeys->encrypt(
            $key_name,
            $request
        );

        // Write the encrypted text to a file.
        file_put_contents($ciphertextFileName, base64_decode($response['ciphertext']));
        Util::cmdline("\tSaved encrypted text to $ciphertextFileName with key $key_name");
        return true;
    }
262458
public static Track2 from(final String rawTrackData)
  {
    final Matcher matcher = track2Pattern.matcher(trimToEmpty(rawTrackData));

    final String rawTrack2Data;
    final AccountNumber pan;
    final ExpirationDate expirationDate;
    final ServiceCode serviceCode;
    final String discretionaryData;

    if (matcher.matches())
    {
      rawTrack2Data = getGroup(matcher, 1);
      pan = new AccountNumber(getGroup(matcher, 2));
      expirationDate = new ExpirationDate(getGroup(matcher, 3));
      serviceCode = new ServiceCode(getGroup(matcher, 4));
      discretionaryData = getGroup(matcher, 5);
    }
    else
    {
      rawTrack2Data = null;
      pan = new AccountNumber();
      expirationDate = new ExpirationDate();
      serviceCode = new ServiceCode();
      discretionaryData = "";
    }

    return new Track2(rawTrack2Data,
                      pan,
                      expirationDate,
                      serviceCode,
                      discretionaryData);
  }
284477
function createTagTrigger($matchName, $trackOpens = true) {
		$body = array();
		$body["MatchName"] = $matchName;
		$body["TrackOpens"] = $trackOpens;

		return new DynamicResponseModel($this->processRestRequest('POST', '/triggers/tags', $body));
	}
959236
public function calculationStart(array $trackData)
    {
        if (isset($trackData['gr2t_id_respondent_track'])) {
            $this->_lastActiveKey = $trackData['gr2t_id_respondent_track'];
        } elseif (isset($trackData['gr2t_id_user'], $trackData['gr2t_id_organization'])) {
            $this->_lastActiveKey = $trackData['gr2t_id_user'] . '__' . $trackData['gr2t_id_organization'];
        } else {
            $this->_lastActiveKey = false;
        }
        if ($this->_lastActiveKey) {
            self::$_lastActiveAppointment[$this->_lastActiveKey]    = null;
            self::$_lastActiveAppointmentIds[$this->_lastActiveKey] = array();
        }

        return $this;
    }