gitlab-org--gitlab-foss/qa/qa/runtime/rsa_key.rb
Lin Jen-Shin 1264e2b6e8 WIP
2018-02-05 23:34:40 +08:00

21 lines
393 B
Ruby

require 'net/ssh'
require 'forwardable'
module QA
module Runtime
class RSAKey
extend Forwardable
attr_reader :key
def_delegators :@key, :fingerprint, :to_pem
def initialize(bits = 4096)
@key = OpenSSL::PKey::RSA.new(bits)
end
def public_key
@public_key ||= "#{key.ssh_type} #{[key.to_blob].pack('m0')}"
end
end
end
end