moonshot 1.1.0.beta2 → 1.1.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87a9ec0c99ce38df80d130a365c6c1dc660d5b86
|
4
|
+
data.tar.gz: 2741587ad46b254631dee2819b85a2165c14221f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 902fc172728fe21adf3dac9bc21ad20a5d861d0a8dee5a3951d9cf88349ea3c99f7fc1dab8504ad2792aea9e243311fa218079c6335a794f374c09e07cc04a5b
|
7
|
+
data.tar.gz: 8df16b96b4dd1e2353fab4bf39b40204a4eef32d1ff81846611a768c0e44c118753282334f98b51ff861df1bb0b6b82298be8379d5d0b5dc1015bed52f0cedf8
|
@@ -1,22 +1,24 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module Moonshot
|
2
|
+
class EncryptedParameters
|
3
|
+
# Class that manages KMS keys in AWS.
|
4
|
+
class KmsKey
|
5
|
+
attr_reader :arn
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
def initialize(arn)
|
8
|
+
@arn = arn
|
9
|
+
@kms_client = Aws::KMS::Client.new
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
def self.create
|
13
|
+
resp = Aws::KMS::Client.new.create_key
|
14
|
+
arn = resp.key_metadata.arn
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
new(arn)
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
def delete
|
20
|
+
@kms_client.schedule_key_deletion(key_id: @arn, pending_window_in_days: 7)
|
21
|
+
end
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -1,23 +1,24 @@
|
|
1
1
|
require 'base64'
|
2
|
+
module Moonshot
|
3
|
+
class EncryptedParameters
|
4
|
+
# Class that can encrypt and decrypt parameters using KMS.
|
5
|
+
class ParameterEncrypter
|
6
|
+
# @param [String] key_arn The ARN for the KMS key.
|
7
|
+
def initialize(key_arn)
|
8
|
+
@kms_client = Aws::KMS::Client.new
|
9
|
+
@key_arn = key_arn
|
10
|
+
end
|
2
11
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
@key_arn = key_arn
|
10
|
-
end
|
11
|
-
|
12
|
-
# Encrypt and base64 encode the parameter value.
|
13
|
-
#
|
14
|
-
# @param [String] param_value The parameter to encrypt.
|
15
|
-
# @return [String] base64 encoded encrypted ciphertext.
|
16
|
-
def encrypt(param_value)
|
17
|
-
resp = @kms_client.encrypt(key_id: @key_arn, plaintext: param_value)
|
12
|
+
# Encrypt and base64 encode the parameter value.
|
13
|
+
#
|
14
|
+
# @param [String] param_value The parameter to encrypt.
|
15
|
+
# @return [String] base64 encoded encrypted ciphertext.
|
16
|
+
def encrypt(param_value)
|
17
|
+
resp = @kms_client.encrypt(key_id: @key_arn, plaintext: param_value)
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
# Use strict here to avoid newlines which cause issues with parameters.
|
20
|
+
Base64.strict_encode64(resp.ciphertext_blob)
|
21
|
+
end
|
21
22
|
end
|
22
23
|
end
|
23
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moonshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.0.
|
4
|
+
version: 1.1.0.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cloud Engineering <engineering@acquia.com>
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|