JFLib

netpkt/x509.rs#

Source: lib/netpkt/x509.rs

x509 -- netpkt's view of JFLib's certificates: the crate jflib-x509, which netio uses as well
(one parser, one path validation), and what is wrong with a chain as fault bits for the
dialogs of simulators and packet tools

  Cert, CertBuilder, IpAddr, verify_chain ...   the crate x509, re-exported
  CertSpec                                      CertBuilder under netpkt's earlier name
  check_chain(&[leaf, ...], anchors, host, now) -> faults   what is wrong with it: F_* bits, 0
                                                for nothing (a browser's list, where
                                                verify_chain gives the first reason)

Re-exports: x509::*

  • type CertSpec = x509::CertBuilder the builder of a certificate (netpkt's earlier name of x509::CertBuilder)
/// the time of a certificate has passed
F_EXPIRED: u32 = 1 << 0
/// its time has not come yet
F_NOT_YET: u32 = 1 << 1
/// the name asked for is not among its names
F_NAME: u32 = 1 << 2
/// signed by itself, and not an anchor
F_SELF_SIGNED: u32 = 1 << 3
/// no path to an anchor
F_UNKNOWN_ISSUER: u32 = 1 << 4
/// a signature that does not check out, or a key this code cannot read
F_BAD_SIGNATURE: u32 = 1 << 5
  • fn check_chain(chain: &[Cert], anchors: &[Cert], host: &str, now: i64) -> u32 what is wrong with a chain (leaf first) for this host at this time: F_* bits, 0 for nothing. For a private Ed25519 PKI: a leaf with another kind of key counts as F_BAD_SIGNATURE

Source: docs/API.md in the JFLib repository.