Class: Sshkeyproof::Server
- Inherits:
-
Object
- Object
- Sshkeyproof::Server
- Defined in:
- lib/sshkeyauth.rb
Instance Attribute Summary collapse
-
#fingerprint ⇒ Object
readonly
Returns the value of attribute fingerprint.
Instance Method Summary collapse
- #correct?(key) ⇒ Boolean
-
#initialize(request_string) ⇒ Server
constructor
A new instance of Server.
Constructor Details
#initialize(request_string) ⇒ Server
Returns a new instance of Server.
28 29 30 |
# File 'lib/sshkeyauth.rb', line 28 def initialize(request_string) (@fingerprint,@random,@ciphertext) = request_string.to_s.split("|") end |
Instance Attribute Details
#fingerprint ⇒ Object (readonly)
Returns the value of attribute fingerprint.
27 28 29 |
# File 'lib/sshkeyauth.rb', line 27 def fingerprint @fingerprint end |
Instance Method Details
#correct?(key) ⇒ Boolean
32 33 34 35 |
# File 'lib/sshkeyauth.rb', line 32 def correct?(key) openssl_key = String===key ? OpenSSL::PKey::RSA.new(key) : key @fingerprint && @random && @ciphertext && openssl_key.public_key.public_decrypt([@ciphertext].pack('H*')) == [@random].pack('H*') rescue nil end |