class SecureDataBag::FlatEncryptor
Encryptor
object responsable for encrypting the raw_hash with the secret. This object is just a wrapper around Chef::EncryptedDataBagItem.
@since 3.0.0
Attributes
The decrypted hash to encrypt @since 3.0.0
The encrypted hash generated @since 3.0.0
The keys to encrypt @since 3.0.0
The metadata used to create the encrypted_hash
Public Class Methods
Initializer @param decrypted_hash
[Hash,String] the encrypted hash to encrypt @param secret [String] the secret to encrypt with @param metadata [Hash] optional metadata @since 3.0.0
# File lib/secure_data_bag/encryptor.rb, line 55 def initialize(decrypted_hash, secret, metadata = {}) @secret = secret @metadata = metadata @encrypted_hash = {} @encrypted_keys = [] @decrypted_hash = decrypted_hash end
Public Instance Methods
Method called to encrpt the data structure and return it. @return [Hash] the encrypted value @since 3.0.0
# File lib/secure_data_bag/encryptor.rb, line 73 def encrypt ## NO WORKY ## NO WORKY ## NO WORKY ## NO WORKY ## NO WORKY ## NO WORKY Chef::EncryptedDataBagItem.encrypt_data_bag_item( @decrypted_hash, @secret ) end
Method called to encrpt the data structure and return it. @return [Hash] the encrypted value @since 3.0.0
# File lib/secure_data_bag/encryptor.rb, line 66 def encrypt! @encrypted_hash = encrypt end
Method name preserved for compatibility with Chef::EncryptedDataBagItem::Encryptor. @since 3.0.0