Sha256: e3b000f8b71febb207dc9239c51d159fd392c9c301fdb471f9c02d1cc7ca7e57
Contents?: true
Size: 814 Bytes
Versions: 1
Compression:
Stored size: 814 Bytes
Contents
class ChefKeepass class Certificate attr_accessor :name def initialize(data_bag, name) @name = name @data_bag = data_bag end def decrypt_contents # use the private client_key file to create a decryptor private_key = open(Chef::Config[:client_key]).read private_key = OpenSSL::PKey::RSA.new(private_key) keys = Chef::DataBagItem.load(@data_bag, "#{name}_keys") unless keys[Chef::Config[:node_name]] throw "#{name} is not encrypted for you! Rebuild the certificate data bag" end node_key = Base64.decode64(keys[Chef::Config[:node_name]]) shared_secret = private_key.private_decrypt(node_key) certificate = Chef::EncryptedDataBagItem.load(@data_bag, @name, shared_secret) certificate["contents"] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
chef-keepass-0.2.1 | lib/chef-keepass/certificate.rb |