Method: RHC::Vendor::SSHKey#initialize
- Defined in:
- lib/rhc/vendor/sshkey.rb
#initialize(private_key, options = {}) ⇒ SSHKey
Create a new SSHKey object
Parameters
-
private_key - Existing RSA or DSA private key
-
options<~Hash>
-
:comment<~String> - Comment to use for the public key, defaults to “”
-
:passphrase<~String> - If the key is encrypted, supply the passphrase
-
153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/rhc/vendor/sshkey.rb', line 153 def initialize(private_key, = {}) @passphrase = [:passphrase] @comment = [:comment] || "" begin @key_object = OpenSSL::PKey::RSA.new(private_key, passphrase) @type = "rsa" rescue @key_object = OpenSSL::PKey::DSA.new(private_key, passphrase) @type = "dsa" end end |