Skip to content

Commit

Permalink
move marshalSignatures func
Browse files Browse the repository at this point in the history
  • Loading branch information
vvatanabe committed Jul 3, 2022
1 parent 4b1d026 commit ee369e4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions sshext.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,6 @@ func proveOwnership(signers []ssh.Signer, sessionID []byte, req *ssh.Request) {
_ = req.Reply(true, marshalSignatures(sigs))
}

func marshalSignatures(signatures []*ssh.Signature) []byte {
var buf bytes.Buffer
for _, s := range signatures {
raw := ssh.Marshal(s)
msg := wrapStruct(raw)
buf.Write(ssh.Marshal(msg))
}
return buf.Bytes()
}

func parsePublicKeys(p []byte) ([]ssh.PublicKey, error) {
var keys []ssh.PublicKey
for len(p) > 0 {
Expand Down Expand Up @@ -160,3 +150,13 @@ func signHostKey(signer ssh.Signer, key ssh.PublicKey, sessionID []byte) (*ssh.S
}
return signer.Sign(rand.Reader, ssh.Marshal(msg))
}

func marshalSignatures(signatures []*ssh.Signature) []byte {
var buf bytes.Buffer
for _, s := range signatures {
raw := ssh.Marshal(s)
msg := wrapStruct(raw)
buf.Write(ssh.Marshal(msg))
}
return buf.Bytes()
}

0 comments on commit ee369e4

Please sign in to comment.