summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Stock <stuart@int08h.com>2019-08-11 18:04:12 -0500
committerStuart Stock <stuart@int08h.com>2019-08-11 18:04:12 -0500
commit6ff01af5253d667818f47c86a32ecbacd4a1ac4f (patch)
tree7e97eb1014381f4e9cccf0586d7dde1ca1609d55
parentd8238bbfc6ca036907844298d4b7d1d36d81ec77 (diff)
downloadroughenough-6ff01af5253d667818f47c86a32ecbacd4a1ac4f.zip
Upgrade Rusoto 0.36 -> 0.40
-rw-r--r--Cargo.toml5
-rw-r--r--src/kms/awskms.rs12
2 files changed, 11 insertions, 6 deletions
diff --git a/Cargo.toml b/Cargo.toml
index f8cf272..070b26d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,6 +20,7 @@ gcpkms = ["google-cloudkms1", "hyper", "hyper-rustls", "serde", "serde_json", "y
[dependencies]
mio = "0.6"
mio-extras = "2.0"
+bytes = "0.4"
byteorder = "1"
ring = "0.13"
untrusted = "0.6"
@@ -37,8 +38,8 @@ humansize = "1.0"
rand = "0.6"
# Used by 'awskms'
-rusoto_core = { version = "0.36", optional = true }
-rusoto_kms = { version = "0.36", optional = true }
+rusoto_core = { version = "0.40", optional = true }
+rusoto_kms = { version = "0.40", optional = true }
# Used by 'gcpkms'
# google-cloudkms1 intentionally uses an old version of Hyper. See
diff --git a/src/kms/awskms.rs b/src/kms/awskms.rs
index 39986bc..aed1056 100644
--- a/src/kms/awskms.rs
+++ b/src/kms/awskms.rs
@@ -14,6 +14,8 @@
#[cfg(feature = "awskms")]
pub mod inner {
+ extern crate bytes;
+
use std::collections::HashMap;
use std::default::Default;
use std::error::Error;
@@ -23,6 +25,8 @@ pub mod inner {
use rusoto_core::Region;
use rusoto_kms::{DecryptRequest, EncryptRequest, Kms, KmsClient};
+ use self::bytes::Bytes;
+
use crate::kms::{EncryptedDEK, KmsError, KmsProvider, PlaintextDEK, AD, DEK_SIZE_BYTES};
/// Amazon Web Services Key Management Service
@@ -69,7 +73,7 @@ pub mod inner {
let mut encrypt_req: EncryptRequest = Default::default();
encrypt_req.key_id = self.key_id.clone();
- encrypt_req.plaintext = plaintext_dek.clone();
+ encrypt_req.plaintext = Bytes::from(plaintext_dek.as_slice());
let mut enc_context = HashMap::new();
enc_context.insert("AD".to_string(), AD.to_string());
@@ -78,7 +82,7 @@ pub mod inner {
match self.kms_client.encrypt(encrypt_req).sync() {
Ok(result) => {
if let Some(ciphertext) = result.ciphertext_blob {
- Ok(ciphertext)
+ Ok(ciphertext.to_vec())
} else {
Err(KmsError::OperationFailed(
"no ciphertext despite successful response".to_string(),
@@ -91,7 +95,7 @@ pub mod inner {
fn decrypt_dek(&self, encrypted_dek: &EncryptedDEK) -> Result<PlaintextDEK, KmsError> {
let mut decrypt_req: DecryptRequest = Default::default();
- decrypt_req.ciphertext_blob = encrypted_dek.clone();
+ decrypt_req.ciphertext_blob = Bytes::from(encrypted_dek.as_slice());
let mut dec_context = HashMap::new();
dec_context.insert("AD".to_string(), AD.to_string());
@@ -101,7 +105,7 @@ pub mod inner {
Ok(result) => {
if let Some(plaintext_dek) = result.plaintext {
if plaintext_dek.len() == DEK_SIZE_BYTES {
- Ok(plaintext_dek)
+ Ok(plaintext_dek.to_vec())
} else {
Err(KmsError::InvalidKey(format!(
"decrypted DEK wrong length: {}",