Skip to content

Commit

Permalink
chore: Check the signature returned by the ledger device against the …
Browse files Browse the repository at this point in the history
…public key in the keyring (#14460)

Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com>
  • Loading branch information
4 people committed Jan 2, 2023
1 parent bca18ba commit 03196d7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crypto/keyring/keyring.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,10 @@ func SignWithLedger(k *Record, msg []byte) (sig []byte, pub types.PubKey, err er
return nil, nil, err
}

if !priv.PubKey().VerifySignature(msg, sig) {
return nil, nil, errors.New("Ledger generated an invalid signature. Perhaps you have multiple ledgers and need to try another one")
}

return sig, priv.PubKey(), nil
}

Expand Down

0 comments on commit 03196d7

Please sign in to comment.