The ED25519 key generated using ssh-keygen and the RFC4716 format have some key differences:
## ED25519 Key Generated by ssh-keygen
SSH-keygen generates ED25519 keys in OpenSSH's custom format by default. This format has the following characteristics:
1. **File Format**: The private key is stored in OpenSSH's proprietary format, which is not compatible with older SSH implementations[1].
2. **Encryption**: The private key file uses bcrypt key derivation function (KDF) for better protection of keys at rest[3].
3. **Default Behavior**: When generating ED25519 keys, ssh-keygen uses this new format unconditionally[3].
4. **File Extension**: The private key typically has no file extension (e.g., `id_ed25519`), while the public key has a `.pub` extension[1].
5. **Key Structure**: The public key starts with `ssh-ed25519` followed by the key data and an optional comment[1].
## RFC4716 Format
The RFC4716 format, also known as the SSH Public Key File Format, is different:
1. **Standardization**: It's a standardized format described in RFC 4716, designed for interoperability between different SSH implementations[5].
2. **File Format**: It uses a specific structure that includes headers and the key data encoded in Base64[5].
3. **Compatibility**: This format is more widely supported by various SSH tools and implementations[5].
4. **Conversion**: You can convert an OpenSSH ED25519 public key to RFC4716 format using the following command[1]:
```
ssh-keygen -f ~/.ssh/id_ed25519.pub -e -m RFC4716 > ~/.ssh/id_ed25519_rfc4716.pub
```
5. **Usage**: The RFC4716 format is often used when exporting public keys for use with other systems or tools that don't support the OpenSSH format directly[5].
It's important to note that while the underlying cryptographic key is the same, the way it's stored and formatted differs between these two approaches. The OpenSSH format offers enhanced security features for private keys, while the RFC4716 format provides better interoperability for public keys.
Citations:
[1] https://learn.microsoft.com/ar-sa/Azure/virtual-machines/linux/create-ssh-keys-detailed
[2] https://stackoverflow.com/questions/49083709/how-to-convert-ed25519-private-key-to-putty-ppk
[3] https://www.thedigitalcatonline.com/blog/2021/06/03/public-key-cryptography-openssh-private-keys/
[4] https://www.man7.org/linux/man-pages/man1/ssh-keygen.1.html
[5] https://www.ssh.com/academy/ssh/keygen
[6] https://github.com/Eugeny/tabby/issues/786