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.
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
- #==(o) ⇒ Object
- #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 8 |
# File 'lib/orthrus/ssh/key.rb', line 3 def initialize(k, digest) @key = k @digest = digest @comment = nil @source = nil end |
Instance Attribute Details
#comment ⇒ Object
Returns the value of attribute comment.
11 12 13 |
# File 'lib/orthrus/ssh/key.rb', line 11 def comment @comment end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
10 11 12 |
# File 'lib/orthrus/ssh/key.rb', line 10 def key @key end |
#source ⇒ Object
Returns the value of attribute source.
11 12 13 |
# File 'lib/orthrus/ssh/key.rb', line 11 def source @source end |
Instance Method Details
#==(o) ⇒ Object
30 31 32 33 |
# File 'lib/orthrus/ssh/key.rb', line 30 def ==(o) return false unless o.kind_of? Orthrus::SSH::Key @key.to_pem == o.key.to_pem end |
#dsa? ⇒ Boolean
17 18 19 |
# File 'lib/orthrus/ssh/key.rb', line 17 def dsa? @key.kind_of? OpenSSL::PKey::DSA end |
#fingerprint ⇒ Object
21 22 23 24 |
# File 'lib/orthrus/ssh/key.rb', line 21 def fingerprint blob = public_identity(false) OpenSSL::Digest::MD5.hexdigest(blob).scan(/../).join(":") end |
#inspect ⇒ Object
26 27 28 |
# File 'lib/orthrus/ssh/key.rb', line 26 def inspect "#<#{self.class} #{fingerprint}>" end |
#rsa? ⇒ Boolean
13 14 15 |
# File 'lib/orthrus/ssh/key.rb', line 13 def rsa? @key.kind_of? OpenSSL::PKey::RSA end |