pub struct AesKwp<C> { /* private fields */ }Expand description
AES Key Wrapper with Padding (KWP), as defined in RFC 5649.
Implementations§
Source§impl<C: BlockCipherEncrypt<BlockSize = U16>> AesKwp<C>
impl<C: BlockCipherEncrypt<BlockSize = U16>> AesKwp<C>
Sourcepub fn wrap_fixed_key<N>(
&self,
key: &Array<u8, N>,
) -> Array<u8, Prod<Add1<Quot<Sum<N, U7>, IvLen>>, IvLen>>
pub fn wrap_fixed_key<N>( &self, key: &Array<u8, N>, ) -> Array<u8, Prod<Add1<Quot<Sum<N, U7>, IvLen>>, IvLen>>
Wrap fixed-size key key and return wrapped key.
This method is roughly equivalent to:
ⓘ
pub fn wrap_fixed_key<const N: usize>(
&self,
key: &[u8; N],
) -> [u8; IV_LEN * (N.div_ceil(IV_LEN) + 1)]
{ ... }but uses hybrid_array::Array instead of built-in arrays
to work around current limitations of the const generics system.
Source§impl<C: BlockCipherDecrypt<BlockSize = U16>> AesKwp<C>
impl<C: BlockCipherDecrypt<BlockSize = U16>> AesKwp<C>
Sourcepub fn unwrap_key<'a>(
&self,
data: &[u8],
buf: &'a mut [u8],
) -> Result<&'a [u8], Error>
pub fn unwrap_key<'a>( &self, data: &[u8], buf: &'a mut [u8], ) -> Result<&'a [u8], Error>
AES Key Wrap with Padding, as defined in RFC 5649.
The buf buffer will be overwritten, and must be exactly IV_LEN
bytes (i.e. 8 bytes) shorter than the length of data.
This method returns a slice of out, truncated to the appropriate
length by removing the padding.
Sourcepub fn unwrap_fixed_key<N>(
&self,
wkey: &Array<u8, Prod<Add1<Quot<Sum<N, U7>, IvLen>>, IvLen>>,
) -> Result<Array<u8, N>, IntegrityCheckFailed>
pub fn unwrap_fixed_key<N>( &self, wkey: &Array<u8, Prod<Add1<Quot<Sum<N, U7>, IvLen>>, IvLen>>, ) -> Result<Array<u8, N>, IntegrityCheckFailed>
Unwrap fixed-size wrapped key wkey and return resulting key.
This method is roughly equivalent to:
ⓘ
pub fn unwrap_fixed_key<const N: usize>(
&self,
wkey: &[u8; IV_LEN * (N.div_ceil(IV_LEN) + 1)],
) -> [u8; N]
{ ... }but uses hybrid_array::Array instead of built-in arrays
to work around current limitations of the const generics system.
Trait Implementations§
impl<C: Copy> Copy for AesKwp<C>
Source§impl<C> InnerInit for AesKwp<C>
impl<C> InnerInit for AesKwp<C>
Source§fn inner_init(cipher: Self::Inner) -> Self
fn inner_init(cipher: Self::Inner) -> Self
Initialize value from the
inner.impl<C: PartialEq> StructuralPartialEq for AesKwp<C>
Auto Trait Implementations§
impl<C> Freeze for AesKwp<C>where
C: Freeze,
impl<C> RefUnwindSafe for AesKwp<C>where
C: RefUnwindSafe,
impl<C> Send for AesKwp<C>where
C: Send,
impl<C> Sync for AesKwp<C>where
C: Sync,
impl<C> Unpin for AesKwp<C>where
C: Unpin,
impl<C> UnsafeUnpin for AesKwp<C>where
C: UnsafeUnpin,
impl<C> UnwindSafe for AesKwp<C>where
C: UnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DynAssociatedOid for Twhere
T: AssociatedOid,
impl<T> DynAssociatedOid for Twhere
T: AssociatedOid,
Source§fn oid(&self) -> ObjectIdentifier
fn oid(&self) -> ObjectIdentifier
Get the OID associated with this value.
Source§impl<T> KeyInit for T
impl<T> KeyInit for T
Source§fn new(key: &Array<u8, <T as KeySizeUser>::KeySize>) -> T
fn new(key: &Array<u8, <T as KeySizeUser>::KeySize>) -> T
Create new value from fixed size key.
Source§fn new_from_slice(key: &[u8]) -> Result<T, InvalidLength>
fn new_from_slice(key: &[u8]) -> Result<T, InvalidLength>
Create new value from variable size key. Read more