@@ -644,7 +644,7 @@ func (r *OCIRepositoryReconciler) verifySignature(ctx context.Context, obj *ociv
644
644
return soci .VerificationResultFailed , err
645
645
}
646
646
647
- signatureVerified := false
647
+ signatureVerified := soci . VerificationResultFailed
648
648
for k , data := range pubSecret .Data {
649
649
// search for public keys in the secret
650
650
if strings .HasSuffix (k , ".pub" ) {
@@ -653,19 +653,19 @@ func (r *OCIRepositoryReconciler) verifySignature(ctx context.Context, obj *ociv
653
653
return soci .VerificationResultFailed , err
654
654
}
655
655
656
- signatures , _ , err := verifier .VerifyImageSignatures (ctxTimeout , ref )
657
- if err != nil {
656
+ result , err := verifier .Verify (ctxTimeout , ref )
657
+ if err != nil || result == soci . VerificationResultFailed {
658
658
continue
659
659
}
660
660
661
- if signatures != nil {
662
- signatureVerified = true
661
+ if result == soci . VerificationResultSuccess {
662
+ signatureVerified = result
663
663
break
664
664
}
665
665
}
666
666
}
667
667
668
- if ! signatureVerified {
668
+ if signatureVerified == soci . VerificationResultFailed {
669
669
return soci .VerificationResultFailed , fmt .Errorf ("no matching signatures were found for '%s'" , ref )
670
670
}
671
671
@@ -689,16 +689,16 @@ func (r *OCIRepositoryReconciler) verifySignature(ctx context.Context, obj *ociv
689
689
return soci .VerificationResultFailed , err
690
690
}
691
691
692
- signatures , _ , err := verifier .VerifyImageSignatures (ctxTimeout , ref )
692
+ result , err := verifier .Verify (ctxTimeout , ref )
693
693
if err != nil {
694
694
return soci .VerificationResultFailed , err
695
695
}
696
696
697
- if len ( signatures ) > 0 {
698
- return soci .VerificationResultSuccess , nil
697
+ if result == soci . VerificationResultFailed {
698
+ return soci .VerificationResultFailed , fmt . Errorf ( "no matching signatures were found for '%s'" , ref )
699
699
}
700
700
701
- return soci .VerificationResultFailed , fmt . Errorf ( "no matching signatures were found for '%s'" , ref )
701
+ return soci .VerificationResultSuccess , nil
702
702
703
703
case "notation" :
704
704
// get the public keys from the given secret
0 commit comments