pub struct IdentityBuilder { /* private fields */ }Expand description
Generates a self-signed ECDSA P-256 identity without writing it: Identity::builder, the
validity, then generate.
With nothing set the certificate is valid for rcgen’s default period (decades), as
Identity::generate makes it. Every generated certificate has the common name
coqui-peer, a DNS subjectAltName SERVER_NAME, a
subjectKeyIdentifier and basicConstraints CA:FALSE. Peers pin it by fingerprint, so the
name is not checked. Times are whole seconds: both are truncated.
The end of the validity is one setting: not_after and
valid_for each set it, and the last one called wins.
For WebTransport’s serverCertificateHashes, which accepts only a certificate whose whole
validity period is at most 14 days, use valid_for(Duration::from_secs(14 * 86_400)) at most
and replace the identity before it expires; a peer whose clock runs behind sees it as not yet
valid, so an earlier not_before, within the same 14 days, covers that.
The key algorithm is key_algorithm; the default is ECDSA P-256.
Implementations§
Source§impl IdentityBuilder
impl IdentityBuilder
Sourcepub fn not_before(self, at: SystemTime) -> Self
pub fn not_before(self, at: SystemTime) -> Self
The first instant the certificate is valid. Default rcgen’s.
Sourcepub fn not_after(self, at: SystemTime) -> Self
pub fn not_after(self, at: SystemTime) -> Self
The last instant the certificate is valid. Replaces valid_for.
Sourcepub fn valid_for(self, validity: Duration) -> Self
pub fn valid_for(self, validity: Duration) -> Self
How long the certificate is valid from not_before, from now when that is not set.
Replaces not_after.
Sourcepub fn key_algorithm(self, algorithm: KeyAlgorithm) -> Self
pub fn key_algorithm(self, algorithm: KeyAlgorithm) -> Self
The key algorithm. Default KeyAlgorithm::P256.