pub struct AtRestEncryptor { /* private fields */ }Expand description
Encryptor for data at rest.
Implementations§
Source§impl AtRestEncryptor
impl AtRestEncryptor
Sourcepub fn new(
algorithm: EncryptionAlgorithm,
key: Vec<u8>,
key_id: String,
) -> Result<Self>
pub fn new( algorithm: EncryptionAlgorithm, key: Vec<u8>, key_id: String, ) -> Result<Self>
Create a new encryptor with the given algorithm and key.
Sourcepub fn generate_key(algorithm: EncryptionAlgorithm) -> Vec<u8> ⓘ
pub fn generate_key(algorithm: EncryptionAlgorithm) -> Vec<u8> ⓘ
Generate a random key for the given algorithm.
Sourcepub fn encrypt(
&self,
plaintext: &[u8],
aad: Option<&[u8]>,
) -> Result<EncryptedData>
pub fn encrypt( &self, plaintext: &[u8], aad: Option<&[u8]>, ) -> Result<EncryptedData>
Encrypt data.
Sourcepub fn encrypt_in_place(
&self,
buffer: &mut Vec<u8>,
aad: Option<&[u8]>,
) -> Result<EncryptionMetadata>
pub fn encrypt_in_place( &self, buffer: &mut Vec<u8>, aad: Option<&[u8]>, ) -> Result<EncryptionMetadata>
Encrypt data in place (overwrites input buffer).
Sourcepub fn algorithm(&self) -> EncryptionAlgorithm
pub fn algorithm(&self) -> EncryptionAlgorithm
Get the algorithm used by this encryptor.
Auto Trait Implementations§
impl Freeze for AtRestEncryptor
impl RefUnwindSafe for AtRestEncryptor
impl Send for AtRestEncryptor
impl Sync for AtRestEncryptor
impl Unpin for AtRestEncryptor
impl UnsafeUnpin for AtRestEncryptor
impl UnwindSafe for AtRestEncryptor
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> 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>
Converts
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>
Converts
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