Skip to content

Commit

Permalink
add size check (lestrrat-go#950)
Browse files Browse the repository at this point in the history
Signed-off-by: AdamKorcz <[email protected]>
  • Loading branch information
AdamKorcz authored Jun 30, 2023
1 parent 246dde8 commit 8149455
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions jwk/okp.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ func buildOKPPrivateKey(alg jwa.EllipticCurveAlgorithm, xbuf []byte, dbuf []byte
}
switch alg {
case jwa.Ed25519:
if len(dbuf) != ed25519.SeedSize {
return nil, fmt.Errorf(`wrong private key size`)
}
ret := ed25519.NewKeyFromSeed(dbuf)
//nolint:forcetypeassert
if !bytes.Equal(xbuf, ret.Public().(ed25519.PublicKey)) {
Expand Down

0 comments on commit 8149455

Please sign in to comment.