pub struct EncryptedPii<T: PiiType> {
pub dek_id: DekId,
pub pii_code: u16,
pub aead_kind: AeadKind,
pub nonce: NonceBytes,
pub ciphertext: Bytes,
/* private fields */
}Expand description
Per-PII-marker ciphertext envelope.
The wire shape is
(dek_id, pii_code, aead_kind, nonce, ciphertext_with_tag) —
every input to the AEAD AAD is mirrored on the envelope so the
receiver can recompute the 19-byte AAD exactly. ciphertext
includes the 16-byte Poly1305 / GCM tag appended by the AEAD
primitive.
The generic parameter T is a phantom — the wire layout is purely
data-bearing, and a manual (de)serialize impl threads around the
PhantomData so postcard can round-trip the struct.
Fields§
§dek_id: DekIdHSM/KMS key reference.
pii_code: u16Wire tag. Validated against T::PII_CODE at
decrypt time.
aead_kind: AeadKindAEAD family used for the ciphertext.
nonce: NonceBytesNonce — length varies per AEAD kind.
ciphertext: BytesCiphertext with the 16-byte AEAD tag appended.
Implementations§
Source§impl<T: PiiType> EncryptedPii<T>
impl<T: PiiType> EncryptedPii<T>
Sourcepub fn new(
dek_id: DekId,
aead_kind: AeadKind,
nonce: NonceBytes,
ciphertext: Bytes,
) -> Self
pub fn new( dek_id: DekId, aead_kind: AeadKind, nonce: NonceBytes, ciphertext: Bytes, ) -> Self
Construct from components — intended for deserialization paths /
tests that need to reassemble a postcard-decoded envelope into
its typed form. Encryption path callers use
CryptoCoordinator::encrypt.
Trait Implementations§
Source§impl<T: PiiType> Clone for EncryptedPii<T>
impl<T: PiiType> Clone for EncryptedPii<T>
Source§impl<'de, T: PiiType> Deserialize<'de> for EncryptedPii<T>
impl<'de, T: PiiType> Deserialize<'de> for EncryptedPii<T>
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl<T: PartialEq + PiiType> PartialEq for EncryptedPii<T>
impl<T: PartialEq + PiiType> PartialEq for EncryptedPii<T>
Source§fn eq(&self, other: &EncryptedPii<T>) -> bool
fn eq(&self, other: &EncryptedPii<T>) -> bool
self and other values to be equal, and is used by ==.Source§impl<T: PiiType> Serialize for EncryptedPii<T>
impl<T: PiiType> Serialize for EncryptedPii<T>
impl<T: Eq + PiiType> Eq for EncryptedPii<T>
impl<T: PiiType> StructuralPartialEq for EncryptedPii<T>
Auto Trait Implementations§
impl<T> !Freeze for EncryptedPii<T>
impl<T> RefUnwindSafe for EncryptedPii<T>
impl<T> Send for EncryptedPii<T>
impl<T> Sync for EncryptedPii<T>
impl<T> Unpin for EncryptedPii<T>
impl<T> UnsafeUnpin for EncryptedPii<T>
impl<T> UnwindSafe for EncryptedPii<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.