public static function encrypt($name, $location, $destination, $publicKeyLocation)
    {
        /** @var resource $publicKey */
        $publicKey = openssl_get_publickey(file_get_contents($publicKeyLocation));

        /** @var string $data */
        $data = file_get_contents($location);
        /** @var string $info */
        $info = json_encode(['name' => $name]);

        openssl_seal(gzcompress($data), $encryptedData, $dataKeys, [$publicKey]);
        openssl_seal(gzcompress($info), $encryptedInfo, $infoKeys, [$publicKey]);

        /** @var string $hash */
        $hash = md5($encryptedData);

        file_put_contents("$destination/$hash.data", $encryptedData);
        file_put_contents("$destination/$hash.info", $encryptedInfo);

        file_put_contents("$destination/$hash.data.key", $dataKeys[0]);
        file_put_contents("$destination/$hash.info.key", $infoKeys[0]);

        openssl_free_key($publicKey);

        return "$destination/$hash.data";
    }