Retrieve root certificate using signing certificate's AIA extension#18
Conversation
|
|
||
| private | ||
|
|
||
| def build_chain |
There was a problem hiding this comment.
Deserialize the current cert chain, and then iteratively:
- retrieve the leftmost certificate's parent via AIA coordinates
- deserialize the file into a Certificate instance
- prepend it into the chain
The looping stops once we see a cert having in AIA. Checking whether it's actually a CA will be done during chain verification.
| @@ -0,0 +1,25 @@ | |||
| module Gem::Sigstore::CertExtensions | |||
| def method_missing(method, *args, &block) | |||
There was a problem hiding this comment.
This is syntactic sugar that I'm trying out. We're exposing a certificate instance's extensions as attributes. If someone calls cert#some_unknown_extension, then NoMethodError will be raised as usual. We see an example of this in CertChain#retrieve_issuer_cert, above.
I'm on the fence about this, tbh. We could very well do with the #extension("extension name") method bellow, sticking to a more explicit pattern. If we do this, then there is no need to maintain our @extension_hash's keys in snake case.
b065550 to
a300898
Compare
Closes #15
The rekord's public key only contains the PEM for the signing certificate. In order to validate the full chain, we must retrieve the issuer's certificate as well, using the coordinates in the authorityInfoAccess extension.
I'm also moving much of the certificate deserialization & extension navigation out of the RekordEntry type.
Actuall cert chain validation will come in a future PR.