Method: Chef::EncryptedAttribute::EncryptedMash::Version1#needs_update?

Defined in:
lib/chef/encrypted_attribute/encrypted_mash/version1.rb

#needs_update?(keys) ⇒ Boolean

Checks if the current Chef::EncryptedAttribute::EncryptedMash needs to be re-encrypted.

This usually happends when new keys are provided or some keys are removed from the previous encryption process.

In other words, this method checks all key can decrypt the data and only those keys.

Raises:



184
185
186
187
188
# File 'lib/chef/encrypted_attribute/encrypted_mash/version1.rb', line 184

def needs_update?(keys)
  keys = parse_public_keys(keys)
  !can_be_decrypted_by?(keys) ||
    self['encrypted_secret'].keys.count != keys.count
end