public function encrypt()
    {
        Service::$log->msg('Encryption started');

        if ($this->encryptConfig->get('Type', 'openssl') == 'openssl') {
            $cmd = 'openssl bf < '.$this->source.' > '.$this->source.'.bf -k \''.$this->encryptConfig->Passphrase.'\'';
            $archive = $this->source . '.bf';
        } else if ($this->encryptConfig->get('Type') == 'gpg') {
            $cmd = 'echo \'' . $this->encryptConfig->Passphrase . '\' | gpg --batch --passphrase-fd 0 -c ' . $this->source;
            $archive = $this->source . '.gpg';
        } else {
            throw new \Exception(sprintf('Unknown encryption type "%s"', $this->encryptConfig->get('Type')));
        }

        Service::$log->msg('Encryption command: ' . $this->encryptConfig->get('Type'));

        system($cmd);

        Service::$log->msg('Encryption ended');

        Cleanup::addToQueue($archive, Cleanup::TYPE_FILE);

        return $archive;
    }