pub struct KariRecipient {
pub issuer_der: Vec<u8>,
pub serial: Vec<u8>,
pub curve: KariCurve,
pub kdf: KariKdf,
pub recipient_pub_bytes: Vec<u8>,
pub ephemeral_scalar: Vec<u8>,
}Expand description
One KARI recipient slot the writer will emit. The recipient is
identified by their X.509 certificate (issuer + serial — KARI
RecipientEncryptedKey IAS form), and recipient_pub_bytes carries
their public key in the curve’s encoded form (SEC1 uncompressed for
P-256 / P-384 / P-521, raw 32-byte u-coordinate for X25519).
Fields§
§issuer_der: Vec<u8>Recipient certificate’s issuer DER (a SEQUENCE — same shape as
super::cms_build::RecipientIdRef::IssuerAndSerial::issuer_der).
serial: Vec<u8>Recipient cert’s serial number INTEGER body bytes.
curve: KariCurveCurve the recipient’s keypair lives on. Determines the ECDH primitive + ephemeral keypair shape the writer will emit.
kdf: KariKdfKDF binding the writer will encode in
KeyAgreeRecipientInfo.keyEncryptionAlgorithm. Defaults via the
per-curve constructors to super::kari::KariCurve::default_kdf:
RFC 5753 §7.1.4 X9.63 with the matching hash for NIST curves;
RFC 8418 §2.1 X9.63-SHA-256 for X25519. Use the
x25519_hkdf_* constructors to switch X25519 to the modern RFC
8418 §2.2 HKDF binding.
recipient_pub_bytes: Vec<u8>Recipient’s encoded public key. SEC1 uncompressed point for NIST curves; raw 32-byte u-coordinate for X25519.
ephemeral_scalar: Vec<u8>Ephemeral private scalar used for THIS recipient’s wrap. Each recipient gets its own ephemeral keypair so the writer can mix curves across recipients in a single envelope (one KARI per curve / ephemeral). Tests pin to a deterministic value; production callers should use a fresh random scalar per recipient.
Implementations§
Source§impl KariRecipient
impl KariRecipient
Sourcepub fn p256(
issuer_der: Vec<u8>,
serial: Vec<u8>,
recipient_pub_sec1: Vec<u8>,
ephemeral_scalar: Vec<u8>,
) -> Self
pub fn p256( issuer_der: Vec<u8>, serial: Vec<u8>, recipient_pub_sec1: Vec<u8>, ephemeral_scalar: Vec<u8>, ) -> Self
Build a P-256 recipient (X9.63-SHA-256 KDF per RFC 5753 §7.1.4).
Sourcepub fn p384(
issuer_der: Vec<u8>,
serial: Vec<u8>,
recipient_pub_sec1: Vec<u8>,
ephemeral_scalar: Vec<u8>,
) -> Self
pub fn p384( issuer_der: Vec<u8>, serial: Vec<u8>, recipient_pub_sec1: Vec<u8>, ephemeral_scalar: Vec<u8>, ) -> Self
Build a P-384 recipient (X9.63-SHA-384 KDF per RFC 5753 §7.1.4).
Sourcepub fn p521(
issuer_der: Vec<u8>,
serial: Vec<u8>,
recipient_pub_sec1: Vec<u8>,
ephemeral_scalar: Vec<u8>,
) -> Self
pub fn p521( issuer_der: Vec<u8>, serial: Vec<u8>, recipient_pub_sec1: Vec<u8>, ephemeral_scalar: Vec<u8>, ) -> Self
Round-16: build a P-521 recipient (X9.63-SHA-512 KDF per RFC
5753 §7.1.4 — dhSinglePass-stdDH-sha512kdf-scheme,
OID 1.3.132.1.11.3).
Sourcepub fn x25519(
issuer_der: Vec<u8>,
serial: Vec<u8>,
recipient_pub_x25519: Vec<u8>,
ephemeral_scalar: Vec<u8>,
) -> Self
pub fn x25519( issuer_der: Vec<u8>, serial: Vec<u8>, recipient_pub_x25519: Vec<u8>, ephemeral_scalar: Vec<u8>, ) -> Self
Build an X25519 recipient with the legacy X9.63-SHA-256 KDF binding (RFC 8418 §2.1).
Sourcepub fn x25519_hkdf_sha256(
issuer_der: Vec<u8>,
serial: Vec<u8>,
recipient_pub_x25519: Vec<u8>,
ephemeral_scalar: Vec<u8>,
) -> Self
pub fn x25519_hkdf_sha256( issuer_der: Vec<u8>, serial: Vec<u8>, recipient_pub_x25519: Vec<u8>, ephemeral_scalar: Vec<u8>, ) -> Self
Round-16: build an X25519 recipient with the modern HKDF-SHA-256
KDF binding (RFC 8418 §2.2 — dhSinglePass-stdDH-hkdf-sha256-scheme,
smime-alg 19).
Sourcepub fn x25519_hkdf_sha384(
issuer_der: Vec<u8>,
serial: Vec<u8>,
recipient_pub_x25519: Vec<u8>,
ephemeral_scalar: Vec<u8>,
) -> Self
pub fn x25519_hkdf_sha384( issuer_der: Vec<u8>, serial: Vec<u8>, recipient_pub_x25519: Vec<u8>, ephemeral_scalar: Vec<u8>, ) -> Self
Round-16: build an X25519 recipient with HKDF-SHA-384 (RFC 8418
§2.2 — dhSinglePass-stdDH-hkdf-sha384-scheme, smime-alg 20).
Sourcepub fn x25519_hkdf_sha512(
issuer_der: Vec<u8>,
serial: Vec<u8>,
recipient_pub_x25519: Vec<u8>,
ephemeral_scalar: Vec<u8>,
) -> Self
pub fn x25519_hkdf_sha512( issuer_der: Vec<u8>, serial: Vec<u8>, recipient_pub_x25519: Vec<u8>, ephemeral_scalar: Vec<u8>, ) -> Self
Round-16: build an X25519 recipient with HKDF-SHA-512 (RFC 8418
§2.2 — dhSinglePass-stdDH-hkdf-sha512-scheme, smime-alg 21).
Sourcepub fn x448(
issuer_der: Vec<u8>,
serial: Vec<u8>,
recipient_pub_x448: Vec<u8>,
ephemeral_scalar: Vec<u8>,
) -> Self
pub fn x448( issuer_der: Vec<u8>, serial: Vec<u8>, recipient_pub_x448: Vec<u8>, ephemeral_scalar: Vec<u8>, ) -> Self
Round-24: build an X448 recipient with the default X9.63-SHA-512
KDF binding (RFC 8418 §2.1 — dhSinglePass-stdDH-sha512kdf-scheme).
recipient_pub_x448 is the recipient’s 56-byte raw u-coordinate;
ephemeral_scalar is the 56-byte ephemeral private key (RFC 7748
§5 clamping is applied by the underlying x448 crate at scalar
load).
Sourcepub fn x448_hkdf_sha256(
issuer_der: Vec<u8>,
serial: Vec<u8>,
recipient_pub_x448: Vec<u8>,
ephemeral_scalar: Vec<u8>,
) -> Self
pub fn x448_hkdf_sha256( issuer_der: Vec<u8>, serial: Vec<u8>, recipient_pub_x448: Vec<u8>, ephemeral_scalar: Vec<u8>, ) -> Self
Round-24: build an X448 recipient with the modern HKDF-SHA-256
KDF binding (RFC 8418 §2.2 — dhSinglePass-stdDH-hkdf-sha256-scheme,
smime-alg 19). Same shape as Self::x448 but with the HKDF
flavour swapped in.
Sourcepub fn x448_hkdf_sha384(
issuer_der: Vec<u8>,
serial: Vec<u8>,
recipient_pub_x448: Vec<u8>,
ephemeral_scalar: Vec<u8>,
) -> Self
pub fn x448_hkdf_sha384( issuer_der: Vec<u8>, serial: Vec<u8>, recipient_pub_x448: Vec<u8>, ephemeral_scalar: Vec<u8>, ) -> Self
Round-24: build an X448 recipient with HKDF-SHA-384 (RFC 8418
§2.2 — dhSinglePass-stdDH-hkdf-sha384-scheme, smime-alg 20).
Sourcepub fn x448_hkdf_sha512(
issuer_der: Vec<u8>,
serial: Vec<u8>,
recipient_pub_x448: Vec<u8>,
ephemeral_scalar: Vec<u8>,
) -> Self
pub fn x448_hkdf_sha512( issuer_der: Vec<u8>, serial: Vec<u8>, recipient_pub_x448: Vec<u8>, ephemeral_scalar: Vec<u8>, ) -> Self
Round-24: build an X448 recipient with HKDF-SHA-512 (RFC 8418
§2.2 — dhSinglePass-stdDH-hkdf-sha512-scheme, smime-alg 21 —
the security-strength match for X448’s 224-bit level under HKDF).
Trait Implementations§
Source§impl Clone for KariRecipient
impl Clone for KariRecipient
Source§fn clone(&self) -> KariRecipient
fn clone(&self) -> KariRecipient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more