pub struct Cert { /* private fields */ }
Expand description

A raw resource certificate.

A value of this type represents a resource certificate. It can be one of three different variants.

A CA certificate appears in its own file in the repository. Its main use is to sign other certificates.

An EE certificate is used to sign other objects in the repository, such as manifests or ROAs and is included in the file of these objects. In RPKI, EE certificates are used only once. Whenever a new object is created, a new EE certificate is created, signed by its CA, used to sign the object, and then the private key is thrown away.

Finally, TA certificates are the installed trust anchors. These are self-signed.

If a certificate is stored in a file, you can use the decode function to parse the entire file. If the certificate is part of some other structure, the take_from and from_constructed functions can be used during parsing of that structure.

Once parsing succeeded, the three methods validate_ca, validate_ee, and validate_ta can be used to validate the certificate and turn it into a ResourceCert so it can be used for further processing. In addition, various methods exist to access information contained in the certificate.

Implementations

Decodes a source as a certificate.

Takes an encoded certificate from the beginning of a value.

This function assumes that the certificate is encoded in the next constructed value in cons tagged as a sequence.

Takes an optional certificate from the beginning of a value.

Parses the content of a Certificate sequence.

Returns a value encoder for a reference to the certificate.

Returns a captured encoding of the certificate.

Validation

When validating a certificate, two properties are checked: whether the certificate’s structure and content comply with the specification for resource certificates laid out in [RFC 6487] and whether the certificate has been correctly issued by its CA.

In some cases it is useful to perform these two steps separately. Therefore, methods are available both for each step and for doing both steps at once. Since we need to name these consistently, we devised the following convention:

The first step that validates compliance with the specification is called inspection. Methods are available to inspect different kinds of certificates. They all have the verb inspect in their name. Only the certificate itself is necessary to perform inspection.

The second step checking whether the certificate was correctly issued is called verification. Methods are available to verify different kinds of certificates. They all have the verb verify in their name and, in most cases, require access to the issuer certificate.

In addition, methods are available to perform both steps at once for different kinds of certificates. These all have validate in their name.

Validates the certificate as a trust anchor.

This validates that the certificate “is a current, self-signed RPKI CA certificate that conforms to the profile as specified in RFC6487” (RFC7730, section 3, step 2).

Validates the certificate as a CA certificate.

For validation to succeed, the certificate needs to have been signed by the provided issuer certificate.

Note that this does not check the CRL.

Validates the certificate as an EE RPKI-internal certificate.

For validation to succeed, the certificate needs to have been signed by the provided issuer certificate.

Note that this does not check the CRL.

Note further that this method should not be used for router certificates. Use validate_router for that.

Verifies that the certificate claims to have been issued by issuer.

This is only the first part of verification. You must call verified_signature, too.

Validates the certificate’s signature.

Methods from Deref<Target = TbsCert>

Returns the serial number of the certificate.

Returns a reference to the issuer.

Returns a reference to the validity.

Returns a reference to the subject.

Returns a reference to the public key.

Returns the cA field of the basic constraints extension if present.

Returns a reference to the subject key identifier.

There is no method to set this extension as this happens automatically when the subject public key is set via set_subject_public_key.

Returns a reference to the authority key identifier if present.

Returns the key usage of the certificate.

Returns a reference to the extended key usage if present.

Since this field isn’t allowed in any certificate used for RPKI objects directly, we do not currently support setting this field.

Returns a reference to the certificate’s CRL distribution point.

Returns a reference to caIssuer AIA rsync URI if present.

Returns a reference to the caRepository SIA rsync URI if present.

Returns a reference to the rpkiManifest SIA rsync URI if present.

Returns a reference to the signedObject SIA rsync URI if present.

Returns a reference to the rpkiNotify SIA HTTPS URI if present.

Returns the overclaim mode of the certificate.

Returns a reference to the IPv4 address resources if present.

Returns a reference to the IPv6 address resources if present.

Returns whether the certificate has any IP resources at all.

Returns a reference to the AS resources.

Returns whether this is a CA certificate if validation succeeds.

Returns whether this is a self-signed certificate if valid.

Returns an encoder for the value.

Trait Implementations

Performs the conversion.

Performs the conversion.

Performs the conversion.

Immutably borrows from an owned value. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.