| 186 | } |
| 187 | |
| 188 | func getBundleIssuer(b *bundle.Bundle) (string, error) { |
| 189 | if !b.MinVersion("0.2") { |
| 190 | return "", fmt.Errorf("unsupported bundle version: %s", b.MediaType) |
| 191 | } |
| 192 | verifyContent, err := b.VerificationContent() |
| 193 | if err != nil { |
| 194 | return "", fmt.Errorf("failed to get bundle verification content: %v", err) |
| 195 | } |
| 196 | leafCert := verifyContent.Certificate() |
| 197 | if leafCert == nil { |
| 198 | return "", fmt.Errorf("leaf cert not found") |
| 199 | } |
| 200 | if len(leafCert.Issuer.Organization) != 1 { |
| 201 | return "", fmt.Errorf("expected the leaf certificate issuer to only have one organization") |
| 202 | } |
| 203 | return leafCert.Issuer.Organization[0], nil |
| 204 | } |
| 205 | |
| 206 | func (v *LiveSigstoreVerifier) chooseVerifier(issuer string) (*verify.Verifier, error) { |
| 207 | // if no custom trusted root is set, return either the Public Good or GitHub verifier |