Added load_ssh_public_key to load OpenSSH public keys (RSA support only)

As far as I can tell, there isn't currently a way to import OpenSSH (RFC 4253) formatted RSA public keys into an RSAPublicKey in cryptography. This commit adds that functionality.

Other Python cryptography libraries (notably PyCrypto) provide this sort of functionality and at least one library that I'd like to see ported to cryptography relies on that functionality.

This is my first-time contributing to cryptography. Your feedback would be very much appreciated! Thanks!
Yeah, DJB's netstrings are a totally different format. :shrug:

On Sat Dec 13 2014 at 9:52:59 PM Mark Adams <notifications@github.com>
wrote:

> In src/cryptography/hazmat/primitives/serialization.py
> <https://github.com/pyca/cryptography/pull/1517#discussion-diff-21794059>:
>
> > +    return _load_ssh_rsa_public_key(data, backend)
> > +
> > +
> > +def _load_ssh_rsa_public_key(data, backend):
> > +    if not data.startswith(b'ssh-rsa '):
> > +        raise ValueError('SSH-formatted RSA keys must begin with ssh-rsa')
> > +
> > +    parts = data.split(b' ')
> > +    data = base64.b64decode(parts[1])
> > +
> > +    cert_data = []
> > +
> > +    while len(data) > 0:
> > +        str_len = struct.unpack('>I', data[0:4])[0]
> > +        cert_data.append(data[4:4 + str_len])
> > +        data = data[4 + str_len:]
>
> Looks like netstrings were first defined here:
> http://cr.yp.to/proto/netstrings.txt
>
> They seem to actually use some other delimiting characters and follow a
> ":," format that differs from RFC 4251.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/pyca/cryptography/pull/1517/files#r21794059>.
>