Sha256: bfac11205e20e3a406d148588828276bfd237cf968983dd40f09f1688419017b
Contents?: true
Size: 1.24 KB
Versions: 48
Compression:
Stored size: 1.24 KB
Contents
module FastlaneCore # This class checks if a specific certificate is installed on the current mac class CertChecker def self.installed?(path) raise "Could not find file '#{path}'".red unless File.exist?(path) ids = installed_identies finger_print = sha1_fingerprint(path) return ids.include? finger_print end # Legacy Method, use `installed?` instead # rubocop:disable Style/PredicateName def self.is_installed?(path) installed?(path) end # rubocop:enable Style/PredicateName def self.installed_identies available = `security find-identity -v -p codesigning` ids = [] available.split("\n").each do |current| next if current.include? "REVOKED" begin (ids << current.match(/.*\) (.*) \".*/)[1]) rescue # the last line does not match end end return ids end def self.sha1_fingerprint(path) result = `openssl x509 -in "#{path}" -inform der -noout -sha1 -fingerprint` begin result = result.match(/SHA1 Fingerprint=(.*)/)[1] result.delete!(':') return result rescue Helper.log.info result raise "Error parsing certificate '#{path}'" end end end end
Version data entries
48 entries across 48 versions & 1 rubygems