Move ssh-client's tests and dependencies onto the SDK's forgekey (issue 1480), part 3 of 17
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/binary"
|
||||
)
|
||||
|
||||
// ed25519Line is a public key line with a well-formed ed25519 blob.
|
||||
func ed25519Line(seed byte, comment string) string {
|
||||
blob := []byte{}
|
||||
for _, part := range [][]byte{[]byte("ssh-ed25519"), make([]byte, 32)} {
|
||||
part2 := append([]byte(nil), part...)
|
||||
if len(part2) == 32 {
|
||||
part2[0] = seed
|
||||
}
|
||||
l := make([]byte, 4)
|
||||
binary.BigEndian.PutUint32(l, uint32(len(part2)))
|
||||
blob = append(append(blob, l...), part2...)
|
||||
}
|
||||
return "ssh-ed25519 " + base64.StdEncoding.EncodeToString(blob) + " " + comment
|
||||
}
|
||||
Reference in New Issue
Block a user