@@ -217,13 +217,13 @@ func verifyOCISignature(ctx context.Context, verifier signature.Verifier, sig pa
217
217
}
218
218
219
219
// ValidateAndUnpackCert calls ValidateAndUnpackCertWithIntermediates() by passing intermediate
220
- // certs from checkOpts as seperate argument
220
+ // certs from checkOpts as separate argument
221
221
func ValidateAndUnpackCert (cert * x509.Certificate , co * CheckOpts ) (signature.Verifier , error ) {
222
222
return ValidateAndUnpackCertWithIntermediates (cert , co , co .IntermediateCerts )
223
223
}
224
224
225
225
// 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.
227
227
// Optionally verifies the subject and issuer of the certificate.
228
228
func ValidateAndUnpackCertWithIntermediates (cert * x509.Certificate , co * CheckOpts , intermediateCerts * x509.CertPool ) (signature.Verifier , error ) {
229
229
verifier , err := signature .LoadVerifier (cert .PublicKey , crypto .SHA256 )
@@ -246,6 +246,9 @@ func ValidateAndUnpackCertWithIntermediates(cert *x509.Certificate, co *CheckOpt
246
246
}
247
247
248
248
// Now verify the cert, then the signature.
249
+ if intermediateCerts == nil {
250
+ intermediateCerts = co .IntermediateCerts
251
+ }
249
252
chains , err := TrustedCert (cert , co .RootCerts , intermediateCerts )
250
253
251
254
if err != nil {
0 commit comments