From a0f4714340fefb92b7186811657dfcc29dcbccaa Mon Sep 17 00:00:00 2001 From: Junjie Gao Date: Wed, 21 Sep 2022 09:25:59 +0800 Subject: [PATCH] fix: resolve comments Signed-off-by: Junjie Gao --- signature/jws/conformance_test.go | 4 ++-- signature/jws/envelope.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/signature/jws/conformance_test.go b/signature/jws/conformance_test.go index 31477eb7..92e40f2a 100644 --- a/signature/jws/conformance_test.go +++ b/signature/jws/conformance_test.go @@ -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}, diff --git a/signature/jws/envelope.go b/signature/jws/envelope.go index 65fc2b73..87c7544f 100644 --- a/signature/jws/envelope.go +++ b/signature/jws/envelope.go @@ -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]) @@ -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