Sha256: 7edbf59a7b768e78895b4907f79006207fd346b65e03e8e44a7308fd2b3af604
Contents?: true
Size: 868 Bytes
Versions: 1
Compression:
Stored size: 868 Bytes
Contents
require "chef/knife" class Chef class Knife class Encrypt < Knife banner "knife encrypt DATA (options)" def run if @name_args.empty? show_usage ui.fatal "You must specify data to encrypt" exit 1 end decrypted_value = eval @name_args[0] initialization_vector = @name_args[1] secret = Chef::EncryptedDataBagItem.load_secret encrypted_value = if Chef::EncryptedDataBagItem.methods.include? :encrypt_value Chef::EncryptedDataBagItem.encrypt_value(decrypted_value, secret) else Chef::EncryptedDataBagItem::Encryptor.new(decrypted_value, secret, initialization_vector).for_encrypted_item["encrypted_data"] end puts encrypted_value end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
knife-crypt-0.0.3 | lib/chef/knife/encrypt.rb |