Module: SecureDataBag::Encryptor
- Defined in:
- lib/secure_data_bag/encryptor.rb
Class Method Summary collapse
-
.new(raw_hash, secret, metadata = {}) ⇒ SecureDataBag::NestedDecryptor
Instantiate an Encryptor object responsable for encrypting the raw_hash with the secret.
Class Method Details
.new(raw_hash, secret, metadata = {}) ⇒ SecureDataBag::NestedDecryptor
Instantiate an Encryptor object responsable for encrypting the raw_hash with the secret.
The optional metadata may contain hints as to how we should encrypt the raw_hash. Should hints not be provided, this will do it’s best to detect the appropriate defaults.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/secure_data_bag/encryptor.rb', line 17 def self.new(raw_hash, secret, = {}) = Mash.new() format = ([:encryption_format] || [:decryption_format]) case format when 'encrypted' SecureDataBag::FlatEncryptor.new(raw_hash, secret, ) else SecureDataBag::NestedEncryptor.new(raw_hash, secret, ) end end |