Class: HALEC

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/tctp/halec.rb

Overview

HTTP application layer encryption channel. Used for the Trusted Cloud Transfer Protocol (TCTP)

Direct Known Subclasses

ClientHALEC, ServerHALEC

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ HALEC

Returns a new instance of HALEC.



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rack/tctp/halec.rb', line 27

def initialize(options = {})
  @url = options[:url] || ''
  @ctx = options[:ssl_context] || OpenSSL::SSL::SSLContext.new()

  @ctx.ssl_version = :TLSv1

  @socket_here, @socket_there = socket_pair
  [@socket_here, @socket_there].each do |socket|
    socket.set_encoding(Encoding::BINARY)
  end
end

Instance Attribute Details

#certificateObject (readonly)

A server or client certificate (if any)



22
23
24
# File 'lib/rack/tctp/halec.rb', line 22

def certificate
  @certificate
end

#ctxObject (readonly)

The TLS context



25
26
27
# File 'lib/rack/tctp/halec.rb', line 25

def ctx
  @ctx
end

#private_keyObject (readonly)

The private key for a certificate (if any)



19
20
21
# File 'lib/rack/tctp/halec.rb', line 19

def private_key
  @private_key
end

#socket_hereObject (readonly)

The plaintext socket



10
11
12
# File 'lib/rack/tctp/halec.rb', line 10

def socket_here
  @socket_here
end

#socket_thereObject (readonly)

The encrypted socket



16
17
18
# File 'lib/rack/tctp/halec.rb', line 16

def socket_there
  @socket_there
end

#ssl_socketObject (readonly)

The SSL socket



13
14
15
# File 'lib/rack/tctp/halec.rb', line 13

def ssl_socket
  @ssl_socket
end

#urlObject (readonly)

The URL of this HALEC



7
8
9
# File 'lib/rack/tctp/halec.rb', line 7

def url
  @url
end