Class: HrrRbSsh::Compat::OpenSSH::PublicKey

Inherits:
Object
  • Object
show all
Defined in:
lib/hrr_rb_ssh/compat/openssh/public_key.rb

Instance Method Summary collapse

Constructor Details

#initialize(data_line) ⇒ PublicKey

Returns a new instance of PublicKey.



11
12
13
14
15
16
# File 'lib/hrr_rb_ssh/compat/openssh/public_key.rb', line 11

def initialize data_line
  splitted = data_line.split(' ')
  @algorithm_name = splitted[0]
  public_key_blob = Base64.decode64(splitted[1])
  @publickey = Algorithm::Publickey[@algorithm_name].new public_key_blob
end

Instance Method Details

#algorithm_nameObject



18
19
20
# File 'lib/hrr_rb_ssh/compat/openssh/public_key.rb', line 18

def algorithm_name
  @algorithm_name
end

#to_pemObject



22
23
24
# File 'lib/hrr_rb_ssh/compat/openssh/public_key.rb', line 22

def to_pem
  @publickey.to_pem
end