Class: ChefVault::Item

Inherits:
Chef::DataBagItem
  • Object
show all
Defined in:
lib/spaux/chef/monkey_patches/client.rb

Instance Method Summary collapse

Instance Method Details

#secretObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/spaux/chef/monkey_patches/client.rb', line 21

def secret
  if @keys.include?(Chef::Config[:node_name])
    private_key = OpenSSL::PKey::RSA.new(Chef::Config[:raw_key])
    private_key.private_decrypt(Base64.decode64(@keys[Chef::Config[:node_name]]))
  else
    raise ChefVault::Exceptions::SecretDecryption,
      "#{data_bag}/#{id} is not encrypted with your public key.  "\
      "Contact an administrator of the vault item to encrypt for you!"
  end
end