uselesskey-x509
X.509 certificate fixtures for testing — generates self-signed certificates and 3-level chains (root CA → intermediate CA → leaf), with deterministic derivation and negative fixture variants for TLS error-handling tests.
Part of the uselesskey workspace. Use
the facade crate for the simplest experience, or depend on this crate directly
for minimal compile time.
Usage
Self-Signed Certificate
use Factory;
use ;
let fx = random;
let cert = fx.x509_self_signed;
let cert_pem = cert.cert_pem;
let key_pem = cert.private_key_pkcs8_pem;
assert!;
assert!;
Certificate Chain (Root → Intermediate → Leaf)
use Factory;
use ;
let fx = random;
let chain = fx.x509_chain;
// Standard TLS server chain (leaf + intermediate, no root)
let chain_pem = chain.chain_pem;
// Individual components
let root_pem = chain.root_cert_pem;
let leaf_key = chain.leaf_private_key_pkcs8_pem;
Negative Fixtures
Generate intentionally invalid certificates for testing error-handling paths:
use Factory;
use ;
let fx = random;
let chain = fx.x509_chain;
// Expired leaf certificate
let expired = chain.expired_leaf;
// Hostname mismatch (SAN doesn't match expected hostname)
let wrong_host = chain.hostname_mismatch;
// Signed by an unknown CA (not in your trust store)
let unknown = chain.unknown_ca;
// Revoked leaf with CRL signed by the intermediate CA
let revoked = chain.revoked_leaf;
let crl_pem = revoked.crl_pem.expect;
Features
| Feature | Description |
|---|---|
jwk |
Pass-through for uselesskey-rsa/jwk compatibility |
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
See the uselesskey crate for full
documentation.