# File lib/rhc-common.rb, line 1155
def generate_ssh_key_ruby(type="RSA", bits = 1024, comment = "OpenShift-Key")
  key = RHC::Vendor::SSHKey.generate(:type => type,
                                     :bits => bits,
                                     :comment => comment)
  ssh_dir = "#{RHC::Config.home_dir}/.ssh"
  if File.exists?("#{ssh_dir}/id_rsa")
    puts "SSH key already exists: #{ssh_dir}/id_rsa.  Reusing..."
    return nil
  else
    unless File.exists?(ssh_dir)
      FileUtils.mkdir_p(ssh_dir)
      File.chmod(0700, ssh_dir)
    end
    File.open("#{ssh_dir}/id_rsa", 'w') {|f| f.write(key.private_key)}
    File.chmod(0600, "#{ssh_dir}/id_rsa")
    File.open("#{ssh_dir}/id_rsa.pub", 'w') {|f| f.write(key.ssh_public_key)}
  end
  "#{ssh_dir}/id_rsa.pub"
end