Repository navigation
Conversation
1ef80bb to
8599c13
Compare
This factors out the core of `verifyStandalone` from `mtcb_test.go` into an exported function `verifymtc.Standalone`, and calls it from MTCB. Move body of MTCAID() helper to `issuancelog` so we don't need an `*issuance.Certificate` to access it. Add helper issuancelog.ID.CACosignerName(). Add real signatures to MTCB tests so they can pass the new check. Code written by me; tests written by LLM (with extensive hacking to make them more readable / sensible).
| if !bytes.Equal(cert.RawIssuer, issuer.RawSubject) { | ||
| return fmt.Errorf("end-entity issuer %q does not match issuer's subject %q", | ||
| cert.Issuer, issuer.Subject) | ||
| } | ||
|
|
||
| mtcaID, err := issuancelog.MTCAID(issuer) | ||
| if err != nil { | ||
| return err | ||
| } |
There was a problem hiding this comment.
For the sake of future-proofing this code to support multiple issuers, it seems like these should be in the opposite order: first extract the issuer's MTCAID from the cert being verified, then confirm that this value actually matches the issuer we want to verify with (or use it to look up the issuer from a map).
I think we're going to need both SubjectMTCAID(caCert) and issuerMTCAID(subjectCert), just like we have issuance.SubjectNameID and issuance.IssuerNameID today.
|
|
||
| // MTCAID returns the trust anchor ID from this issuer certificate's Subject. It | ||
| // returns an error for issuers that are not MTC CAs. | ||
| func MTCAID(caCert *x509.Certificate) (*reloid.RelativeOID, error) { |
There was a problem hiding this comment.
It's not obvious to me that this package is the right place for this code to live. It's not about the identity of a log, it's about the identity of an issuer. And (as noted in my other comment below) we're going to need two versions of this function: to extract the MTCAID from the Subject field of a CA, and to extract it from the Issuer field of an end-entity cert.
Maybe it belongs in Core along-side Encode/DecodeMTCSerial?
|
|
||
| for _, sig := range mtcProof.Signatures { | ||
| // Ignore all signatures except the one for the CA we are verifying against. | ||
| // TODO: also check mirror signatures for mirrors we recognize. |
This factors out the core of
verifyStandalonefrommtcb_test.gointo an exported functionverifymtc.Standalone, and calls it from MTCB.Move body of MTCAID() helper to
issuancelogso we don't need an*issuance.Certificateto access it.Add helper issuancelog.ID.CACosignerName().
Add real signatures to MTCB tests so they can pass the new check.
Code written by me; tests written by LLM (with extensive hacking to make them more readable / sensible).
Part of #9085.
Note: the tests sign
cosigned.Messagedirectly rather than use a helper. That's intentional since the helper is landing in a different change stack.