diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2018-01-18 17:07:37 +0000 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-01-22 15:41:52 +0800 |
commit | ccceb26617a28ee6acda0d46a3997428c9f7e56a (patch) | |
tree | 6ad1eded0cc56de5d551b04444f8cc4114960279 /qa/qa/runtime/rsa_key.rb | |
parent | ba02e3a5dfb0fb95a1a32b81e893b6fe2ea39b9e (diff) | |
download | gitlab-ce-ccceb26617a28ee6acda0d46a3997428c9f7e56a.tar.gz |
Generate ssh key on the fly for QA
Diffstat (limited to 'qa/qa/runtime/rsa_key.rb')
-rw-r--r-- | qa/qa/runtime/rsa_key.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/qa/qa/runtime/rsa_key.rb b/qa/qa/runtime/rsa_key.rb new file mode 100644 index 00000000000..e9b6ea66dbd --- /dev/null +++ b/qa/qa/runtime/rsa_key.rb @@ -0,0 +1,21 @@ +require 'net/ssh' +require 'forwardable' + +module QA + module Runtime + class RSAKey + extend Forwardable + + def initialize(bits = 4096) + @key = OpenSSL::PKey::RSA.new(bits) + end + + attr_reader :key + def_delegators :@key, :fingerprint + + def public_key + @public_key ||= "#{key.ssh_type} #{[key.to_blob].pack('m0')}" + end + end + end +end |