Class: Match::Encryption::OpenSSL
- Defined in:
- match/lib/match/encryption/openssl.rb
Instance Attribute Summary collapse
-
#force_legacy_encryption ⇒ Object
Returns the value of attribute force_legacy_encryption.
-
#keychain_name ⇒ Object
Returns the value of attribute keychain_name.
-
#working_directory ⇒ Object
Returns the value of attribute working_directory.
Class Method Summary collapse
Instance Method Summary collapse
-
#clear_password ⇒ Object
removes the password from the keychain again.
- #decrypt_files ⇒ Object
- #encrypt_files(password: nil) ⇒ Object
-
#initialize(keychain_name: nil, working_directory: nil, force_legacy_encryption: false) ⇒ OpenSSL
constructor
A new instance of OpenSSL.
- #store_password(password) ⇒ Object
Constructor Details
#initialize(keychain_name: nil, working_directory: nil, force_legacy_encryption: false) ⇒ OpenSSL
Returns a new instance of OpenSSL.
30 31 32 33 34 |
# File 'match/lib/match/encryption/openssl.rb', line 30 def initialize(keychain_name: nil, working_directory: nil, force_legacy_encryption: false) self.keychain_name = keychain_name self.working_directory = working_directory self.force_legacy_encryption = force_legacy_encryption end |
Instance Attribute Details
#force_legacy_encryption ⇒ Object
Returns the value of attribute force_legacy_encryption.
17 18 19 |
# File 'match/lib/match/encryption/openssl.rb', line 17 def force_legacy_encryption @force_legacy_encryption end |
#keychain_name ⇒ Object
Returns the value of attribute keychain_name.
13 14 15 |
# File 'match/lib/match/encryption/openssl.rb', line 13 def keychain_name @keychain_name end |
#working_directory ⇒ Object
Returns the value of attribute working_directory.
15 16 17 |
# File 'match/lib/match/encryption/openssl.rb', line 15 def working_directory @working_directory end |
Class Method Details
.configure(params) ⇒ Object
19 20 21 22 23 24 25 |
# File 'match/lib/match/encryption/openssl.rb', line 19 def self.configure(params) return self.new( keychain_name: params[:keychain_name], working_directory: params[:working_directory], force_legacy_encryption: params[:force_legacy_encryption] ) end |
Instance Method Details
#clear_password ⇒ Object
removes the password from the keychain again
74 75 76 |
# File 'match/lib/match/encryption/openssl.rb', line 74 def clear_password Security::InternetPassword.delete(server: server_name(self.keychain_name)) end |
#decrypt_files ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'match/lib/match/encryption/openssl.rb', line 48 def decrypt_files files = [] password = fetch_password! iterate(self.working_directory) do |current| files << current begin decrypt_specific_file(path: current, password: password) rescue => ex UI.verbose(ex.to_s) UI.error("Couldn't decrypt the repo, please make sure you enter the right password!") UI.user_error!("Invalid password passed via 'MATCH_PASSWORD'") if ENV["MATCH_PASSWORD"] clear_password self.decrypt_files # Call itself return end UI.success("🔓 Decrypted '#{File.basename(current)}'") if FastlaneCore::Globals.verbose? end UI.success("🔓 Successfully decrypted certificates repo") return files end |
#encrypt_files(password: nil) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'match/lib/match/encryption/openssl.rb', line 36 def encrypt_files(password: nil) files = [] password ||= fetch_password! iterate(self.working_directory) do |current| files << current encrypt_specific_file(path: current, password: password, version: force_legacy_encryption ? 1 : 2) UI.success("🔒 Encrypted '#{File.basename(current)}'") if FastlaneCore::Globals.verbose? end UI.success("🔒 Successfully encrypted certificates repo") return files end |
#store_password(password) ⇒ Object
69 70 71 |
# File 'match/lib/match/encryption/openssl.rb', line 69 def store_password(password) Security::InternetPassword.add(server_name(self.keychain_name), "", password) end |