Confusing new format.

Stef Bon stefbon at
Thu Jun 8 23:39:23 AEST 2017


I'm writing my own ssh library for my fuse fs. It's purpose is to
provide sftp access, but also (X) terminalsessions and tunneling of
other services (like nfs). I'm also working on an new sftp server,
clients can connect using the new streamlocal open channel method.
The reason I choose to write my own library is I want a very tight
taylormade integration in my fuse fs.

Now my ssh library supports the pubkey methods ssh-dss and ssh-rsa. I
want to add support for ed25519. When I look at the way clients have
stored the keys in files I found openssh uses a new method. So far so

But now I got stuck. I read in PROTOCOL.key in "1. Overall format"
there are a N publickeys stored, and N privatekeys, encrypted. Because
the same number is used I can assume that the format describes that
there are the same number of privatekeys as publickeys.

Now when I look at a ed25519 private hostkey, I see the following:

- AUTH_MAGIC (found, ok)
- string ciphername (found, value none, ok)
- string kdfname (found, value none, ok)
- string kdfoptions (found, empty, ok)
- integer number of keys (found, value 3, ok?)
- string publickey (found, length 32, ok)
- string publickey (found, length 32, ok, and the exactly the same as the first)
- string encrypted (found, length 64)

 above string is build as described in "2. Unencrypted list of N private keys":

- uint32 int (not found, not ok)
- uint32 int (not found, not ok)
- string privatekey (found, length 64, ok)
- comment (found, length 10, ok)
- padding (found, ok)

There are some issues:
a. the number of keys reported is 3, but it should be 2 or 1, not 3,
since the PROTOCOL document uses the same N for public and private
keys. And there are 2 public keys included, not 3. So this is
confusing. Is the number 3 correct? If so the documentation is wrong.

b. the numbers to check the encryption are not present. This is not documented.

Can someone clarify?
Thanks in advance,

Stef Bon

More information about the openssh-unix-dev mailing list