class Match::Encryption::EncryptionV1

This is to keep backwards compatibility with the old fastlane version which used the local openssl installation. The encryption parameters in this implementation reflect the old behavior which was the most common default value in those versions. As for decryption, 1.0.x OpenSSL and earlier versions use MD5, 1.1.0c and newer uses SHA256, we try both before giving an error

Constants

ALGORITHM

Public Instance Methods

decrypt(encrypted_data:, password:, salt:, hash_algorithm: "MD5") click to toggle source
# File match/lib/match/encryption/encryption.rb, line 24
def decrypt(encrypted_data:, password:, salt:, hash_algorithm: "MD5")
  cipher = ::OpenSSL::Cipher.new(ALGORITHM)
  cipher.decrypt

  keyivgen(cipher, password, salt, hash_algorithm)

  data = cipher.update(encrypted_data)
  data << cipher.final
end
encrypt(data:, password:, salt:, hash_algorithm: "MD5") click to toggle source
# File match/lib/match/encryption/encryption.rb, line 13
def encrypt(data:, password:, salt:, hash_algorithm: "MD5")
  cipher = ::OpenSSL::Cipher.new(ALGORITHM)
  cipher.encrypt

  keyivgen(cipher, password, salt, hash_algorithm)

  encrypted_data = cipher.update(data)
  encrypted_data << cipher.final
  { encrypted_data: encrypted_data }
end

Private Instance Methods

keyivgen(cipher, password, salt, hash_algorithm) click to toggle source
# File match/lib/match/encryption/encryption.rb, line 36
def keyivgen(cipher, password, salt, hash_algorithm)
  cipher.pkcs5_keyivgen(password, salt, 1, hash_algorithm)
end