Skip to content

Commit

Permalink
Update cosign generate cmd to not include newline
Browse files Browse the repository at this point in the history
Removing the newline will result in a payload and sha256sum that is
equivalent to what you get with the --output-payload flag and inside
the hashedrekordobj.data.hash.value field.

Signed-off-by: Lily Sturmann <lsturman@redhat.com>
  • Loading branch information
lkatalin committed Nov 27, 2023
1 parent da53b08 commit 66ba14c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/cosign/cli/generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ func GenerateCmd(ctx context.Context, regOpts options.RegistryOptions, imageRef
if err != nil {
return err
}
fmt.Fprintln(w, string(json))
fmt.Fprint(w, string(json))
return nil
}
4 changes: 2 additions & 2 deletions internal/pkg/cosign/rekor/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ var _ cosign.Signer = (*signerWrapper)(nil)

// Sign implements `cosign.Signer`
func (rs *signerWrapper) Sign(ctx context.Context, payload io.Reader) (oci.Signature, crypto.PublicKey, error) {
sig, pub, err := rs.inner.Sign(ctx, payload)
sig, pub, err := rs.inner.Sign(ctx, payload) // type "github.com/sigstore/cosign/v2/internal/pkg/cosign".Signer
if err != nil {
return nil, nil, err
}

payloadBytes, err := sig.Payload()
payloadBytes, err := sig.Payload() // sig type: oci.Signature
if err != nil {
return nil, nil, err
}
Expand Down

0 comments on commit 66ba14c

Please sign in to comment.