Class: Sym::Crypt::Configuration
- Includes:
- Sym::Configurable
- Defined in:
- lib/sym/crypt/configuration.rb
Overview
This class encapsulates application configuration, and exports a familiar method #configure
for defining configuration in a block.
It’s values are requested by the library upon encryption or decryption, or any other operation.
Example
The following is an actual initialization from the code of this library. You may override any of the value defined below in your code, but before you use library’s encryption methods.
Sym::Crypt::Configuration.configure do |config|
config.password_cipher = 'AES-128-CBC'
config.data_cipher = 'AES-256-CBC'
config.private_key_cipher = config.data_cipher
config.compression_enabled = true
config.compression_level = Zlib::BEST_COMPRESSION
end
Instance Attribute Summary collapse
-
#compression_enabled ⇒ Object
Returns the value of attribute compression_enabled.
-
#compression_level ⇒ Object
Returns the value of attribute compression_level.
-
#data_cipher ⇒ Object
Returns the value of attribute data_cipher.
-
#password_cipher ⇒ Object
Returns the value of attribute password_cipher.
-
#private_key_cipher ⇒ Object
Returns the value of attribute private_key_cipher.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
35 36 37 38 39 40 41 |
# File 'lib/sym/crypt/configuration.rb', line 35 def initialize self.password_cipher = 'AES-128-CBC' self.data_cipher = 'AES-256-CBC' self.private_key_cipher = data_cipher self.compression_enabled = true self.compression_level = Zlib::BEST_COMPRESSION end |
Instance Attribute Details
#compression_enabled ⇒ Object
Returns the value of attribute compression_enabled.
29 30 31 |
# File 'lib/sym/crypt/configuration.rb', line 29 def compression_enabled @compression_enabled end |
#compression_level ⇒ Object
Returns the value of attribute compression_level.
29 30 31 |
# File 'lib/sym/crypt/configuration.rb', line 29 def compression_level @compression_level end |
#data_cipher ⇒ Object
Returns the value of attribute data_cipher.
29 30 31 |
# File 'lib/sym/crypt/configuration.rb', line 29 def data_cipher @data_cipher end |
#password_cipher ⇒ Object
Returns the value of attribute password_cipher.
29 30 31 |
# File 'lib/sym/crypt/configuration.rb', line 29 def password_cipher @password_cipher end |
#private_key_cipher ⇒ Object
Returns the value of attribute private_key_cipher.
29 30 31 |
# File 'lib/sym/crypt/configuration.rb', line 29 def private_key_cipher @private_key_cipher end |