Skip to main content

stored_certificate

Function stored_certificate 

Source
fn stored_certificate(
    store: &CertStore,
    zone: &str,
    environment: Environment,
    provider: &CryptoProvider,
) -> Result<Option<(CertifiedKey, OffsetDateTime, CertMeta)>, BootstrapError>
Expand description

The certificate stored for zone if this run can serve it, with its expiry and metadata. None means order a new one.

A certificate is only as good as the directory that signed it: a staging leaf is served by exactly the same code as a production one and trusted by nobody, so the environment a run is configured for decides whether what is on disk can be served, not merely whether anything is there.

A set a crash left unusable is also None, so the next boot replaces it rather than refusing to start: a file missing, a meta.json that does not parse, or a certificate and key that do not load as a matching pair. CertStore::save_certificate renames its three files one at a time, so a crash between two renames leaves exactly such a set. Any other read error is still returned, since ordering again would not fix it.