Module: HrrRbSsh::Transport::ServerHostKeyAlgorithm::Functionable

Includes:
Loggable
Included in:
EcdsaSha2Nistp256, EcdsaSha2Nistp384, EcdsaSha2Nistp521, SshDss, SshRsa
Defined in:
lib/hrr_rb_ssh/transport/server_host_key_algorithm/functionable.rb

Instance Attribute Summary

Attributes included from Loggable

#log_key, #logger

Instance Method Summary collapse

Methods included from Loggable

#log_debug, #log_error, #log_fatal, #log_info, #log_warn

Instance Method Details

#initialize(secret_key = nil, logger: nil) ⇒ Object



12
13
14
15
# File 'lib/hrr_rb_ssh/transport/server_host_key_algorithm/functionable.rb', line 12

def initialize secret_key=nil, logger: nil
  self.logger = logger
  @publickey = Algorithm::Publickey[self.class::NAME].new (secret_key || self.class::SECRET_KEY)
end

#server_public_host_keyObject



17
18
19
# File 'lib/hrr_rb_ssh/transport/server_host_key_algorithm/functionable.rb', line 17

def server_public_host_key
  @publickey.to_public_key_blob
end

#sign(signature_blob) ⇒ Object



21
22
23
# File 'lib/hrr_rb_ssh/transport/server_host_key_algorithm/functionable.rb', line 21

def sign signature_blob
  @publickey.sign signature_blob
end

#verify(signature, signature_blob) ⇒ Object



25
26
27
# File 'lib/hrr_rb_ssh/transport/server_host_key_algorithm/functionable.rb', line 25

def verify signature, signature_blob
  @publickey.verify signature, signature_blob
end