Class: Net::SSH::HostKeyEntries::Revoked

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

Instance Method Summary collapse

Constructor Details

#initialize(key, comment: nil) ⇒ Revoked

Returns a new instance of Revoked.



109
110
111
112
# File 'lib/net/ssh/known_hosts.rb', line 109

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

Instance Method Details

#matches_key?(server_key) ⇒ Boolean

Returns true for the revoked key itself and for any certificate that wraps it or is signed by it, matching OpenSSH's check_key_not_revoked.

Returns:

  • (Boolean)


116
117
118
119
120
# File 'lib/net/ssh/known_hosts.rb', line 116

def matches_key?(server_key)
  keys = [server_key]
  keys += [server_key.key, server_key.signature_key] if server_key.respond_to?(:signature_key)
  keys.any? { |key| key.ssh_type == @key.ssh_type && key.to_blob == @key.to_blob }
end