The seal's certificates and keys: a self-signed X.509 certificate for an Ed25519 or SLH-DSA key, what the seal reads from one, and their PEM form.
A private key's PEM is PKCS #8 (PRIVATE KEY): for Ed25519 the private key
is wrapped as RFC 8410 7 says (an OCTET STRING holding the 32-byte key),
for SLH-DSA it is the raw key in the OCTET STRING (RFC 9909 6). The
certificate's subject public key and signature carry the same algorithm's
OID, with parameters absent.
Summary
Functions
A certificate's PEM.
The {cert_der, private_key} pair a certificate PEM and a PKCS #8 key PEM
hold, as Countersign.Seal.seal/3 takes it, checked to be of the same
algorithm: {:error, :bad_certificate | :bad_key | :alg_mismatch}
otherwise. Whether the key matches the certificate is seal/3's check.
A private key's PKCS #8 PEM.
What the seal needs from a certificate, or :error for one it cannot read.
A self-signed certificate for a fresh key of alg, valid for years from
now: {cert_der, private_key}. subject is the common name; :org adds
an organization.
Types
Functions
A certificate's PEM.
@spec from_pem(String.t(), String.t()) :: {:ok, {Countersign.Seal.alg(), {binary(), binary()}}} | {:error, :bad_certificate | :bad_key | :alg_mismatch}
The {cert_der, private_key} pair a certificate PEM and a PKCS #8 key PEM
hold, as Countersign.Seal.seal/3 takes it, checked to be of the same
algorithm: {:error, :bad_certificate | :bad_key | :alg_mismatch}
otherwise. Whether the key matches the certificate is seal/3's check.
@spec key_pem(Countersign.Seal.alg(), binary()) :: String.t()
A private key's PKCS #8 PEM.
What the seal needs from a certificate, or :error for one it cannot read.
@spec self_signed(Countersign.Seal.alg(), String.t(), keyword()) :: {binary(), binary()}
A self-signed certificate for a fresh key of alg, valid for years from
now: {cert_der, private_key}. subject is the common name; :org adds
an organization.