Skip to content

Commit ce38bd7

Browse files
committed
incorporated review comments
Signed-off-by: Mukuls77 <[email protected]>
1 parent f4f31d0 commit ce38bd7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/cosign/verify.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,13 @@ func verifyOCISignature(ctx context.Context, verifier signature.Verifier, sig pa
217217
}
218218

219219
// ValidateAndUnpackCert calls ValidateAndUnpackCertWithIntermediates() by passing intermediate
220-
// certs from checkOpts as seperate argument
220+
// certs from checkOpts as separate argument
221221
func ValidateAndUnpackCert(cert *x509.Certificate, co *CheckOpts) (signature.Verifier, error) {
222222
return ValidateAndUnpackCertWithIntermediates(cert, co, co.IntermediateCerts)
223223
}
224224

225225
// ValidateAndUnpackCertWithIntermediates creates a Verifier from a certificate. Verifies that the
226-
// certificate chains up to a trusted root using intermediate cert passed as seperate argument.
226+
// certificate chains up to a trusted root using intermediate cert passed as separate argument.
227227
// Optionally verifies the subject and issuer of the certificate.
228228
func ValidateAndUnpackCertWithIntermediates(cert *x509.Certificate, co *CheckOpts, intermediateCerts *x509.CertPool) (signature.Verifier, error) {
229229
verifier, err := signature.LoadVerifier(cert.PublicKey, crypto.SHA256)
@@ -246,6 +246,9 @@ func ValidateAndUnpackCertWithIntermediates(cert *x509.Certificate, co *CheckOpt
246246
}
247247

248248
// Now verify the cert, then the signature.
249+
if intermediateCerts == nil {
250+
intermediateCerts = co.IntermediateCerts
251+
}
249252
chains, err := TrustedCert(cert, co.RootCerts, intermediateCerts)
250253

251254
if err != nil {

0 commit comments

Comments
 (0)