Class: Orthrus::SSH::RSAPublicKey

Inherits:
PublicKey show all
Includes:
RSA
Defined in:
lib/orthrus/ssh/rsa.rb

Instance Attribute Summary

Attributes inherited from Key

#comment, #key, #source

Class Method Summary collapse

Methods included from RSA

#initialize, #public_identity, #type

Methods inherited from PublicKey

#verify

Methods inherited from Key

#==, #dsa?, #fingerprint, #initialize, #inspect, #rsa?

Class Method Details

.parse(data) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/orthrus/ssh/rsa.rb', line 32

def self.parse(data)
  raw = Utils.decode64 data

  b = Buffer.new raw

  type = b.read_string
  unless type == "ssh-rsa"
    raise "Unvalid key data"
  end

  k = OpenSSL::PKey::RSA.new
  k.e = b.read_bignum
  k.n = b.read_bignum

  new k
end