Class: Net::SSH::HostKeyEntries::CertAuthority

Inherits:
Object
  • Object
show all
Defined in:
lib/net/ssh/known_hosts.rb

Overview

@cert-authority entry

Instance Method Summary collapse

Constructor Details

#initialize(key, comment: nil) ⇒ CertAuthority

Returns a new instance of CertAuthority.



52
53
54
55
# File 'lib/net/ssh/known_hosts.rb', line 52

def initialize(key, comment: nil)
  @key = key
  @comment = comment
end

Instance Method Details

#matches_key?(server_key) ⇒ Boolean

Returns:

  • (Boolean)


57
58
59
60
61
62
63
# File 'lib/net/ssh/known_hosts.rb', line 57

def matches_key?(server_key)
  if ssh_types.include?(server_key.ssh_type)
    server_key.signature_valid? && (server_key.signature_key.to_blob == @key.to_blob)
  else
    false
  end
end

#ssh_typesObject



41
42
43
44
45
46
47
48
49
50
# File 'lib/net/ssh/known_hosts.rb', line 41

def ssh_types
  %w[
    [email protected]
    [email protected]
    [email protected]
    [email protected]
    [email protected]
    [email protected]
  ]
end