Skip to content

Commit

Permalink
fix(key): use appropriate type for random seed.
Browse files Browse the repository at this point in the history
Signed-off-by: Thibault Normand <me@zenithar.org>
  • Loading branch information
Zenithar committed Jun 28, 2022
1 parent 1433f3d commit 4c779fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/keys/ecdsa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ func (ECDSASuite) TestUnmarshalECDSA_FastFuzz(c *C) {
}

func (ECDSASuite) TestUnmarshalECDSA_TooLongContent(c *C) {
randomSeed := make(json.RawMessage, 1024*1024)
randomSeed := make([]byte, MaxJSONKeySize)
_, err := io.ReadFull(rand.Reader, randomSeed)
c.Assert(err, IsNil)

tooLongPayload, err := json.Marshal(
&ed25519Verifier{
PublicKey: data.HexBytes(randomSeed),
PublicKey: data.HexBytes(hex.EncodeToString(randomSeed)),
},
)
c.Assert(err, IsNil)
Expand Down
4 changes: 2 additions & 2 deletions pkg/keys/ed25519_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ func (Ed25519Suite) TestUnmarshalEd25519_FastFuzz(c *C) {
}

func (Ed25519Suite) TestUnmarshalEd25519_TooLongContent(c *C) {
randomSeed := make(json.RawMessage, 1024*1024)
randomSeed := make([]byte, MaxJSONKeySize)
_, err := io.ReadFull(rand.Reader, randomSeed)
c.Assert(err, IsNil)

tooLongPayload, err := json.Marshal(
&ed25519Verifier{
PublicKey: data.HexBytes(randomSeed),
PublicKey: data.HexBytes(hex.EncodeToString(randomSeed)),
},
)
c.Assert(err, IsNil)
Expand Down

0 comments on commit 4c779fb

Please sign in to comment.