Class: InlineEncryption::Config
- Inherits:
-
Hash
- Object
- Hash
- InlineEncryption::Config
- Includes:
- Hashie::Extensions::IndifferentAccess, Hashie::Extensions::MethodAccess
- Defined in:
- lib/inline_encryption/config.rb
Overview
known configuration variables key - a String containing the private key, a filename pointing to the private key, or an OpenSSL::PKey::RSA
Instance Method Summary collapse
-
#check_required_variables ⇒ Object
checks required, currently only the ‘key’.
-
#real_key ⇒ OpenSSL::PKey::RSA
The OpenSSL key instance.
Instance Method Details
#check_required_variables ⇒ Object
checks required, currently only the ‘key’
15 16 17 |
# File 'lib/inline_encryption/config.rb', line 15 def check_required_variables raise MissingRequiredVariableError.new("missing variable: 'key'") unless self.has_key?(:key) end |
#real_key ⇒ OpenSSL::PKey::RSA
Returns the OpenSSL key instance.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/inline_encryption/config.rb', line 21 def real_key case self[:key] when NilClass nil when String if File.exists?(self[:key]) OpenSSL::PKey::RSA.new(File.read(self[:key])) else OpenSSL::PKey::RSA.new(self[:key]) end when OpenSSL::PKey::RSA self[:key] end end |