pub struct Encryptor { /* private fields */ }Expand description
AES-256-GCM key ring with one active encryption key and rotated decryption keys.
Implementations§
Source§impl Encryptor
impl Encryptor
pub fn new(active: EncryptionKey) -> Encryptor
pub fn with_decryption_key(self, key: EncryptionKey) -> Encryptor
Sourcepub fn seal(
&self,
plaintext: &[u8],
associated_data: &[u8],
) -> Result<Ciphertext, EncryptionError>
pub fn seal( &self, plaintext: &[u8], associated_data: &[u8], ) -> Result<Ciphertext, EncryptionError>
Encrypt and authenticate bytes, binding them to caller-supplied context.
§Errors
Returns an error when encryption fails.
Sourcepub fn open(
&self,
sealed: &Ciphertext,
associated_data: &[u8],
) -> Result<Vec<u8>, EncryptionError>
pub fn open( &self, sealed: &Ciphertext, associated_data: &[u8], ) -> Result<Vec<u8>, EncryptionError>
Decrypt after verifying the key ID, format, tag, and associated context.
§Errors
Returns an error for malformed or unauthenticated data.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Encryptor
impl RefUnwindSafe for Encryptor
impl Send for Encryptor
impl Sync for Encryptor
impl Unpin for Encryptor
impl UnsafeUnpin for Encryptor
impl UnwindSafe for Encryptor
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