From 3a96973813855a6034716872413b188e9343c06a Mon Sep 17 00:00:00 2001 From: Vihang Mehta Date: Wed, 24 Jan 2024 10:32:14 -0800 Subject: [PATCH] Use io.ReadFull to ensure that generated jwk match the expected keysize Signed-off-by: Vihang Mehta --- cmd/jwx/jwk.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/jwx/jwk.go b/cmd/jwx/jwk.go index b0ea6d2fe..04dc73f26 100644 --- a/cmd/jwx/jwk.go +++ b/cmd/jwx/jwk.go @@ -156,7 +156,7 @@ func makeJwkGenerateCmd() *cli.Command { rawkey = v case jwa.OctetSeq: octets := make([]byte, c.Int("keysize")) - rand.Reader.Read(octets) + io.ReadFull(rand.Reader, octets) rawkey = octets case jwa.OKP: