Class: Orthrus::SSH::Key
- Inherits:
-
Object
- Object
- Orthrus::SSH::Key
- Defined in:
- lib/orthrus/ssh/key.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #dsa? ⇒ Boolean
- #fingerprint ⇒ Object
-
#initialize(k, digest) ⇒ Key
constructor
A new instance of Key.
- #inspect ⇒ Object
- #rsa? ⇒ Boolean
Constructor Details
#initialize(k, digest) ⇒ Key
Returns a new instance of Key.
3 4 5 6 7 |
# File 'lib/orthrus/ssh/key.rb', line 3 def initialize(k, digest) @key = k @digest = digest @comment = nil end |
Instance Attribute Details
#comment ⇒ Object
Returns the value of attribute comment.
10 11 12 |
# File 'lib/orthrus/ssh/key.rb', line 10 def comment @comment end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
9 10 11 |
# File 'lib/orthrus/ssh/key.rb', line 9 def key @key end |
Instance Method Details
#dsa? ⇒ Boolean
16 17 18 |
# File 'lib/orthrus/ssh/key.rb', line 16 def dsa? @key.kind_of? OpenSSL::PKey::DSA end |
#fingerprint ⇒ Object
20 21 22 23 |
# File 'lib/orthrus/ssh/key.rb', line 20 def fingerprint blob = public_identity(false) OpenSSL::Digest::MD5.hexdigest(blob).scan(/../).join(":") end |
#inspect ⇒ Object
25 26 27 |
# File 'lib/orthrus/ssh/key.rb', line 25 def inspect "#<#{self.class} #{fingerprint}>" end |
#rsa? ⇒ Boolean
12 13 14 |
# File 'lib/orthrus/ssh/key.rb', line 12 def rsa? @key.kind_of? OpenSSL::PKey::RSA end |