Skip to content

Commit

Permalink
fix: resolve comments
Browse files Browse the repository at this point in the history
Signed-off-by: Junjie Gao <[email protected]>
  • Loading branch information
JeyJeyGao committed Sep 21, 2022
1 parent 0af93b2 commit b6eae16
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions signature/jws/conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ var (
// signedAttributes for signing request
signedAttributes = signature.SignedAttributes{
SigningScheme: "notary.x509",
SigningTime: signingTime.Truncate(time.Second),
Expiry: expiry.Truncate(time.Second).Add(time.Hour * 24),
SigningTime: signingTime,
Expiry: expiry.Add(time.Hour * 24),
ExtendedAttributes: sortAttributes([]signature.Attribute{
{Key: "signedCritKey1", Value: "signedCritValue1", Critical: true},
{Key: "signedKey1", Value: "signedValue1", Critical: false},
Expand Down
4 changes: 2 additions & 2 deletions signature/jws/envelope.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (e *envelope) Verify() (*signature.EnvelopeContent, error) {
}

if len(e.base.Header.CertChain) == 0 {
return nil, &signature.InvalidSignatureError{Msg: "certificate chain is not set"}
return nil, &signature.InvalidSignatureError{Msg: "certificate chain is not present"}
}

cert, err := x509.ParseCertificate(e.base.Header.CertChain[0])
Expand Down Expand Up @@ -169,7 +169,7 @@ func (e *envelope) signerInfo(protected *jwsProtectedHeader) (*signature.SignerI
return nil, &signature.InvalidSignatureError{Msg: err.Error()}
}
if len(sig) == 0 {
return nil, &signature.InvalidSignatureError{Msg: "cose envelope missing signature"}
return nil, &signature.InvalidSignatureError{Msg: "signature missing in jws-json envelope"}
}
signerInfo.Signature = sig

Expand Down
4 changes: 2 additions & 2 deletions signature/jws/envelope_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ func TestVerify(t *testing.T) {
env.Header.CertChain = [][]byte{}

err = verifyEnvelope(env)
checkErrorEqual(t, "certificate chain is not set", err.Error())
checkErrorEqual(t, "certificate chain is not present", err.Error())
})

t.Run("tamper certificate", func(t *testing.T) {
Expand Down Expand Up @@ -540,7 +540,7 @@ func TestSignerInfo(t *testing.T) {
env.Signature = ""

_, err := getSignerInfo(env, header)
checkErrorEqual(t, `cose envelope missing signature`, err.Error())
checkErrorEqual(t, `signature missing in jws-json envelope`, err.Error())
})
t.Run("tamper cert chain", func(t *testing.T) {
env, header := getEnvelopeAndHeader(signature.SigningSchemeX509)
Expand Down

0 comments on commit b6eae16

Please sign in to comment.