pub struct Manager { /* private fields */ }
Expand description
Implements AWS KMS manager.
Implementations§
Source§impl Manager
impl Manager
pub fn new(shared_config: &AwsSdkConfig) -> Self
Sourcepub async fn create_key(&self, key_desc: &str) -> Result<Key>
pub async fn create_key(&self, key_desc: &str) -> Result<Key>
Creates an AWS KMS CMK.
Sourcepub async fn schedule_to_delete(&self, key_id: &str) -> Result<()>
pub async fn schedule_to_delete(&self, key_id: &str) -> Result<()>
Schedules to delete a KMS CMK.
Sourcepub async fn encrypt(
&self,
key_id: &str,
spec: Option<EncryptionAlgorithmSpec>,
plaintext: Vec<u8>,
) -> Result<Vec<u8>>
pub async fn encrypt( &self, key_id: &str, spec: Option<EncryptionAlgorithmSpec>, plaintext: Vec<u8>, ) -> Result<Vec<u8>>
Encrypts data. The maximum size of the data KMS can encrypt is 4096 bytes for “SYMMETRIC_DEFAULT” encryption algorithm. To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. ref. https://docs.aws.amazon.com/kms/latest/APIReference/API_Encrypt.html
Sourcepub async fn decrypt(
&self,
key_id: &str,
spec: Option<EncryptionAlgorithmSpec>,
ciphertext: Vec<u8>,
) -> Result<Vec<u8>>
pub async fn decrypt( &self, key_id: &str, spec: Option<EncryptionAlgorithmSpec>, ciphertext: Vec<u8>, ) -> Result<Vec<u8>>
Decrypts data. The maximum length of “ciphertext” is 6144 bytes. ref. https://docs.aws.amazon.com/kms/latest/APIReference/API_Decrypt.html
Sourcepub async fn encrypt_file(
&self,
key_id: &str,
spec: Option<EncryptionAlgorithmSpec>,
src_file: &str,
dst_file: &str,
) -> Result<()>
pub async fn encrypt_file( &self, key_id: &str, spec: Option<EncryptionAlgorithmSpec>, src_file: &str, dst_file: &str, ) -> Result<()>
Encrypts data from a file and save the ciphertext to the other file.
Sourcepub async fn decrypt_file(
&self,
key_id: &str,
spec: Option<EncryptionAlgorithmSpec>,
src_file: &str,
dst_file: &str,
) -> Result<()>
pub async fn decrypt_file( &self, key_id: &str, spec: Option<EncryptionAlgorithmSpec>, src_file: &str, dst_file: &str, ) -> Result<()>
Decrypts data from a file and save the plaintext to the other file.
Sourcepub async fn generate_data_key(
&self,
key_id: &str,
spec: Option<DataKeySpec>,
) -> Result<DEK>
pub async fn generate_data_key( &self, key_id: &str, spec: Option<DataKeySpec>, ) -> Result<DEK>
Generates a data-encryption key. The default key spec is AES_256 generate a 256-bit symmetric key. ref. https://docs.aws.amazon.com/kms/latest/APIReference/API_GenerateDataKey.html
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Manager
impl !RefUnwindSafe for Manager
impl Send for Manager
impl Sync for Manager
impl Unpin for Manager
impl !UnwindSafe for Manager
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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