Class: Wsv::TlsContext

Inherits:
Object
  • Object
show all
Defined in:
lib/wsv/tls_context.rb,
lib/wsv/tls_context/resolver.rb,
lib/wsv/tls_context/self_signed_cert.rb

Defined Under Namespace

Classes: Resolver, SelfSignedCert

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cert:, key:, ephemeral: false) ⇒ TlsContext

Returns a new instance of TlsContext.



11
12
13
14
15
# File 'lib/wsv/tls_context.rb', line 11

def initialize(cert:, key:, ephemeral: false)
  @cert = cert
  @key = key
  @ephemeral = ephemeral
end

Instance Attribute Details

#certObject (readonly)

Returns the value of attribute cert.



9
10
11
# File 'lib/wsv/tls_context.rb', line 9

def cert
  @cert
end

#keyObject (readonly)

Returns the value of attribute key.



9
10
11
# File 'lib/wsv/tls_context.rb', line 9

def key
  @key
end

Instance Method Details

#ephemeral?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/wsv/tls_context.rb', line 17

def ephemeral?
  @ephemeral
end

#to_ssl_contextObject



21
22
23
24
25
26
27
# File 'lib/wsv/tls_context.rb', line 21

def to_ssl_context
  ctx = OpenSSL::SSL::SSLContext.new
  ctx.cert = @cert
  ctx.key = @key
  ctx.min_version = OpenSSL::SSL::TLS1_2_VERSION
  ctx
end