pub struct AesKey<T: AesType>(/* private fields */);Available on crate feature
aes only.Expand description
An AES symmetric encryption key
Trait Implementations§
Source§impl<'de, T: AesType> Deserialize<'de> for AesKey<T>
impl<'de, T: AesType> Deserialize<'de> for AesKey<T>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T: AesType> FromKeyDerivation for AesKey<T>
impl<T: AesType> FromKeyDerivation for AesKey<T>
Source§fn from_key_derivation<D: KeyDerivation>(derive: D) -> Result<Self, Error>where
Self: Sized,
fn from_key_derivation<D: KeyDerivation>(derive: D) -> Result<Self, Error>where
Self: Sized,
Create a new instance of a key from a key derivation
Source§impl<Lhs, Rhs, T> FromKeyExchange<Lhs, Rhs> for AesKey<T>
impl<Lhs, Rhs, T> FromKeyExchange<Lhs, Rhs> for AesKey<T>
Source§impl<T: AesType> HasKeyBackend for AesKey<T>
impl<T: AesType> HasKeyBackend for AesKey<T>
Source§fn key_backend(&self) -> KeyBackend
fn key_backend(&self) -> KeyBackend
Get the corresponding key backend.
Source§impl<C, D> KeyAeadInPlace for AesKey<AesCbcHmac<C, D>>where
AesCbcHmac<C, D>: AesType,
C: BlockCipher + KeyInit + BlockEncryptMut + BlockDecryptMut,
D: Digest + BlockSizeUser,
C::KeySize: Shl<B1>,
<C::KeySize as Shl<B1>>::Output: ArrayLength<u8>,
impl<C, D> KeyAeadInPlace for AesKey<AesCbcHmac<C, D>>where
AesCbcHmac<C, D>: AesType,
C: BlockCipher + KeyInit + BlockEncryptMut + BlockDecryptMut,
D: Digest + BlockSizeUser,
C::KeySize: Shl<B1>,
<C::KeySize as Shl<B1>>::Output: ArrayLength<u8>,
Source§fn encrypt_in_place(
&self,
buffer: &mut dyn ResizeBuffer,
nonce: &[u8],
aad: &[u8],
) -> Result<usize, Error>
fn encrypt_in_place( &self, buffer: &mut dyn ResizeBuffer, nonce: &[u8], aad: &[u8], ) -> Result<usize, Error>
Encrypt a secret value in place, appending the verification tag and
returning the length of the ciphertext
Source§fn decrypt_in_place(
&self,
buffer: &mut dyn ResizeBuffer,
nonce: &[u8],
aad: &[u8],
) -> Result<(), Error>
fn decrypt_in_place( &self, buffer: &mut dyn ResizeBuffer, nonce: &[u8], aad: &[u8], ) -> Result<(), Error>
Decrypt an encrypted (verification tag appended) value in place
Source§fn aead_params(&self) -> KeyAeadParams
fn aead_params(&self) -> KeyAeadParams
Get the nonce and tag length for encryption
Source§fn aead_padding(&self, msg_len: usize) -> usize
fn aead_padding(&self, msg_len: usize) -> usize
Get the ciphertext padding required
Source§impl<C> KeyAeadInPlace for AesKey<AesKeyWrap<C>>where
AesKeyWrap<C>: AesType,
C: KeyInit + KeySizeUser<KeySize = <AesKeyWrap<C> as AesType>::KeySize> + BlockCipher<BlockSize = U16> + BlockDecrypt + BlockEncrypt,
impl<C> KeyAeadInPlace for AesKey<AesKeyWrap<C>>where
AesKeyWrap<C>: AesType,
C: KeyInit + KeySizeUser<KeySize = <AesKeyWrap<C> as AesType>::KeySize> + BlockCipher<BlockSize = U16> + BlockDecrypt + BlockEncrypt,
Source§fn encrypt_in_place(
&self,
buffer: &mut dyn ResizeBuffer,
nonce: &[u8],
aad: &[u8],
) -> Result<usize, Error>
fn encrypt_in_place( &self, buffer: &mut dyn ResizeBuffer, nonce: &[u8], aad: &[u8], ) -> Result<usize, Error>
Encrypt a secret value in place, appending the verification tag and
returning the length of the ciphertext
Source§fn decrypt_in_place(
&self,
buffer: &mut dyn ResizeBuffer,
nonce: &[u8],
aad: &[u8],
) -> Result<(), Error>
fn decrypt_in_place( &self, buffer: &mut dyn ResizeBuffer, nonce: &[u8], aad: &[u8], ) -> Result<(), Error>
Decrypt an encrypted (verification tag appended) value in place
Source§fn aead_params(&self) -> KeyAeadParams
fn aead_params(&self) -> KeyAeadParams
Get the nonce and tag length for encryption
Source§fn aead_padding(&self, _msg_len: usize) -> usize
fn aead_padding(&self, _msg_len: usize) -> usize
Get the ciphertext padding required
Source§impl<T> KeyAeadInPlace for AesKey<T>
impl<T> KeyAeadInPlace for AesKey<T>
Source§fn encrypt_in_place(
&self,
buffer: &mut dyn ResizeBuffer,
nonce: &[u8],
aad: &[u8],
) -> Result<usize, Error>
fn encrypt_in_place( &self, buffer: &mut dyn ResizeBuffer, nonce: &[u8], aad: &[u8], ) -> Result<usize, Error>
Encrypt a secret value in place, appending the verification tag
Source§fn decrypt_in_place(
&self,
buffer: &mut dyn ResizeBuffer,
nonce: &[u8],
aad: &[u8],
) -> Result<(), Error>
fn decrypt_in_place( &self, buffer: &mut dyn ResizeBuffer, nonce: &[u8], aad: &[u8], ) -> Result<(), Error>
Decrypt an encrypted (verification tag appended) value in place
Source§fn aead_params(&self) -> KeyAeadParams
fn aead_params(&self) -> KeyAeadParams
Get the nonce and tag length for encryption
Source§fn aead_padding(&self, _msg_len: usize) -> usize
fn aead_padding(&self, _msg_len: usize) -> usize
Get the ciphertext padding required
Source§impl<C, D> KeyAeadMeta for AesKey<AesCbcHmac<C, D>>
impl<C, D> KeyAeadMeta for AesKey<AesCbcHmac<C, D>>
Source§type NonceSize = <C as BlockSizeUser>::BlockSize
type NonceSize = <C as BlockSizeUser>::BlockSize
The size of the AEAD nonce
Source§type TagSize = <C as KeySizeUser>::KeySize
type TagSize = <C as KeySizeUser>::KeySize
The size of the AEAD tag
Source§fn random_nonce() -> GenericArray<u8, Self::NonceSize>
fn random_nonce() -> GenericArray<u8, Self::NonceSize>
Available on crate feature
getrandom only.Generate a new random nonce
Source§impl<C> KeyAeadMeta for AesKey<AesKeyWrap<C>>where
AesKeyWrap<C>: AesType,
impl<C> KeyAeadMeta for AesKey<AesKeyWrap<C>>where
AesKeyWrap<C>: AesType,
Source§impl<T: AesType> KeySecretBytes for AesKey<T>
impl<T: AesType> KeySecretBytes for AesKey<T>
Source§impl<T: AesType> ToJwk for AesKey<T>
impl<T: AesType> ToJwk for AesKey<T>
Source§fn encode_jwk(&self, enc: &mut dyn JwkEncoder) -> Result<(), Error>
fn encode_jwk(&self, enc: &mut dyn JwkEncoder) -> Result<(), Error>
Write the JWK representation to an encoder
Source§fn to_jwk_thumbprint(&self, alg: Option<KeyAlg>) -> Result<String, Error>
fn to_jwk_thumbprint(&self, alg: Option<KeyAlg>) -> Result<String, Error>
Available on crate feature
alloc only.Create the JWK thumbprint of the key
Source§fn to_jwk_public(&self, alg: Option<KeyAlg>) -> Result<String, Error>
fn to_jwk_public(&self, alg: Option<KeyAlg>) -> Result<String, Error>
Available on crate feature
alloc only.Create a JWK of the public key
Source§fn to_jwk_secret(&self, alg: Option<KeyAlg>) -> Result<SecretBytes, Error>
fn to_jwk_secret(&self, alg: Option<KeyAlg>) -> Result<SecretBytes, Error>
Available on crate feature
alloc only.Create a JWK of the secret key
impl<T: AesType> Eq for AesKey<T>
Auto Trait Implementations§
impl<T> Freeze for AesKey<T>
impl<T> RefUnwindSafe for AesKey<T>
impl<T> Send for AesKey<T>
impl<T> Sync for AesKey<T>
impl<T> !Unpin for AesKey<T>
impl<T> UnwindSafe for AesKey<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
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<K> ToSecretBytes for Kwhere
K: KeySecretBytes,
impl<K> ToSecretBytes for Kwhere
K: KeySecretBytes,
Source§fn write_secret_bytes(&self, out: &mut dyn WriteBuffer) -> Result<(), Error>
fn write_secret_bytes(&self, out: &mut dyn WriteBuffer) -> Result<(), Error>
Write the key secret bytes to a buffer.
Source§fn to_secret_bytes(&self) -> Result<SecretBytes, Error>
fn to_secret_bytes(&self) -> Result<SecretBytes, Error>
Available on crate feature
alloc only.Write the key secret bytes to a new allocated buffer.