I wrote an openssh-key-v1 Protocol reader and extracted all fields according to the format definition:
"openssh-key-v1"0x00 # NULL-terminated "Auth Magic" string 32-bit length, "none" # ciphername length and string 32-bit length, "none" # kdfname length and string 32-bit length, nil # kdf (0 length, no kdf) 32-bit 0x01 # number of keys, hard-coded to 1 (no length) 32-bit length, sshpub # public key in ssh format 32-bit length, keytype 32-bit length, pub0 32-bit length, pub1 32-bit length for rnd+prv+comment+pad 64-bit dummy checksum? # a random 32-bit int, repeated 32-bit length, keytype # the private key (including public) 32-bit length, pub0 # Public Key parts 32-bit length, pub1 32-bit length, prv0 # Private Key parts ... # (number varies by type) 32-bit length, comment # comment string padding bytes 0x010203 # pad to blocksize
After that is done I stucked with a 64byte uint8 list that somehow needs to be converted into a
32bit 32 byte ed25519 binary private key. I could not find a definition on how to do that.
The only hint I got is that the private key is encoded according to RFC 4253 SSH Public Key format and
RSA private keys swap e and n for n and e.
I assume that I have this:
[32-bit length] [RSA exponent or EC type name] [32-bit length] [RSA modulus or EC x+y pair]
Do I need to calculate the seed on my own now? Is the second 32byte my seed?