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

decrypted_hash[R]

The decrypted hash to encrypt @since 3.0.0

encrypted_hash[R]

The encrypted hash generated @since 3.0.0

encrypted_keys[R]

The keys to encrypt @since 3.0.0

metadata[R]

The metadata used to create the encrypted_hash

Public Class Methods

new(decrypted_hash, secret, metadata = {}) click to toggle source

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

encrypt() click to toggle source

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
encrypt!() click to toggle source

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
Also aliased as: for_encrypted_item
for_encrypted_item()

Method name preserved for compatibility with Chef::EncryptedDataBagItem::Encryptor. @since 3.0.0

Alias for: encrypt!