Commit 9f1a9b73 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

go.crypto/ssh: cosmetic: unnest signing code for public key auth.


Committer: Dave Cheney <>
parent 8478d556
......@@ -215,16 +215,17 @@ func (p *publickeyAuth) auth(session []byte, user string, c packetConn, rand io.
for i, key := range validKeys {
pubkey := MarshalPublicKey(key)
algoname := key.PublicKeyAlgo()
sign, err := p.Sign(i, rand, buildDataSignedForAuth(session, userAuthRequestMsg{
data := buildDataSignedForAuth(session, userAuthRequestMsg{
User: user,
Service: serviceSSH,
Method: p.method(),
}, []byte(algoname), pubkey))
}, []byte(algoname), pubkey)
sigBlob, err := p.Sign(i, rand, data)
if err != nil {
return false, nil, err
// manually wrap the serialized signature in a string
s := serializeSignature(key.PublicKeyAlgo(), sign)
s := serializeSignature(key.PublicKeyAlgo(), sigBlob)
sig := make([]byte, stringLength(len(s)))
marshalString(sig, s)
msg := publickeyAuthMsg{
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment