Expand description
Implements envelope encryption manager.
Fields
kms_manager: Managerkms_key_id: Stringaad_tag: StringRepresents additional authenticated data (AAD) that attaches information to the ciphertext that is not encrypted.
Implementations
sourceimpl Envelope
impl Envelope
sourcepub async fn seal_aes_256(&self, d: &[u8]) -> Result<Vec<u8>>
pub async fn seal_aes_256(&self, d: &[u8]) -> Result<Vec<u8>>
Envelope-encrypts the data using AWS KMS data-encryption key (DEK) and “AES_256_GCM”, since kms:Encrypt can only encrypt 4 KiB). The encrypted data are aligned as below: [ Nonce bytes “length” ][ DEK.ciphertext “length” ][ Nonce bytes ][ DEK.ciphertext ][ data ciphertext ]
sourcepub async fn unseal_aes_256(&self, d: &[u8]) -> Result<Vec<u8>>
pub async fn unseal_aes_256(&self, d: &[u8]) -> Result<Vec<u8>>
Envelope-decrypts using KMS DEK and “AES_256_GCM”. Assume the input (ciphertext) data are packed in the order of: [ Nonce bytes “length” ][ DEK.ciphertext “length” ][ Nonce bytes ][ DEK.ciphertext ][ data ciphertext ]
sourcepub async fn seal_aes_256_file(
&self,
src_file: Arc<String>,
dst_file: Arc<String>
) -> Result<()>
pub async fn seal_aes_256_file(
&self,
src_file: Arc<String>,
dst_file: Arc<String>
) -> Result<()>
Envelope-encrypts data from a file and save the ciphertext to the other file.
“If a single piece of data must be accessible from more than one task concurrently, then it must be shared using synchronization primitives such as Arc.” ref. https://tokio.rs/tokio/tutorial/spawning
sourcepub async fn unseal_aes_256_file(
&self,
src_file: Arc<String>,
dst_file: Arc<String>
) -> Result<()>
pub async fn unseal_aes_256_file(
&self,
src_file: Arc<String>,
dst_file: Arc<String>
) -> Result<()>
Envelope-decrypts data from a file and save the plaintext to the other file.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Envelope
impl Send for Envelope
impl Sync for Envelope
impl Unpin for Envelope
impl !UnwindSafe for Envelope
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more