Skip to content

Commit

Permalink
Fix silly error whereby a chain was required although unnecessary. (m…
Browse files Browse the repository at this point in the history
…icrosoft#1682)

Signed-off-by: Ken Gordon <ken.gordon@microsoft.com>
  • Loading branch information
KenGordon authored Mar 13, 2023
1 parent dd66992 commit 1bc5798
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions internal/tools/sign1util/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ var checkCmd = cli.Command{
},
cli.StringFlag{
Name: "chain",
Usage: "key or cert file to use (pem) (default: chain.pem)",
Value: "chain.pem",
Usage: "key or cert file to use (pem) (optional)",
},
cli.StringFlag{
Name: "did",
Expand Down Expand Up @@ -341,14 +340,22 @@ var chainCmd = cli.Command{
Usage: "input COSE Sign1 file",
Value: "input.cose",
},
cli.StringFlag{
Name: "out",
Usage: "output chain PEM text file",
},
},
Action: func(ctx *cli.Context) error {
pems, err := cosesign1.ParsePemChain(ctx.String("in"))
if err != nil {
return err
}
fmt.Fprintf(os.Stdout, "%s\n", strings.Join(pems, "\n"))
return nil
if len(ctx.String("out")) > 0 {
return cosesign1.WriteString(ctx.String("out"), strings.Join(pems, "\n"))
} else {
fmt.Fprintf(os.Stdout, "%s\n", strings.Join(pems, "\n"))
return nil
}
},
}

Expand Down

0 comments on commit 1bc5798

Please sign in to comment.