pub struct Aes256CbcHmacKey {
pub(crate) key: Pin<Box<Array<u8, U64>>>,
}Expand description
Aes256CbcHmacKey is a symmetric encryption key consisting of two 256-bit keys, one for encryption and one for MAC
Fields§
§key: Pin<Box<Array<u8, U64>>>The encryption and MAC keys, stored contiguously as enc_key || mac_key.
They are kept in one buffer rather than two so that the 64-byte composite form — the layout
used by the byte serialization, by the
Aes256CbcHmacSha256Aead
cipher, and by this key’s COSE key view — can be borrowed instead of copied. Use
Aes256CbcHmacKey::enc_key and Aes256CbcHmacKey::mac_key for zero-copy views of the
individual halves.
Uses a pinned heap data structure, as noted in Pinned heap data
Implementations§
Source§impl Aes256CbcHmacKey
impl Aes256CbcHmacKey
Sourcepub(crate) fn new(enc_key: &[u8; 32], mac_key: &[u8; 32]) -> Self
pub(crate) fn new(enc_key: &[u8; 32], mac_key: &[u8; 32]) -> Self
Builds a key from its two halves.
Sourcepub(crate) fn as_composite_key(&self) -> &[u8; 64]
pub(crate) fn as_composite_key(&self) -> &[u8; 64]
Returns the 64-byte composite key (enc_key || mac_key), which is the layout expected by
the Aes256CbcHmacSha256 and
Aes256CbcHmacSha256Aead
ciphers.
Sourcepub(crate) fn as_slice(&self) -> &[u8] ⓘ
pub(crate) fn as_slice(&self) -> &[u8] ⓘ
Returns the composite key as a slice. This is also this key’s legacy byte serialization.
Sourcepub(crate) fn enc_key(&self) -> &[u8; 32]
pub(crate) fn enc_key(&self) -> &[u8; 32]
Returns a zero-copy view of the 256-bit encryption key.
Sourcepub(crate) fn key_id(&self) -> KeyId
pub(crate) fn key_id(&self) -> KeyId
Returns the key ID of this key.
Unlike the other COSE key types, this key has no field to store a key ID in — it is
serialized as a bare 64-byte blob with no kid. The ID is therefore derived: it is the
key’s own RFC 9679 thumbprint truncated to
KEY_ID_SIZE bytes. Two keys with identical key material consequently share an ID, and a
key’s ID is stable across serialization round-trips.
Trait Implementations§
Source§impl Clone for Aes256CbcHmacKey
impl Clone for Aes256CbcHmacKey
Source§fn clone(&self) -> Aes256CbcHmacKey
fn clone(&self) -> Aes256CbcHmacKey
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ConstantTimeEq for Aes256CbcHmacKey
impl ConstantTimeEq for Aes256CbcHmacKey
Source§impl Debug for Aes256CbcHmacKey
impl Debug for Aes256CbcHmacKey
Source§impl Drop for Aes256CbcHmacKey
impl Drop for Aes256CbcHmacKey
Source§impl PartialEq for Aes256CbcHmacKey
impl PartialEq for Aes256CbcHmacKey
Auto Trait Implementations§
impl Freeze for Aes256CbcHmacKey
impl RefUnwindSafe for Aes256CbcHmacKey
impl Send for Aes256CbcHmacKey
impl Sync for Aes256CbcHmacKey
impl Unpin for Aes256CbcHmacKey
impl UnsafeUnpin for Aes256CbcHmacKey
impl UnwindSafe for Aes256CbcHmacKey
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more