randombit/botan

Support ssh-rsa public key format (RFC 4253)

Open

#2,602 opened on Jan 23, 2021

View on GitHub
 (2 comments) (1 reaction) (0 assignees)C++ (654 forks)auto 404
enhancementhelp wanted

Repository metrics

Stars
 (3,283 stars)
PR merge metrics
 (PR metrics pending)

Description

Currently the RSA class only supports the PKCS#1 (RFC 3447) standard. This is perfect for almost all cases except for when interfacing with SSH. RFC 4253 reverses the two public key parameters which makes using Botan with SSH keys impossible (without extensive workarounds).

This could be solved in a couple ways:

  1. Create a special SSHRSA_PublicKey class that extends the RSA_PublicKey classes. Invert the n and e reading and writing as necessary, including the fingerprint.
  2. Add provisions to the existing RSA_PublicKey class to handle an algorithm identifier of "ssh-rsa" differently than "rsa".
  3. Create stand-alone helper functions that use existing RSA_PublicKey but ensure the n and e are read/wrote in the correct order.

I am willing to do the legwork to make this possible, which is preferred by @randombit?

Contributor guide