Class: Pantry::Communication::Security::CurveSecurity::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/pantry/communication/security/curve_security.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeServer

Returns a new instance of Server.



42
43
44
45
46
47
48
49
# File 'lib/pantry/communication/security/curve_security.rb', line 42

def initialize
  @key_store = CurveKeyStore.new("server_keys")
  @authentication = Authentication.new(@key_store)
  @authentication.open

  # We log the server's public key here to make it accessible for initial setup.
  Pantry.logger.info("Configuring Server to use Curve encryption :: #{@key_store.public_key}")
end

Instance Attribute Details

#authenticationObject (readonly)

Returns the value of attribute authentication.



40
41
42
# File 'lib/pantry/communication/security/curve_security.rb', line 40

def authentication
  @authentication
end

Instance Method Details

#configure_socket(socket) ⇒ Object



55
56
57
58
# File 'lib/pantry/communication/security/curve_security.rb', line 55

def configure_socket(socket)
  socket.set(::ZMQ::CURVE_SERVER,    1)
  socket.set(::ZMQ::CURVE_SECRETKEY, @key_store.private_key)
end

#create_clientObject



60
61
62
# File 'lib/pantry/communication/security/curve_security.rb', line 60

def create_client
  @key_store.create_client
end


51
52
53
# File 'lib/pantry/communication/security/curve_security.rb', line 51

def link_to(parent)
  parent.link(@authentication)
end