class SSHKey

def ssh_public_key_to_ssh2_public_key(ssh_public_key, headers = nil)


* headers<~Hash> - The Key will be used as the header-tag and the value as the header-value
* ssh_public_key<~String> - "ssh-rsa AAAAB3NzaC1yc2EA...."
==== Parameters

Convert an existing SSH public key to SSH2 (RFC4716) public key
def ssh_public_key_to_ssh2_public_key(ssh_public_key, headers = nil)
  raise PublicKeyError, "invalid ssh public key" unless SSHKey.valid_ssh_public_key?(ssh_public_key)
  _source_format, source_key = parse_ssh_public_key(ssh_public_key)
  # Add a 'Comment' Header Field unless others are explicitly passed in
  if source_comment = ssh_public_key.split(source_key)[1]
    headers = {'Comment' => source_comment.strip} if headers.nil? && !source_comment.empty?
  end
  header_fields = build_ssh2_headers(headers)
  ssh2_key = "---- BEGIN SSH2 PUBLIC KEY ----\n"
  ssh2_key << header_fields unless header_fields.nil?
  ssh2_key << source_key.scan(/.{1,#{SSH2_LINE_LENGTH}}/).join("\n")
  ssh2_key << "\n---- END SSH2 PUBLIC KEY ----"
end