Class: SecureDataBag::FlatEncryptor
- Inherits:
-
Object
- Object
- SecureDataBag::FlatEncryptor
- Defined in:
- lib/secure_data_bag/encryptor.rb
Overview
Encryptor object responsable for encrypting the raw_hash with the secret. This object is just a wrapper around Chef::EncryptedDataBagItem.
Instance Attribute Summary collapse
-
#decrypted_hash ⇒ Object
readonly
The decrypted hash to encrypt.
-
#encrypted_hash ⇒ Object
readonly
The encrypted hash generated.
-
#encrypted_keys ⇒ Object
readonly
The keys to encrypt.
-
#metadata ⇒ Object
readonly
The metadata used to create the encrypted_hash.
Instance Method Summary collapse
-
#encrypt ⇒ Hash
Method called to encrpt the data structure and return it.
-
#encrypt! ⇒ Hash
(also: #for_encrypted_item)
Method called to encrpt the data structure and return it.
-
#initialize(decrypted_hash, secret, metadata = {}) ⇒ FlatEncryptor
constructor
Initializer.
Constructor Details
#initialize(decrypted_hash, secret, metadata = {}) ⇒ FlatEncryptor
Initializer
55 56 57 58 59 60 61 |
# File 'lib/secure_data_bag/encryptor.rb', line 55 def initialize(decrypted_hash, secret, = {}) @secret = secret @metadata = @encrypted_hash = {} @encrypted_keys = [] @decrypted_hash = decrypted_hash end |
Instance Attribute Details
#decrypted_hash ⇒ Object (readonly)
The decrypted hash to encrypt
45 46 47 |
# File 'lib/secure_data_bag/encryptor.rb', line 45 def decrypted_hash @decrypted_hash end |
#encrypted_hash ⇒ Object (readonly)
The encrypted hash generated
41 42 43 |
# File 'lib/secure_data_bag/encryptor.rb', line 41 def encrypted_hash @encrypted_hash end |
#encrypted_keys ⇒ Object (readonly)
The keys to encrypt
37 38 39 |
# File 'lib/secure_data_bag/encryptor.rb', line 37 def encrypted_keys @encrypted_keys end |
#metadata ⇒ Object (readonly)
The metadata used to create the encrypted_hash
48 49 50 |
# File 'lib/secure_data_bag/encryptor.rb', line 48 def @metadata end |
Instance Method Details
#encrypt ⇒ Hash
Method called to encrpt the data structure and return it.
73 74 75 76 77 78 79 80 81 82 83 84 |
# 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! ⇒ Hash Also known as: for_encrypted_item
Method called to encrpt the data structure and return it.
66 67 68 |
# File 'lib/secure_data_bag/encryptor.rb', line 66 def encrypt! @encrypted_hash = encrypt end |