# File lib/chef/encrypted_data_bag_item.rb, line 137 def assert_valid_cipher! # In the future, chef may support configurable ciphers. For now, only # aes-256-cbc is supported. requested_cipher = @encrypted_data["cipher"] unless requested_cipher == ALGORITHM raise UnsupportedCipher, "Cipher '#{requested_cipher}' is not supported by this version of Chef. Available ciphers: ['#{ALGORITHM}']" end end
# File lib/chef/encrypted_data_bag_item.rb, line 117 def decrypted_data @decrypted_data ||= begin plaintext = openssl_decryptor.update(encrypted_bytes) plaintext << openssl_decryptor.final rescue OpenSSL::Cipher::CipherError => e raise DecryptionFailure, "Error decrypting data bag value: '#{e.message}'. Most likely the provided key is incorrect" end end
# File lib/chef/encrypted_data_bag_item.rb, line 109 def encrypted_bytes Base64.decode64(@encrypted_data["encrypted_data"]) end
# File lib/chef/encrypted_data_bag_item.rb, line 104 def for_decrypted_item Yajl::Parser.parse(decrypted_data)["json_wrapper"] end
Generated with the Darkfish Rdoc Generator 2.