def artifact_verify
      Dir.chdir("#{$config['general']['app_cache']}/artifacts/") do
        if File.exist?("artifact.#{@checksum}.tar.gz.sig")
          $logger.debug 'Signature already extracted on disk, running verify....'
        else
          $logger.debug 'Extracting signature from manifest data...'
          signature_extract
        end

        # Verify the signature
        pubkey_install unless pubkey_exist?

        output_verify = `gpg --quiet --status-fd 1 --verify artifact.#{@checksum}.tar.gz.sig 2>&1`

        # Cleanup on disk file
        signature_cleanup

        # Was it valid?
        output_verify.each_line do |line|
          if /\[GNUPG:\]\sGOODSIG\s[A-Z0-9]*#{$config["general"]["gpg_signing_key"]}\s/.match(line)
            $logger.info "Artifact #{@checksum} has a valid signature belonging to #{$config['general']['gpg_signing_key']}"
            return true
          end

          if /\[GNUPG:\]\sBADSIG\s/.match(line)
            $logger.fatal "Artifact #{@checksum} has AN INVALID GPG SECURITY SIGNATURE and could be CORRUPT or TAMPERED with."
            exit 0
          end
        end

        # Unexpected error
        $logger.error 'An unexpected validation issue occured, see below debug information:'

        output_verify.each_line do |line|
          $logger.error "GPG: #{line}"
        end
      end

      # Something went wrong
      $logger.fatal "Artifact #{@checksum} COULD NOT BE GPG VALIDATED and could be CORRUPT or TAMPERED with."
      exit 0
    end
def artifact_verify
      Dir.chdir("#{$config['general']['app_cache']}/artifacts/") do
        if File.exist?("artifact.#{@checksum}.tar.gz.sig")
          $logger.debug 'Signature already extracted on disk, running verify....'
        else
          $logger.debug 'Extracting signature from manifest data...'
          signature_extract
        end

        # Verify the signature
        pubkey_install unless pubkey_exist?

        output_verify = `gpg --quiet --status-fd 1 --verify artifact.#{@checksum}.tar.gz.sig 2>&1`

        # Cleanup on disk file
        signature_cleanup

        # Was it valid?
        output_verify.each_line do |line|
          if /\[GNUPG:\]\sGOODSIG\s[A-Z0-9]*#{$config["general"]["gpg_signing_key"]}\s/.match(line)
            $logger.info "Artifact #{@checksum} has a valid signature belonging to #{$config['general']['gpg_signing_key']}"
            return true
          end

          if /\[GNUPG:\]\sBADSIG\s/.match(line)
            $logger.fatal "Artifact #{@checksum} has AN INVALID GPG SECURITY SIGNATURE and could be CORRUPT or TAMPERED with."
            exit 0
          end
        end

        # Unexpected error
        $logger.error 'An unexpected validation issue occured, see below debug information:'

        output_verify.each_line do |line|
          $logger.error "GPG: #{line}"
        end
      end

      # Something went wrong
      $logger.fatal "Artifact #{@checksum} COULD NOT BE GPG VALIDATED and could be CORRUPT or TAMPERED with."
      exit 0
    end
Verify the signature for a particular artifact.

 true  Signature is legit
 false Signature is invalid (security issue!)