Class: InlineEncryption::Config

Inherits:
Hash
  • Object
show all
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

Instance Method Details

#check_required_variablesObject

checks required, currently only the ‘key’



19
20
21
# File 'lib/inline_encryption/config.rb', line 19

def check_required_variables
  raise MissingRequiredVariableError, I18n.t('error.missing_key') unless key?(:key)
end

#real_keyOpenSSL::PKey::RSA

Returns the OpenSSL key instance.

Returns:

  • (OpenSSL::PKey::RSA)

    the OpenSSL key instance



24
25
26
27
28
29
30
31
32
33
# File 'lib/inline_encryption/config.rb', line 24

def real_key
  case self[:key]
  when NilClass
    nil
  when String
    load_or_use_key(self[:key])
  when OpenSSL::PKey::RSA
    self[:key]
  end
end