Class: R509::Engine

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/r509/engine.rb

Overview

a singleton class to store loaded OpenSSL Engines

Instance Method Summary collapse

Constructor Details

#initializeEngine

Returns a new instance of Engine



9
10
11
# File 'lib/r509/engine.rb', line 9

def initialize
  @engines = {}
end

Instance Method Details

#[](key) ⇒ Object

Takes an engine ID and returns the engine object



25
26
27
# File 'lib/r509/engine.rb', line 25

def [](key)
  @engines[key]
end

#load(hash) ⇒ Object

Returns OpenSSL::Engine object

Parameters:

  • hash

    Takes a hash with SO_PATH and ID

Returns:

  • OpenSSL::Engine object



15
16
17
18
19
20
21
22
# File 'lib/r509/engine.rb', line 15

def load(hash)
  validate_hash(hash)
  if @engines.key?(hash[:id])
    @engines[hash[:id]]
  else
    init_engine(hash)
  end
end