summaryrefslogtreecommitdiff
path: root/src/kms
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2018-10-14 20:32:26 -0400
committerAaron Hill <aa1ronham@gmail.com>2018-10-17 21:21:04 -0400
commit56961b62187d55a62539a7443a289b373cbb5144 (patch)
treed994cda80134e614406564c348e4592f94fc8695 /src/kms
parent1f09d2797c4061e2f15146af061a24a71c1e10af (diff)
downloadroughenough-56961b62187d55a62539a7443a289b373cbb5144.zip
Run rustfmt
Diffstat (limited to 'src/kms')
-rw-r--r--src/kms/awskms.rs1
-rw-r--r--src/kms/envelope.rs9
-rw-r--r--src/kms/gcpkms.rs12
-rw-r--r--src/kms/mod.rs2
4 files changed, 15 insertions, 9 deletions
diff --git a/src/kms/awskms.rs b/src/kms/awskms.rs
index 96d4a38..14f0804 100644
--- a/src/kms/awskms.rs
+++ b/src/kms/awskms.rs
@@ -121,4 +121,3 @@ pub mod inner {
}
}
}
-
diff --git a/src/kms/envelope.rs b/src/kms/envelope.rs
index 1f6d615..da75961 100644
--- a/src/kms/envelope.rs
+++ b/src/kms/envelope.rs
@@ -73,7 +73,6 @@ fn vec_zero_filled(len: usize) -> Vec<u8> {
pub struct EnvelopeEncryption;
impl EnvelopeEncryption {
-
/// Decrypt a seed previously encrypted with `encrypt_seed()`
pub fn decrypt_seed(kms: &KmsProvider, ciphertext_blob: &[u8]) -> Result<Vec<u8>, KmsError> {
if ciphertext_blob.len() < MIN_PAYLOAD_SIZE {
@@ -107,7 +106,13 @@ impl EnvelopeEncryption {
// Decrypt the seed value using the DEK
let dek_open_key = OpeningKey::new(&AES_256_GCM, &dek)?;
- match open_in_place(&dek_open_key, &nonce, AD, IN_PREFIX_LEN, &mut encrypted_seed) {
+ match open_in_place(
+ &dek_open_key,
+ &nonce,
+ AD,
+ IN_PREFIX_LEN,
+ &mut encrypted_seed,
+ ) {
Ok(plaintext_seed) => Ok(plaintext_seed.to_vec()),
Err(_) => Err(KmsError::OperationFailed(
"failed to decrypt plaintext seed".to_string(),
diff --git a/src/kms/gcpkms.rs b/src/kms/gcpkms.rs
index c0fbb5d..13303db 100644
--- a/src/kms/gcpkms.rs
+++ b/src/kms/gcpkms.rs
@@ -19,14 +19,16 @@ extern crate log;
pub mod inner {
extern crate base64;
+ extern crate google_cloudkms1 as cloudkms1;
extern crate hyper;
extern crate hyper_rustls;
extern crate yup_oauth2 as oauth2;
- extern crate google_cloudkms1 as cloudkms1;
+
use std::fmt;
use std::env;
use std::fmt::Formatter;
+ use std::result::Result;
use std::str::FromStr;
use std::result::Result;
use std::default::Default;
@@ -34,13 +36,15 @@ pub mod inner {
use std::path::Path;
use std::time::Duration;
- use self::oauth2::{service_account_key_from_file, ServiceAccountAccess, ServiceAccountKey};
use self::cloudkms1::CloudKMS;
- use self::cloudkms1::{Result as CloudKmsResult, Error as CloudKmsError, EncryptRequest, DecryptRequest};
+ use self::cloudkms1::{
+ DecryptRequest, EncryptRequest, Error as CloudKmsError, Result as CloudKmsResult,
+ };
use self::hyper::net::HttpsConnector;
use self::hyper::header::Headers;
use self::hyper::status::StatusCode;
use self::hyper_rustls::TlsClient;
+ use self::oauth2::{service_account_key_from_file, ServiceAccountAccess, ServiceAccountKey};
use kms::{EncryptedDEK, KmsError, KmsProvider, PlaintextDEK};
@@ -156,5 +160,3 @@ pub mod inner {
panic!("Failed to load service account credential. Is GOOGLE_APPLICATION_CREDENTIALS set?");
}
}
-
-
diff --git a/src/kms/mod.rs b/src/kms/mod.rs
index 810623a..56e7631 100644
--- a/src/kms/mod.rs
+++ b/src/kms/mod.rs
@@ -52,9 +52,9 @@
mod envelope;
use base64;
+use ring;
use std;
use std::error::Error;
-use ring;
use config::ServerConfig;
use error;