Class: FastlaneCore::CertChecker
- Inherits:
-
Object
- Object
- FastlaneCore::CertChecker
- Defined in:
- lib/fastlane_core/cert_checker.rb
Overview
This class checks if a specific certificate is installed on the current mac
Class Method Summary collapse
Class Method Details
.installed_identies ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fastlane_core/cert_checker.rb', line 13 def self.installed_identies available = `security find-identity -v -p codesigning` ids = [] available.split("\n").each do |current| unless current.include?"REVOKED" (ids << current.match(/.*\) (.*) \".*/)[1]) rescue nil # the last line does not match end end return ids end |
.is_installed?(path) ⇒ Boolean
4 5 6 7 8 9 10 11 |
# File 'lib/fastlane_core/cert_checker.rb', line 4 def self.is_installed?(path) raise "Could not find file '#{path}'".red unless File.exists?(path) ids = installed_identies finger_print = sha1_fingerprint(path) return ids.include?finger_print end |
.sha1_fingerprint(path) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fastlane_core/cert_checker.rb', line 25 def self.sha1_fingerprint(path) result = `openssl x509 -in "#{path}" -inform der -noout -sha1 -fingerprint` begin result = result.match(/SHA1 Fingerprint=(.*)/)[1] result.gsub!(":", "") return result rescue => ex Helper.log.info result raise "Error parsing certificate '#{path}'" end end |