Module: HrrRbSsh::Authentication::Method::Publickey::Algorithm::Functionable
- Included in:
- EcdsaSha2Nistp256, EcdsaSha2Nistp384, EcdsaSha2Nistp521, SshDss, SshRsa
- Defined in:
- lib/hrr_rb_ssh/authentication/method/publickey/algorithm/functionable.rb
Instance Method Summary collapse
- #initialize ⇒ Object
- #verify_public_key(public_key_algorithm_name, public_key, public_key_blob) ⇒ Object
- #verify_signature(session_id, message) ⇒ Object
Instance Method Details
#initialize ⇒ Object
| 13 14 15 | # File 'lib/hrr_rb_ssh/authentication/method/publickey/algorithm/functionable.rb', line 13 def initialize @logger = Logger.new(self.class.name) end | 
#verify_public_key(public_key_algorithm_name, public_key, public_key_blob) ⇒ Object
| 17 18 19 20 21 22 23 24 25 | # File 'lib/hrr_rb_ssh/authentication/method/publickey/algorithm/functionable.rb', line 17 def verify_public_key public_key_algorithm_name, public_key, public_key_blob begin publickey = HrrRbSsh::Algorithm::Publickey[self.class::NAME].new public_key public_key_algorithm_name == self.class::NAME && public_key_blob == publickey.to_public_key_blob rescue => e @logger.error { [e.backtrace[0], ": ", e., " (", e.class.to_s, ")\n\t", e.backtrace[1..-1].join("\n\t")].join } false end end | 
#verify_signature(session_id, message) ⇒ Object
| 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | # File 'lib/hrr_rb_ssh/authentication/method/publickey/algorithm/functionable.rb', line 27 def verify_signature session_id, begin signature_blob_h = { :'session identifier' => session_id, :'message number' => [:'message number'], :'user name' => [:'user name'], :'service name' => [:'service name'], :'method name' => [:'method name'], :'with signature' => [:'with signature'], :'public key algorithm name' => [:'public key algorithm name'], :'public key blob' => [:'public key blob'], } signature_blob = SignatureBlob.encode signature_blob_h publickey = HrrRbSsh::Algorithm::Publickey[self.class::NAME].new [:'public key blob'] publickey.verify [:'signature'], signature_blob rescue => e @logger.error { [e.backtrace[0], ": ", e., " (", e.class.to_s, ")\n\t", e.backtrace[1..-1].join("\n\t")].join } false end end |