OmniSSHAgent icon indicating copy to clipboard operation
OmniSSHAgent copied to clipboard

Cannot retrieve comment information for private keys in OpenSSH format

Open masahide opened this issue 2 years ago • 0 comments

In the golang.org/x/crypto/ssh/agent implementation https://github.com/golang/crypto/blob/86341886e2925764dc890ad96c141a1bc76043af/ssh/keys.go#L1338-L1451 xParsed comment information has been discarded.

	case KeyAlgoED25519:
		key := struct {
			Pub     []byte
			Priv    []byte
			Comment string
			Pad     []byte `ssh:"rest"`
		}{}

		if err := Unmarshal(pk1.Rest, &key); err != nil {
			return nil, err
		}
		pk := ed25519.PrivateKey(make([]byte, ed25519.PrivateKeySize))
		copy(pk, key.Priv)
		return &pk, nil

masahide avatar Feb 27 '22 07:02 masahide