From 20f9c767fe8b188b5cd3bc800377dc27a5357417 Mon Sep 17 00:00:00 2001 From: Pierre-Henri Symoneaux Date: Mon, 18 Nov 2024 18:13:37 +0100 Subject: [PATCH] fix: CLI now returns 1 when signature verification fails in JSON mode Signed-off-by: Pierre-Henri Symoneaux --- cmd/okms/keys/sign.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cmd/okms/keys/sign.go b/cmd/okms/keys/sign.go index 243226b..22f3823 100644 --- a/cmd/okms/keys/sign.go +++ b/cmd/okms/keys/sign.go @@ -84,12 +84,11 @@ SIGNATURE can also be passed from a file or stdin using '-' or '@'. Stdin can ho valid := exit.OnErr2(common.Client().Verify(cmd.Context(), keyId, params.signatureAlgorithm.Alg(), true, data, signature)) if cmd.Flag("output").Value.String() == string(flagsmgmt.JSON_OUTPUT_FORMAT) { output.JsonPrint(valid) - } else { - if valid { - fmt.Println("Signature is valid") - } else { - exit.OnErr(errors.New("Signature invalid")) - } + } else if valid { + fmt.Println("Signature is valid") + } + if !valid { + exit.OnErr(errors.New("Signature invalid")) } } else { resp := exit.OnErr2(common.Client().GetServiceKey(cmd.Context(), keyId, utils.PtrTo(types.Jwk)))