From 6cbae163cd633d6e6174af9d60da53bdd3cce3e9 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/okms/keys/sign.go b/cmd/okms/keys/sign.go index 243226b..398169a 100644 --- a/cmd/okms/keys/sign.go +++ b/cmd/okms/keys/sign.go @@ -84,6 +84,9 @@ 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) + if !valid { + exit.OnErr(errors.New("Signature invalid")) + } } else { if valid { fmt.Println("Signature is valid")