Class: SSH::Key::Signature

Inherits:
Object
  • Object
show all
Defined in:
lib/ssh/key/signature.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSignature

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

#identityObject

Returns the value of attribute identity.



6
7
8
# File 'lib/ssh/key/signature.rb', line 6

def identity
  @identity
end

#signatureObject

Returns the value of attribute signature.



5
6
7
# File 'lib/ssh/key/signature.rb', line 5

def signature
  @signature
end

#typeObject

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