Class: SSH::Key::Signature
- Inherits:
-
Object
- Object
- SSH::Key::Signature
- Defined in:
- lib/ssh/key/signature.rb
Instance Attribute Summary collapse
-
#identity ⇒ Object
Returns the value of attribute identity.
-
#signature ⇒ Object
Returns the value of attribute signature.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Signature
constructor
A new instance of Signature.
-
#parse(string) ⇒ Object
Parse an ssh key signature.
Constructor Details
#initialize ⇒ Signature
Returns a new instance of Signature.
9 10 11 |
# File 'lib/ssh/key/signature.rb', line 9 def initialize @use_agent = true end |
Instance Attribute Details
#identity ⇒ Object
Returns the value of attribute identity.
6 7 8 |
# File 'lib/ssh/key/signature.rb', line 6 def identity @identity end |
#signature ⇒ Object
Returns the value of attribute signature.
5 6 7 |
# File 'lib/ssh/key/signature.rb', line 5 def signature @signature end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/ssh/key/signature.rb', line 4 def type @type end |
Class Method Details
.from_string(string) ⇒ Object
13 14 15 16 17 |
# File 'lib/ssh/key/signature.rb', line 13 def self.from_string(string) keysig = self.new keysig.parse(string) return keysig end |
Instance Method Details
#parse(string) ⇒ Object
Parse an ssh key signature. Expects a signed string that came from the ssh agent, such as from SSHKeyAuth#sign
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ssh/key/signature.rb', line 21 def parse(string) offset = 0 typelen = string[offset..(offset + 3)].reverse.unpack("L")[0] offset += 4 @type = string[offset .. (offset + typelen)] offset += typelen siglen = string[offset ..(offset + 3)].reverse.unpack("L")[0] offset += 4 @signature = string[offset ..(offset + siglen)] end |