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.


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

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

Instance Method Details

#matches_key?(server_key) ⇒ Boolean

Returns:

  • (Boolean)

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

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


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

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