Method: Chef::EncryptedDataBagItem::Decryptor::Version1Decryptor#for_decrypted_item

Defined in:
lib/chef/encrypted_data_bag_item/decryptor.rb

#for_decrypted_itemObject



126
127
128
129
130
131
132
133
# File 'lib/chef/encrypted_data_bag_item/decryptor.rb', line 126

def for_decrypted_item
  Chef::JSONCompat.parse(decrypted_data)["json_wrapper"]
rescue Chef::Exceptions::JSON::ParseError
  # convert to a DecryptionFailure error because the most likely scenario
  # here is that the decryption step was unsuccessful but returned bad
  # data rather than raising an error.
  raise DecryptionFailure, "Error decrypting data bag value. Most likely the provided key is incorrect"
end