Skip to main content

webpki/
lib.rs

1//! webpki: Web PKI X.509 Certificate Validation.
2//!
3//! See `EndEntityCert`'s documentation for a description of the certificate
4//! processing steps necessary for a TLS connection.
5//!
6//! # Features
7//!
8//! | Feature | Description |
9//! | ------- | ----------- |
10//! | `alloc` | Enable features that require use of the heap. Currently all RSA signature algorithms require this feature. |
11//! | `std` | Enable features that require libstd. Implies `alloc`. |
12
13#![no_std]
14#![warn(
15    clippy::alloc_instead_of_core,
16    clippy::use_self,
17    clippy::std_instead_of_core
18)]
19#![deny(missing_docs, clippy::as_conversions)]
20// Enable documentation for all features on docs.rs
21#![cfg_attr(webpki_docsrs, feature(doc_cfg))]
22
23#[cfg(any(feature = "std", test))]
24extern crate std;
25
26#[cfg(any(test, feature = "alloc"))]
27#[cfg_attr(test, macro_use)]
28extern crate alloc;
29
30#[macro_use]
31mod der;
32
33#[cfg(test)]
34mod aws_lc_rs_algs;
35mod cert;
36mod end_entity;
37mod error;
38#[cfg(test)]
39mod ring_algs;
40mod rpk_entity;
41/// Processing of certificate transparency SCTs.
42pub mod sct;
43mod signed_data;
44mod subject_name;
45mod time;
46mod trust_anchor;
47
48mod crl;
49mod verify_cert;
50mod x509;
51
52#[cfg(test)]
53pub(crate) mod test_utils;
54
55pub use cert::Cert;
56pub use crl::{
57    BorrowedCertRevocationList, BorrowedRevokedCert, CertRevocationList, CrlsRequired,
58    ExpirationPolicy, RevocationCheckDepth, RevocationOptions, RevocationOptionsBuilder,
59    RevocationReason, UnknownStatusPolicy,
60};
61#[cfg(feature = "alloc")]
62pub use crl::{OwnedCertRevocationList, OwnedRevokedCert};
63pub use der::DerIterator;
64pub use end_entity::EndEntityCert;
65pub use error::{
66    DerTypeId, Error, InvalidNameContext, UnsupportedSignatureAlgorithmContext,
67    UnsupportedSignatureAlgorithmForPublicKeyContext,
68};
69pub use rpk_entity::RawPublicKeyEntity;
70pub use trust_anchor::anchor_from_trusted_cert;
71#[cfg(feature = "alloc")]
72pub use trust_anchor::spki_for_anchor;
73pub use verify_cert::{
74    ExtendedKeyUsage, ExtendedKeyUsageValidator, IntermediateIterator, KeyPurposeId,
75    KeyPurposeIdIter, PathBuilder, RequiredEkuNotFoundContext, VerifiedPath,
76};
77
78fn public_values_eq(a: untrusted::Input<'_>, b: untrusted::Input<'_>) -> bool {
79    a.as_slice_less_safe() == b.as_slice_less_safe()
80}