summaryrefslogtreecommitdiff
path: root/src/kms/mod.rs
diff options
context:
space:
mode:
authorStuart Stock <stuart@int08h.com>2019-01-19 14:21:35 -0600
committerStuart Stock <stuart@int08h.com>2019-01-19 15:12:37 -0600
commitdda66ba5b6ab2fbdee3b9fcd92741b1127f9c597 (patch)
treeb1206f0f45ddb7634b6b0c313d6f63929b98aaa7 /src/kms/mod.rs
parent88f029137b7f519dd842ff745434ffaef4c05f82 (diff)
downloadroughenough-dda66ba5b6ab2fbdee3b9fcd92741b1127f9c597.zip
Rust 2018 edition migration
Diffstat (limited to 'src/kms/mod.rs')
-rw-r--r--src/kms/mod.rs28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/kms/mod.rs b/src/kms/mod.rs
index cf1c49c..50cf4c3 100644
--- a/src/kms/mod.rs
+++ b/src/kms/mod.rs
@@ -59,9 +59,9 @@ use base64;
use ring;
use std;
-use config::ServerConfig;
-use error;
-use key::KmsProtection;
+use crate::config::ServerConfig;
+use crate::error;
+use crate::key::KmsProtection;
pub use self::envelope::EnvelopeEncryption;
@@ -129,7 +129,7 @@ pub trait KmsProvider {
mod awskms;
#[cfg(feature = "awskms")]
-pub use kms::awskms::inner::AwsKms;
+pub use crate::kms::awskms::inner::AwsKms;
/// Load the seed value for the long-term key.
///
@@ -145,7 +145,7 @@ pub use kms::awskms::inner::AwsKms;
///
#[cfg(feature = "awskms")]
pub fn load_seed(config: &Box<ServerConfig>) -> Result<Vec<u8>, error::Error> {
- use kms::envelope::EnvelopeEncryption;
+ use crate::kms::envelope::EnvelopeEncryption;
match config.kms_protection() {
KmsProtection::Plaintext => Ok(config.seed()),
@@ -165,7 +165,7 @@ pub fn load_seed(config: &Box<ServerConfig>) -> Result<Vec<u8>, error::Error> {
mod gcpkms;
#[cfg(feature = "gcpkms")]
-pub use kms::gcpkms::inner::GcpKms;
+pub use crate::kms::gcpkms::inner::GcpKms;
/// Load the seed value for the long-term key.
///
@@ -181,7 +181,7 @@ pub use kms::gcpkms::inner::GcpKms;
///
#[cfg(feature = "gcpkms")]
pub fn load_seed(config: &Box<ServerConfig>) -> Result<Vec<u8>, error::Error> {
- use kms::envelope::EnvelopeEncryption;
+ use crate::kms::envelope::EnvelopeEncryption;
match config.kms_protection() {
KmsProtection::Plaintext => Ok(config.seed()),
@@ -199,6 +199,15 @@ pub fn load_seed(config: &Box<ServerConfig>) -> Result<Vec<u8>, error::Error> {
/// Load the seed value for the long-term key.
///
+/// ## This build has KMS disabled
+///
+/// *The KMS feature is disabled in this build of Roughenough*.
+///
+/// The only supported `kms_protection` value in this build is `plaintext`. Any
+/// other value will cause a runtime error.
+///
+/// ## Background
+///
/// Loading behavior depends on the value of `config.kms_protection()`:
///
/// * If `config.kms_protection() == Plaintext` then the value returned from `config.seed()`
@@ -209,11 +218,6 @@ pub fn load_seed(config: &Box<ServerConfig>) -> Result<Vec<u8>, error::Error> {
/// is parsed as a KMS key id and `EnvelopeEncryption::decrypt_seed` is called to obtain
/// the plaintext seed value.
///
-/// ## KMS Disabled
-///
-/// The KMS feature is *disabled* in this build of Roughenough. The only
-/// supported `kms_protection` value is `plaintext`. Any other value is an error.
-///
#[cfg(not(any(feature = "awskms", feature = "gcpkms")))]
pub fn load_seed(config: &Box<ServerConfig>) -> Result<Vec<u8>, error::Error> {
match config.kms_protection() {