Class: Ddig::Ddr::VerifyCert

Inherits:
Object
  • Object
show all
Defined in:
lib/ddig/ddr/verify_cert.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hostname:, address:, port:, unencrypted_resolver:) ⇒ VerifyCert

Returns a new instance of VerifyCert.



10
11
12
13
14
15
16
17
# File 'lib/ddig/ddr/verify_cert.rb', line 10

def initialize(hostname:, address:, port:, unencrypted_resolver:)
  @hostname = hostname
  @address = address
  @port = port
  @unencrypted_resolver = unencrypted_resolver

  @open_timeout = 3
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



7
8
9
# File 'lib/ddig/ddr/verify_cert.rb', line 7

def address
  @address
end

#error_messageObject (readonly)

Returns the value of attribute error_message.



8
9
10
# File 'lib/ddig/ddr/verify_cert.rb', line 8

def error_message
  @error_message
end

#hostnameObject (readonly)

Returns the value of attribute hostname.



7
8
9
# File 'lib/ddig/ddr/verify_cert.rb', line 7

def hostname
  @hostname
end

#portObject (readonly)

Returns the value of attribute port.



7
8
9
# File 'lib/ddig/ddr/verify_cert.rb', line 7

def port
  @port
end

#subject_alt_nameObject (readonly)

Returns the value of attribute subject_alt_name.



8
9
10
# File 'lib/ddig/ddr/verify_cert.rb', line 8

def subject_alt_name
  @subject_alt_name
end

#unencrypted_resolverObject (readonly)

Returns the value of attribute unencrypted_resolver.



7
8
9
# File 'lib/ddig/ddr/verify_cert.rb', line 7

def unencrypted_resolver
  @unencrypted_resolver
end

#verifyObject (readonly)

Returns the value of attribute verify.



8
9
10
# File 'lib/ddig/ddr/verify_cert.rb', line 8

def verify
  @verify
end

Instance Method Details

#set_subject_alt_name(ssl_socket) ⇒ Object



61
62
63
64
65
# File 'lib/ddig/ddr/verify_cert.rb', line 61

def set_subject_alt_name(ssl_socket)
  socket = Net::BufferedIO.new(ssl_socket)

  @subject_alt_name = socket.io.peer_cert.extensions.select { |ext| ext.to_h['oid'] == 'subjectAltName' }.first.to_h['value'].split(', ')
end