rapid-vaults 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/LICENSE.md +20 -0
- data/README.md +33 -32
- data/lib/rapid-vaults/binding.rb +6 -2
- data/lib/rapid-vaults/bindings/chef.rb +33 -29
- data/lib/rapid-vaults/bindings/rapid_vaults_pb.rb +20 -0
- data/lib/rapid-vaults/bindings/rapid_vaults_services_pb.rb +33 -0
- data/lib/rapid-vaults/cli.rb +6 -4
- data/lib/rapid-vaults/decrypt.rb +1 -7
- data/lib/rapid-vaults/encrypt.rb +1 -5
- data/lib/rapid-vaults/generate.rb +2 -2
- data/lib/rapid_vaults.rb +13 -5
- data/lib/rapid_vaults.rbs +40 -0
- data/rapid-vaults.gemspec +23 -0
- data/spec/rapid-vaults/cli_spec.rb +2 -2
- data/spec/rapid-vaults/decrypt_spec.rb +16 -32
- data/spec/rapid-vaults/encrypt_spec.rb +9 -19
- data/spec/rapid-vaults/generate_spec.rb +13 -16
- data/spec/rapid-vaults/grpc_spec.rb +9 -1
- data/spec/rapid_vaults_spec.rb +30 -2
- data/spec/system/system_spec.rb +3 -5
- metadata +17 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff3321864a63230a5cb7c5c3b57dfbfc403e2cc06f4c903e78c3bcbf4f52a4c3
|
4
|
+
data.tar.gz: 302469d5ba1c2306c16a438552a47dcf895423f3b661f76088ac1c8eaab21770
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6668ff3eb490e4b68335f602693ba84ffa9b2079bf614c9f730d006a26d8ac66caa324bdf8b29dd4a15141c3ae8bb230192d97255c124930c31f296038c5f3d1
|
7
|
+
data.tar.gz: d79506278d8708890866ee20a742a60cb9d36d4c75f552ff0e5d051ae32f1923cbf2094bb5b0ab580677be2c36e49d458b9e90a7f9cf4091cbad689693576392
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
### 1.3.0
|
2
|
+
- Bump minimum Ruby version to 2.6.
|
3
|
+
- Code optimization and validation improvements.
|
4
|
+
|
5
|
+
### 1.2.0
|
6
|
+
- Add GRPC support (alpha).
|
7
|
+
- Bump minimum Ruby version to 2.5.
|
8
|
+
- Add additional validation for key, nonce, and encrypted file contents.
|
9
|
+
- Fix erroneous argument validations for GPG when action is `generate`.
|
10
|
+
|
11
|
+
### 1.1.2
|
12
|
+
- Added checks on input files and directories.
|
13
|
+
- Fix bugs blocking bindings output.
|
14
|
+
|
15
|
+
### 1.1.1
|
16
|
+
- Added Puppet and Chef bindings.
|
17
|
+
- Add `outdir` CLI option.
|
18
|
+
|
19
|
+
### 1.1.0
|
20
|
+
- Added capability to encrypt and decrypt with GNUPG/GPG.
|
21
|
+
|
22
|
+
### 1.0.0
|
23
|
+
- Initial Release
|
data/LICENSE.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2018 Matt Schuchard
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,7 +1,4 @@
|
|
1
1
|
# Rapid Vaults
|
2
|
-
[](https://travis-ci.org/mschuchard/rapid-vaults)
|
3
|
-
[](https://circleci.com/gh/mschuchard/rapid-vaults)
|
4
|
-
|
5
2
|
- [Description](#description)
|
6
3
|
- [Usage](#usage)
|
7
4
|
- [CLI](#cli)
|
@@ -99,8 +96,7 @@ Currently you set the path to the keys and other files via the environment varia
|
|
99
96
|
```ruby
|
100
97
|
require 'rapid-vaults'
|
101
98
|
|
102
|
-
options = {}
|
103
|
-
options[:action] = :generate
|
99
|
+
options = { action: :generate }
|
104
100
|
key, nonce = RapidVaults::API.main(options)
|
105
101
|
File.write('key.txt', key)
|
106
102
|
File.write('nonce.txt', nonce)
|
@@ -111,12 +107,13 @@ File.write('nonce.txt', nonce)
|
|
111
107
|
```ruby
|
112
108
|
require 'rapid-vaults'
|
113
109
|
|
114
|
-
options = {
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
110
|
+
options = {
|
111
|
+
action: :encrypt,
|
112
|
+
file: '/path/to/data.txt',
|
113
|
+
key: '/path/to/key.txt',
|
114
|
+
nonce: '/path/to/nonce.txt',
|
115
|
+
pw: File.read('/path/to/password.txt') # optional
|
116
|
+
}
|
120
117
|
encrypted_contents, tag = RapidVaults::API.main(options)
|
121
118
|
```
|
122
119
|
|
@@ -125,13 +122,14 @@ encrypted_contents, tag = RapidVaults::API.main(options)
|
|
125
122
|
```ruby
|
126
123
|
require 'rapid-vaults'
|
127
124
|
|
128
|
-
options = {
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
125
|
+
options = {
|
126
|
+
action: :decrypt,
|
127
|
+
file: '/path/to/encrypted_data.txt',
|
128
|
+
key: '/path/to/key.txt',
|
129
|
+
nonce: '/path/to/nonce.txt',
|
130
|
+
tag: '/path/to/tag.txt',
|
131
|
+
pw: File.read('/path/to/password.txt') # optional
|
132
|
+
}
|
135
133
|
decrypted_contents = RapidVaults::API.main(options)
|
136
134
|
```
|
137
135
|
|
@@ -141,10 +139,11 @@ require 'rapid-vaults'
|
|
141
139
|
|
142
140
|
ENV['GNUPGHOME'] = '/home/alice/.gnupg'
|
143
141
|
|
144
|
-
options = {
|
145
|
-
|
146
|
-
|
147
|
-
|
142
|
+
options = {
|
143
|
+
action: :generate,
|
144
|
+
algorithm: :gpgme,
|
145
|
+
gpgparams: File.read('gpgparams.txt')
|
146
|
+
}
|
148
147
|
RapidVaults::API.main(options)
|
149
148
|
```
|
150
149
|
|
@@ -171,11 +170,12 @@ require 'rapid-vaults'
|
|
171
170
|
|
172
171
|
ENV['GNUPGHOME'] = '/home/bob/.gnupg' # optional
|
173
172
|
|
174
|
-
options = {
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
173
|
+
options = {
|
174
|
+
action: :encrypt,
|
175
|
+
algorithm: :gpgme,
|
176
|
+
file: '/path/to/data.txt',
|
177
|
+
pw: File.read('/path/to/password.txt')
|
178
|
+
}
|
179
179
|
encrypted_contents = RapidVaults::API.main(options)
|
180
180
|
```
|
181
181
|
|
@@ -186,11 +186,12 @@ require 'rapid-vaults'
|
|
186
186
|
|
187
187
|
ENV['GNUPGHOME'] = '/home/chris/.gnupg' # optional
|
188
188
|
|
189
|
-
options = {
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
189
|
+
options = {
|
190
|
+
action: :decrypt,
|
191
|
+
algorithm: :gpgme,
|
192
|
+
file: '/path/to/encrypted_data.txt',
|
193
|
+
pw: File.read('/path/to/password.txt')
|
194
|
+
}
|
194
195
|
decrypted_contents = RapidVaults::API.main(options)
|
195
196
|
```
|
196
197
|
|
data/lib/rapid-vaults/binding.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
# class to output bindings with other software
|
2
2
|
class Binding
|
3
|
+
# bindings matrix consts
|
4
|
+
CRYPT = %w[gpg ssl].freeze
|
5
|
+
ACTION = %w[encrypt decrypt].freeze
|
6
|
+
|
3
7
|
# outputs puppet bindings
|
4
8
|
def self.puppet(settings)
|
5
9
|
# output puppet bindings to output directory
|
6
|
-
|
7
|
-
|
10
|
+
CRYPT.each do |algo|
|
11
|
+
ACTION.each do |action|
|
8
12
|
content = File.read("#{__dir__}/bindings/puppet_#{algo}_#{action}.rb")
|
9
13
|
File.write("#{settings[:outdir]}puppet_#{algo}_#{action}.rb", content)
|
10
14
|
end
|
@@ -2,31 +2,32 @@ require 'rapid-vaults'
|
|
2
2
|
|
3
3
|
# returns key, nonce
|
4
4
|
def ssl_generate
|
5
|
-
options = {}
|
6
|
-
options[:action] = :generate
|
5
|
+
options = { action: :generate }
|
7
6
|
RapidVaults::API.main(options)
|
8
7
|
end
|
9
8
|
|
10
9
|
# returns encrypted_contents, tag
|
11
10
|
def ssl_encrypt
|
12
|
-
options = {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
options = {
|
12
|
+
action: :encrypt,
|
13
|
+
file: '/path/to/data.txt',
|
14
|
+
key: '/path/to/key.txt',
|
15
|
+
nonce: '/path/to/nonce.txt',
|
16
|
+
pw: File.read('/path/to/password.txt') # optional
|
17
|
+
}
|
18
18
|
RapidVaults::API.main(options)
|
19
19
|
end
|
20
20
|
|
21
21
|
# returns decrypted_contents
|
22
22
|
def ssl_decrypt
|
23
|
-
options = {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
options = {
|
24
|
+
action: :decrypt,
|
25
|
+
file: '/path/to/encrypted_data.txt',
|
26
|
+
key: '/path/to/key.txt',
|
27
|
+
nonce: '/path/to/nonce.txt',
|
28
|
+
tag: '/path/to/tag.txt',
|
29
|
+
pw: File.read('/path/to/password.txt') # optional
|
30
|
+
}
|
30
31
|
RapidVaults::API.main(options)
|
31
32
|
end
|
32
33
|
|
@@ -34,10 +35,11 @@ end
|
|
34
35
|
def gpg_generate
|
35
36
|
ENV['GNUPGHOME'] = '/home/alice/.gnupg'
|
36
37
|
|
37
|
-
options = {
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
options = {
|
39
|
+
action: :generate,
|
40
|
+
algorithm: :gpgme,
|
41
|
+
gpgparams: File.read('gpgparams.txt')
|
42
|
+
}
|
41
43
|
RapidVaults::API.main(options)
|
42
44
|
end
|
43
45
|
|
@@ -45,11 +47,12 @@ end
|
|
45
47
|
def gpg_encrypt
|
46
48
|
ENV['GNUPGHOME'] = '/home/bob/.gnupg'
|
47
49
|
|
48
|
-
options = {
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
options = {
|
51
|
+
action: :encrypt,
|
52
|
+
algorithm: :gpgme,
|
53
|
+
file: '/path/to/data.txt',
|
54
|
+
pw: File.read('/path/to/password.txt')
|
55
|
+
}
|
53
56
|
RapidVaults::API.main(options)
|
54
57
|
end
|
55
58
|
|
@@ -57,10 +60,11 @@ end
|
|
57
60
|
def gpg_decrypt
|
58
61
|
ENV['GNUPGHOME'] = '/home/chris/.gnupg'
|
59
62
|
|
60
|
-
options = {
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
63
|
+
options = {
|
64
|
+
action: :decrypt,
|
65
|
+
algorithm: :gpgme,
|
66
|
+
file: '/path/to/encrypted_data.txt',
|
67
|
+
pw: File.read('/path/to/password.txt')
|
68
|
+
}
|
65
69
|
RapidVaults::API.main(options)
|
66
70
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# source: rapid_vaults.proto
|
4
|
+
|
5
|
+
require 'google/protobuf'
|
6
|
+
|
7
|
+
|
8
|
+
descriptor_data = "\n\x12rapid_vaults.proto\x12\x0brapidvaults\"\x0b\n\tGenInputs\"(\n\nGenOutputs\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05nonce\x18\x02 \x01(\t\"I\n\x0bUnencrypted\x12\x0c\n\x04text\x18\x01 \x01(\t\x12\x0b\n\x03key\x18\x02 \x01(\t\x12\r\n\x05nonce\x18\x03 \x01(\t\x12\x10\n\x08password\x18\x04 \x01(\t\"&\n\tEncrypted\x12\x0c\n\x04text\x18\x01 \x01(\t\x12\x0b\n\x03tag\x18\x02 \x01(\t\"V\n\x0bUndecrypted\x12\x0c\n\x04text\x18\x01 \x01(\t\x12\x0b\n\x03key\x18\x02 \x01(\t\x12\r\n\x05nonce\x18\x03 \x01(\t\x12\x0b\n\x03tag\x18\x04 \x01(\t\x12\x10\n\x08password\x18\x05 \x01(\t\"\x19\n\tDecrypted\x12\x0c\n\x04text\x18\x01 \x01(\t2\x99\x03\n\x0bRapidVaults\x12@\n\x0bSSLGenerate\x12\x16.rapidvaults.GenInputs\x1a\x17.rapidvaults.GenOutputs\"\x00\x12@\n\x0bGPGGenerate\x12\x16.rapidvaults.GenInputs\x1a\x17.rapidvaults.GenOutputs\"\x00\x12@\n\nSSLEncrypt\x12\x18.rapidvaults.Unencrypted\x1a\x16.rapidvaults.Encrypted\"\x00\x12@\n\nGPGEncrypt\x12\x18.rapidvaults.Unencrypted\x1a\x16.rapidvaults.Encrypted\"\x00\x12@\n\nSSLDecrypt\x12\x18.rapidvaults.Undecrypted\x1a\x16.rapidvaults.Decrypted\"\x00\x12@\n\nGPGDecrypt\x12\x18.rapidvaults.Undecrypted\x1a\x16.rapidvaults.Decrypted\"\x00\x62\x06proto3"
|
9
|
+
|
10
|
+
pool = Google::Protobuf::DescriptorPool.generated_pool
|
11
|
+
pool.add_serialized_file(descriptor_data)
|
12
|
+
|
13
|
+
module Rapidvaults
|
14
|
+
GenInputs = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("rapidvaults.GenInputs").msgclass
|
15
|
+
GenOutputs = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("rapidvaults.GenOutputs").msgclass
|
16
|
+
Unencrypted = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("rapidvaults.Unencrypted").msgclass
|
17
|
+
Encrypted = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("rapidvaults.Encrypted").msgclass
|
18
|
+
Undecrypted = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("rapidvaults.Undecrypted").msgclass
|
19
|
+
Decrypted = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("rapidvaults.Decrypted").msgclass
|
20
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: rapid_vaults.proto for package 'rapidvaults'
|
3
|
+
|
4
|
+
require 'grpc'
|
5
|
+
require_relative 'rapid_vaults_pb'
|
6
|
+
|
7
|
+
module Rapidvaults
|
8
|
+
module RapidVaults
|
9
|
+
class Service
|
10
|
+
|
11
|
+
include ::GRPC::GenericService
|
12
|
+
|
13
|
+
self.marshal_class_method = :encode
|
14
|
+
self.unmarshal_class_method = :decode
|
15
|
+
self.service_name = 'rapidvaults.RapidVaults'
|
16
|
+
|
17
|
+
# generate SSL key and nonce
|
18
|
+
rpc :SSLGenerate, ::Rapidvaults::GenInputs, ::Rapidvaults::GenOutputs
|
19
|
+
# generate GPG key and nonce
|
20
|
+
rpc :GPGGenerate, ::Rapidvaults::GenInputs, ::Rapidvaults::GenOutputs
|
21
|
+
# encrypt with SSL
|
22
|
+
rpc :SSLEncrypt, ::Rapidvaults::Unencrypted, ::Rapidvaults::Encrypted
|
23
|
+
# encrypt with GPG
|
24
|
+
rpc :GPGEncrypt, ::Rapidvaults::Unencrypted, ::Rapidvaults::Encrypted
|
25
|
+
# decrypt with SSL
|
26
|
+
rpc :SSLDecrypt, ::Rapidvaults::Undecrypted, ::Rapidvaults::Decrypted
|
27
|
+
# decrypt with GPG
|
28
|
+
rpc :GPGDecrypt, ::Rapidvaults::Undecrypted, ::Rapidvaults::Decrypted
|
29
|
+
end
|
30
|
+
|
31
|
+
Stub = Service.rpc_stub_class
|
32
|
+
end
|
33
|
+
end
|
data/lib/rapid-vaults/cli.rb
CHANGED
@@ -6,7 +6,7 @@ class RapidVaults::CLI
|
|
6
6
|
def self.main(args)
|
7
7
|
# parse args in cli and denote using cli
|
8
8
|
settings = parse(args)
|
9
|
-
if
|
9
|
+
if %i[encrypt decrypt].include?(settings[:action])
|
10
10
|
args.empty? ? (raise 'rapid-vaults: no file specified; try using --help') : settings[:file] = args.first
|
11
11
|
end
|
12
12
|
|
@@ -31,7 +31,9 @@ class RapidVaults::CLI
|
|
31
31
|
|
32
32
|
# base options
|
33
33
|
opts.on('--version', 'Display the current version.') do
|
34
|
-
|
34
|
+
require 'rubygems'
|
35
|
+
|
36
|
+
puts Gem::Specification.load("#{File.dirname(__FILE__)}/../../rapid-vaults.gemspec").version
|
35
37
|
exit 0
|
36
38
|
end
|
37
39
|
|
@@ -49,7 +51,7 @@ class RapidVaults::CLI
|
|
49
51
|
opts.on('-t', '--tag tag', String, 'Tag file to be used for decryption (GPG: n/a).') { |arg| settings[:tag] = arg }
|
50
52
|
opts.on('-p', '--password password', String, '(optional) Password to be used for encryption or decryption (GPG: required).') { |arg| settings[:pw] = arg }
|
51
53
|
opts.on('-f', '--file-password password.txt', String, '(optional) Text file containing a password to be used for encryption or decryption (GPG: required).') do |arg|
|
52
|
-
raise "Password file #{arg} is not an existing file!" unless File.
|
54
|
+
raise "Password file #{arg} is not an existing readable file!" unless File.readable?(arg)
|
53
55
|
settings[:pw] = File.read(arg)
|
54
56
|
end
|
55
57
|
|
@@ -61,7 +63,7 @@ class RapidVaults::CLI
|
|
61
63
|
|
62
64
|
# other
|
63
65
|
opts.on('--gpgparams params.txt', String, 'GPG Key params input file used during generation of keys.') do |arg|
|
64
|
-
raise "GPG Parameters file #{arg} is not an existing file!" unless File.
|
66
|
+
raise "GPG Parameters file #{arg} is not an existing readable file!" unless File.readable?(arg)
|
65
67
|
settings[:gpgparams] = File.read(arg)
|
66
68
|
end
|
67
69
|
opts.on('-o --outdir', String, 'Optional output directory for generated files (default: pwd). (GPG: optional)') do |arg|
|
data/lib/rapid-vaults/decrypt.rb
CHANGED
@@ -4,12 +4,6 @@ class Decrypt
|
|
4
4
|
def self.openssl(settings)
|
5
5
|
require 'openssl'
|
6
6
|
|
7
|
-
# validate key, nonce, encrypted, and tag
|
8
|
-
raise 'The key is not a valid 32 byte key.' unless settings[:key].bytesize == 32
|
9
|
-
raise 'The nonce is not a valid 12 byte nonce.' unless settings[:nonce].bytesize == 12
|
10
|
-
raise 'The encrypted data is not a valid multiple of 9 bytes.' unless (settings[:file].bytesize % 9).zero?
|
11
|
-
raise 'Tag is not 16 bytes.' unless settings[:tag].bytesize == 16
|
12
|
-
|
13
7
|
# setup the decryption parameters
|
14
8
|
decipher = OpenSSL::Cipher.new('aes-256-gcm').decrypt
|
15
9
|
decipher.key = settings[:key]
|
@@ -34,7 +28,7 @@ class Decrypt
|
|
34
28
|
require 'gpgme'
|
35
29
|
|
36
30
|
# check if GPGHOME env was set
|
37
|
-
puts "Environment variable 'GNUPGHOME' was not set. Files in #{
|
31
|
+
puts "Environment variable 'GNUPGHOME' was not set. Files in #{Dir.home}/.gnupg will be used for authentication." unless ENV.fetch('GNUPGHOME', false)
|
38
32
|
|
39
33
|
# setup the decryption parameters
|
40
34
|
encrypted = GPGME::Data.new(settings[:file])
|
data/lib/rapid-vaults/encrypt.rb
CHANGED
@@ -4,10 +4,6 @@ class Encrypt
|
|
4
4
|
def self.openssl(settings)
|
5
5
|
require 'openssl'
|
6
6
|
|
7
|
-
# validate key and nonce
|
8
|
-
raise 'The key is not a valid 32 byte key.' unless settings[:key].bytesize == 32
|
9
|
-
raise 'The nonce is not a valid 12 byte nonce.' unless settings[:nonce].bytesize == 12
|
10
|
-
|
11
7
|
# setup the encryption parameters
|
12
8
|
cipher = OpenSSL::Cipher.new('aes-256-gcm').encrypt
|
13
9
|
cipher.key = settings[:key]
|
@@ -32,7 +28,7 @@ class Encrypt
|
|
32
28
|
require 'gpgme'
|
33
29
|
|
34
30
|
# check if GPGHOME env was set
|
35
|
-
puts "Environment variable 'GNUPGHOME' was not set. Files in #{
|
31
|
+
puts "Environment variable 'GNUPGHOME' was not set. Files in #{Dir.home}/.gnupg will be used for authentication." unless ENV.fetch('GNUPGHOME', false)
|
36
32
|
|
37
33
|
# setup the encryption parameters
|
38
34
|
crypto = GPGME::Crypto.new(armor: true, pinentry_mode: GPGME::PINENTRY_MODE_LOOPBACK)
|
@@ -24,10 +24,10 @@ class Generate
|
|
24
24
|
require 'gpgme'
|
25
25
|
|
26
26
|
# ensure we have a place to store these output files
|
27
|
-
raise 'Environment variable "GNUPGHOME" was not set.' unless ENV
|
27
|
+
raise 'Environment variable "GNUPGHOME" was not set.' unless ENV.fetch('GNUPGHOME', false)
|
28
28
|
|
29
29
|
# create gpg keys
|
30
30
|
GPGME::Ctx.new.generate_key(settings[:gpgparams], nil, nil)
|
31
|
-
puts "Your GPG keys have been generated in #{ENV['GNUPGHOME']}." if settings[:ui] == :cli
|
31
|
+
puts "Your GPG keys have been generated in #{ENV.fetch['GNUPGHOME']}." if settings[:ui] == :cli
|
32
32
|
end
|
33
33
|
end
|
data/lib/rapid_vaults.rb
CHANGED
@@ -11,7 +11,6 @@ class RapidVaults
|
|
11
11
|
self.class.process(settings)
|
12
12
|
|
13
13
|
# execute desired action and algorithm via dynamic call
|
14
|
-
# public_send("#{settings[:action].capitalize}.#{settings[:algorithm]}".to_sym, settings)
|
15
14
|
case settings[:action]
|
16
15
|
when :generate then Generate.public_send(settings[:algorithm], settings)
|
17
16
|
when :encrypt then Encrypt.public_send(settings[:algorithm], settings)
|
@@ -22,9 +21,9 @@ class RapidVaults
|
|
22
21
|
|
23
22
|
# method for processing the settings and inputs
|
24
23
|
def self.process(settings)
|
25
|
-
#
|
24
|
+
# default to openssl algorithm and `pwd` output directory
|
26
25
|
if settings[:ui] == :cli
|
27
|
-
#
|
26
|
+
# :outdir only relevant for :cli
|
28
27
|
settings[:outdir] ||= Dir.pwd
|
29
28
|
settings[:outdir] += '/' unless settings[:outdir][-1] == '/'
|
30
29
|
end
|
@@ -33,7 +32,7 @@ class RapidVaults
|
|
33
32
|
settings[:algorithm] ||= :openssl
|
34
33
|
|
35
34
|
# check for problems with arguments and inputs
|
36
|
-
public_send("process_#{settings[:algorithm]}"
|
35
|
+
public_send(:"process_#{settings[:algorithm]}", settings)
|
37
36
|
end
|
38
37
|
|
39
38
|
# processing openssl
|
@@ -55,8 +54,17 @@ class RapidVaults
|
|
55
54
|
# check inputs and read in files
|
56
55
|
raise 'Password must be a string.' if settings.key?(:pw) && !settings[:pw].is_a?(String)
|
57
56
|
%i[file key nonce].each(&process_input)
|
58
|
-
|
57
|
+
|
58
|
+
# validate key and nonce
|
59
|
+
raise 'The key is not a valid 32 byte key.' unless settings[:key].bytesize == 32
|
60
|
+
raise 'The nonce is not a valid 12 byte nonce.' unless settings[:nonce].bytesize == 12
|
61
|
+
|
62
|
+
# decrypt: check inputs and read in files, and validate encrypted and tag
|
63
|
+
return unless settings[:action] == :decrypt
|
59
64
|
process_input.call(:tag) if settings[:action] == :decrypt
|
65
|
+
|
66
|
+
raise 'The encrypted data is not a valid multiple of 9 bytes.' unless (settings[:file].bytesize % 9).zero?
|
67
|
+
raise 'Tag is not 16 bytes.' unless settings[:tag].bytesize == 16
|
60
68
|
end
|
61
69
|
|
62
70
|
# processing gpgme
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Classes
|
2
|
+
class Binding
|
3
|
+
CRYPT: [String, String]
|
4
|
+
ACTION: [String, String]
|
5
|
+
|
6
|
+
def self.puppet: (Hash[Symbol, untyped]) -> nil
|
7
|
+
def self.chef: (Hash[Symbol, untyped]) -> nil
|
8
|
+
end
|
9
|
+
|
10
|
+
class Decrypt
|
11
|
+
def self.openssl: (Hash[Symbol, untyped]) -> String?
|
12
|
+
def self.gpgme: (Hash[Symbol, untyped]) -> String?
|
13
|
+
end
|
14
|
+
|
15
|
+
class Encrypt
|
16
|
+
def self.openssl: (Hash[Symbol, untyped]) -> [String, String]?
|
17
|
+
def self.gpgme: (Hash[Symbol, untyped]) -> String?
|
18
|
+
end
|
19
|
+
|
20
|
+
class Generate
|
21
|
+
def self.openssl: (Hash[Symbol, untyped]) -> [String, String]?
|
22
|
+
def self.gpgme: (Hash[Symbol, untyped]) -> nil
|
23
|
+
end
|
24
|
+
|
25
|
+
class RapidVaults
|
26
|
+
def main: (Hash[Symbol, untyped]) -> nil
|
27
|
+
def self.process: (Hash[Symbol, untyped]) -> nil
|
28
|
+
def self.process_openssl: (Hash[Symbol, untyped]) -> nil
|
29
|
+
def self.process_gpgme: (Hash[Symbol, untyped]) -> nil
|
30
|
+
|
31
|
+
class API
|
32
|
+
def self.main: (Hash[Symbol, untyped]) -> nil
|
33
|
+
def self.parse: (Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
|
34
|
+
end
|
35
|
+
|
36
|
+
class CLI
|
37
|
+
def self.main: ([String]) -> Integer
|
38
|
+
def self.parse: ([String]) -> Hash[Symbol, untyped]
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = 'rapid-vaults'
|
3
|
+
spec.version = '1.3.0'
|
4
|
+
spec.authors = ['Matt Schuchard']
|
5
|
+
spec.description = 'Ad-hoc encrypt and decrypt data behind multiple layers of protection via OpenSSL or GPG.'
|
6
|
+
spec.summary = 'Ad-hoc encrypt and decrypt data.'
|
7
|
+
spec.homepage = 'https://www.github.com/mschuchard/rapid-vaults'
|
8
|
+
spec.license = 'MIT'
|
9
|
+
|
10
|
+
spec.files = Dir['bin/**/*', 'lib/**/*', 'spec/**/*', 'CHANGELOG.md', 'LICENSE.md', 'README.md', 'rapid-vaults.gemspec']
|
11
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |file| File.basename(file) }
|
12
|
+
spec.require_paths = Dir['lib']
|
13
|
+
|
14
|
+
spec.required_ruby_version = '>= 2.6.0'
|
15
|
+
spec.add_dependency 'gpgme', '~> 2.0'
|
16
|
+
spec.add_development_dependency 'grpc', '~> 1.0'
|
17
|
+
spec.add_development_dependency 'grpc-tools', '~> 1.0'
|
18
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
19
|
+
spec.add_development_dependency 'reek', '~> 6.0'
|
20
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
21
|
+
spec.add_development_dependency 'rubocop', '~> 1.0'
|
22
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.0'
|
23
|
+
end
|
@@ -22,10 +22,10 @@ describe RapidVaults::CLI do
|
|
22
22
|
expect(RapidVaults::CLI.parse(%w[-b puppet -o .])).to eq(ui: :cli, action: :binding, binding: :puppet, outdir: '.')
|
23
23
|
end
|
24
24
|
it 'raises an error for a nonexistent password file' do
|
25
|
-
expect { RapidVaults::CLI.parse(%w[-f /nopasswordhere]) }.to raise_error('Password file /nopasswordhere is not an existing file!')
|
25
|
+
expect { RapidVaults::CLI.parse(%w[-f /nopasswordhere]) }.to raise_error('Password file /nopasswordhere is not an existing readable file!')
|
26
26
|
end
|
27
27
|
it 'raises an error for a nonexistent gpg parameters file' do
|
28
|
-
expect { RapidVaults::CLI.parse(%w[--gpgparams /foo/bar]) }.to raise_error('GPG Parameters file /foo/bar is not an existing file!')
|
28
|
+
expect { RapidVaults::CLI.parse(%w[--gpgparams /foo/bar]) }.to raise_error('GPG Parameters file /foo/bar is not an existing readable file!')
|
29
29
|
end
|
30
30
|
it 'raises an error for a nonexistent output directory' do
|
31
31
|
expect { RapidVaults::CLI.parse(%w[-o /foo/bar/baz]) }.to raise_error('The output directory /foo/bar/baz does not exist or is not a directory!')
|
@@ -5,7 +5,6 @@ require_relative '../../lib/rapid-vaults/decrypt'
|
|
5
5
|
describe Decrypt do
|
6
6
|
context '.openssl' do
|
7
7
|
require 'openssl'
|
8
|
-
require 'securerandom'
|
9
8
|
cipher = OpenSSL::Cipher.new('aes-256-gcm').encrypt
|
10
9
|
key = cipher.random_key
|
11
10
|
nonce = cipher.random_iv
|
@@ -28,41 +27,26 @@ describe Decrypt do
|
|
28
27
|
expect(decrypt).to be_a(String)
|
29
28
|
expect(decrypt).to eq("foo: bar\n")
|
30
29
|
end
|
31
|
-
it 'raises an error for an invalid tag size' do
|
32
|
-
expect { Decrypt.openssl(file: File.read('encrypted.txt'), key: key, nonce: nonce, tag: SecureRandom.random_bytes(24).strip) }.to raise_error('Tag is not 16 bytes.')
|
33
|
-
end
|
34
|
-
it 'raises an error for an invalid key size' do
|
35
|
-
expect { Decrypt.openssl(key: SecureRandom.random_bytes(64).strip) }.to raise_error('The key is not a valid 32 byte key.')
|
36
|
-
end
|
37
|
-
it 'raises an error for an invalid nonce size' do
|
38
|
-
expect { Decrypt.openssl(key: key, nonce: SecureRandom.random_bytes(24).strip) }.to raise_error('The nonce is not a valid 12 byte nonce.')
|
39
|
-
end
|
40
|
-
it 'raises an error for corrupted encrypted file content' do
|
41
|
-
expect { Decrypt.openssl(file: SecureRandom.random_bytes(16).strip, key: key, nonce: nonce) }.to raise_error('The encrypted data is not a valid multiple of 9 bytes.')
|
42
|
-
end
|
43
30
|
end
|
44
31
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
Encrypt.gpgme(ui: :cli, file: "foo: bar\n", key: '', pw: 'foo')
|
50
|
-
end
|
32
|
+
context '.gpgme' do
|
33
|
+
before(:all) do
|
34
|
+
Encrypt.gpgme(ui: :cli, file: "foo: bar\n", key: '', pw: 'foo')
|
35
|
+
end
|
51
36
|
|
52
|
-
|
53
|
-
|
54
|
-
|
37
|
+
after(:all) do
|
38
|
+
%w[encrypted.txt decrypted.txt].each { |file| File.delete(file) }
|
39
|
+
end
|
55
40
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
end
|
41
|
+
it 'outputs a decrypted file with the key from the cli' do
|
42
|
+
Decrypt.gpgme(ui: :cli, file: File.read('encrypted.txt'), key: '', pw: 'foo')
|
43
|
+
expect(File.file?('decrypted.txt')).to be true
|
44
|
+
expect(File.read('decrypted.txt')).to eq("foo: bar\n")
|
45
|
+
end
|
46
|
+
it 'outputs decrypted content with the key from the api' do
|
47
|
+
decrypt = Decrypt.gpgme(ui: :api, file: File.read('encrypted.txt'), key: '', pw: 'foo')
|
48
|
+
expect(decrypt).to be_a(String)
|
49
|
+
expect(decrypt).to eq("foo: bar\n")
|
66
50
|
end
|
67
51
|
end
|
68
52
|
end
|
@@ -4,7 +4,6 @@ require_relative '../../lib/rapid-vaults/encrypt'
|
|
4
4
|
describe Encrypt do
|
5
5
|
context '.openssl' do
|
6
6
|
require 'openssl'
|
7
|
-
require 'securerandom'
|
8
7
|
cipher = OpenSSL::Cipher.new('aes-256-gcm').encrypt
|
9
8
|
key = cipher.random_key
|
10
9
|
nonce = cipher.random_iv
|
@@ -26,29 +25,20 @@ describe Encrypt do
|
|
26
25
|
it 'outputs an array of encrypted content and tag with the key and nonce from the api' do
|
27
26
|
encrypt = Encrypt.openssl(ui: :api, file: "foo: bar\n", key: key, nonce: nonce)
|
28
27
|
expect(encrypt).to be_a(Array)
|
28
|
+
expect(encrypt.length).to eq(2)
|
29
29
|
expect(encrypt[0]).to be_a(String)
|
30
30
|
expect(encrypt[1]).to be_a(String)
|
31
|
-
expect(encrypt.length).to eq(2)
|
32
|
-
end
|
33
|
-
it 'raises an error for an invalid key size' do
|
34
|
-
expect { Encrypt.openssl(key: SecureRandom.random_bytes(64).strip) }.to raise_error('The key is not a valid 32 byte key.')
|
35
|
-
end
|
36
|
-
it 'raises an error for an invalid nonce size' do
|
37
|
-
expect { Encrypt.openssl(key: key, nonce: SecureRandom.random_bytes(24).strip) }.to raise_error('The nonce is not a valid 12 byte nonce.')
|
38
31
|
end
|
39
32
|
end
|
40
33
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
encrypt = Encrypt.gpgme(ui: :api, file: "foo: bar\n", key: '', pw: 'foo')
|
50
|
-
expect(encrypt).to be_a(String)
|
51
|
-
end
|
34
|
+
context '.gpgme' do
|
35
|
+
it 'outputs an encrypted file with the key from the cli' do
|
36
|
+
Encrypt.gpgme(ui: :cli, file: "foo: bar\n", key: '', pw: 'foo')
|
37
|
+
expect(File.file?('encrypted.txt')).to be true
|
38
|
+
end
|
39
|
+
it 'outputs a string of encrypted content with the key from the api' do
|
40
|
+
encrypt = Encrypt.gpgme(ui: :api, file: "foo: bar\n", key: '', pw: 'foo')
|
41
|
+
expect(encrypt).to be_a(String)
|
52
42
|
end
|
53
43
|
end
|
54
44
|
end
|
@@ -17,9 +17,9 @@ describe Generate do
|
|
17
17
|
it 'outputs an array with the key and nonce from the api' do
|
18
18
|
generate = Generate.openssl(ui: :api)
|
19
19
|
expect(generate).to be_a(Array)
|
20
|
+
expect(generate.length).to eq(2)
|
20
21
|
expect(generate[0]).to be_a(String)
|
21
22
|
expect(generate[1]).to be_a(String)
|
22
|
-
expect(generate.length).to eq(2)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -27,24 +27,21 @@ describe Generate do
|
|
27
27
|
it 'raises an error for a missing GNUPGHOME variable' do
|
28
28
|
expect { Generate.gpgme(gpgparams: File.read("#{fixtures_dir}/gpgparams.txt")) }.to raise_error('Environment variable "GNUPGHOME" was not set.')
|
29
29
|
end
|
30
|
-
|
31
|
-
|
32
|
-
it 'generates the key files' do
|
33
|
-
require 'fileutils'
|
30
|
+
it 'generates the key files' do
|
31
|
+
require 'fileutils'
|
34
32
|
|
35
|
-
|
33
|
+
ENV['GNUPGHOME'] = fixtures_dir
|
36
34
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
end
|
46
|
-
%w[S.gpg-agent random_seed].each { |file| File.delete("#{fixtures_dir}/#{file}") if File.exist?(file) }
|
35
|
+
Generate.gpgme(gpgparams: File.read("#{fixtures_dir}/gpgparams.txt"))
|
36
|
+
%w[trustdb.gpg pubring.kbx pubring.kbx~].each do |file|
|
37
|
+
expect(File.file?("#{fixtures_dir}/#{file}")).to be true
|
38
|
+
File.delete("#{fixtures_dir}/#{file}")
|
39
|
+
end
|
40
|
+
%w[openpgp-revocs.d private-keys-v1.d].each do |dir|
|
41
|
+
expect(File.directory?("#{fixtures_dir}/#{dir}")).to be true
|
42
|
+
FileUtils.rm_r("#{fixtures_dir}/#{dir}")
|
47
43
|
end
|
44
|
+
%w[S.gpg-agent random_seed].each { |file| File.delete("#{fixtures_dir}/#{file}") if File.file?(file) }
|
48
45
|
end
|
49
46
|
end
|
50
47
|
end
|
@@ -1,7 +1,15 @@
|
|
1
1
|
require_relative '../../lib/rapid-vaults/grpc'
|
2
2
|
|
3
3
|
# TODO: use RapidVaults::GRPC.server instead?
|
4
|
-
|
4
|
+
|
5
|
+
# stub = Rapidvaults::RapidVaults::Stub.new('localhost:0.0.0.0:8080', :this_channel_is_insecure)
|
6
|
+
describe GRPC do
|
7
|
+
context '.Stub' do
|
8
|
+
it 'starts a rapaid-vaults api local server' do
|
9
|
+
expect { Rapidvaults::RapidVaults::Stub.new('localhost:0.0.0.0:8080', :this_channel_is_insecure) }.not_to raise_error
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
5
13
|
|
6
14
|
# need to create class with encode member method to pass in as dummy
|
7
15
|
# ssl generate
|
data/spec/rapid_vaults_spec.rb
CHANGED
@@ -3,6 +3,23 @@ require_relative '../lib/rapid_vaults'
|
|
3
3
|
|
4
4
|
describe RapidVaults do
|
5
5
|
context '.process' do
|
6
|
+
# prepare for support file validation tests
|
7
|
+
require 'securerandom'
|
8
|
+
before(:all) do
|
9
|
+
File.write('key_bad.txt', SecureRandom.random_bytes(64).strip)
|
10
|
+
File.write('key_good.txt', SecureRandom.random_bytes(32).strip)
|
11
|
+
File.write('nonce_bad.txt', SecureRandom.random_bytes(24).strip)
|
12
|
+
File.write('nonce_good.txt', SecureRandom.random_bytes(12).strip)
|
13
|
+
File.write('tag_bad.txt', SecureRandom.random_bytes(24).strip)
|
14
|
+
File.write('tag_good.txt', SecureRandom.random_bytes(16).strip)
|
15
|
+
File.write('encrypted_bad.txt', SecureRandom.random_bytes(16).strip)
|
16
|
+
File.write('encrypted_good.txt', '')
|
17
|
+
end
|
18
|
+
|
19
|
+
after(:all) do
|
20
|
+
%w[key nonce tag encrypted].each { |file| File.delete("#{file}_bad.txt", "#{file}_good.txt") }
|
21
|
+
end
|
22
|
+
|
6
23
|
it 'raises an error for a non-string password with openssl' do
|
7
24
|
expect { RapidVaults.process(action: :encrypt, file: 'a', key: 'b', nonce: 'c', pw: 1) }.to raise_error('Password must be a string.')
|
8
25
|
end
|
@@ -33,9 +50,20 @@ describe RapidVaults do
|
|
33
50
|
it 'raises an error for a nonexistent input file with gpgme' do
|
34
51
|
expect { RapidVaults.process(algorithm: :gpgme, action: :encrypt, file: 'a', pw: 'password') }.to raise_error('Input file \'a\' for argument \'file\' is not an existing readable file.')
|
35
52
|
end
|
53
|
+
it 'raises an error for an invalid key size' do
|
54
|
+
expect { RapidVaults.process(action: :encrypt, file: "#{fixtures_dir}file.yaml", key: 'key_bad.txt', nonce: 'nonce_good.txt') }.to raise_error('The key is not a valid 32 byte key.')
|
55
|
+
end
|
56
|
+
it 'raises an error for an invalid nonce size' do
|
57
|
+
expect { RapidVaults.process(action: :encrypt, file: "#{fixtures_dir}file.yaml", key: 'key_good.txt', nonce: 'nonce_bad.txt') }.to raise_error('The nonce is not a valid 12 byte nonce.')
|
58
|
+
end
|
59
|
+
it 'raises an error for an invalid tag size' do
|
60
|
+
expect { RapidVaults.process(action: :decrypt, file: 'encrypted_good.txt', key: 'key_good.txt', nonce: 'nonce_good.txt', tag: 'tag_bad.txt') }.to raise_error('Tag is not 16 bytes.')
|
61
|
+
end
|
62
|
+
it 'raises an error for corrupted encrypted file content' do
|
63
|
+
expect { RapidVaults.process(action: :decrypt, file: 'encrypted_bad.txt', key: 'key_good.txt', nonce: 'nonce_good.txt', tag: 'tag_good.txt') }.to raise_error('The encrypted data is not a valid multiple of 9 bytes.')
|
64
|
+
end
|
36
65
|
it 'reads in all input files correctly for openssl encryption' do
|
37
|
-
|
38
|
-
expect { RapidVaults.process(action: :encrypt, file: dummy, key: dummy, nonce: dummy, pw: 'password') }.not_to raise_exception
|
66
|
+
expect { RapidVaults.process(action: :decrypt, file: 'encrypted_good.txt', key: 'key_good.txt', nonce: 'nonce_good.txt', tag: 'tag_good.txt', pw: 'password') }.not_to raise_exception
|
39
67
|
end
|
40
68
|
it 'reads in all input files correctly for gpgme decryption' do
|
41
69
|
dummy = "#{fixtures_dir}file.yaml"
|
data/spec/system/system_spec.rb
CHANGED
@@ -7,7 +7,7 @@ describe RapidVaults do
|
|
7
7
|
require 'fileutils'
|
8
8
|
|
9
9
|
%w[key.txt nonce.txt tag.txt encrypted.txt decrypted.txt chef.rb puppet_gpg_decrypt.rb puppet_gpg_encrypt.rb puppet_ssl_decrypt.rb puppet_ssl_encrypt.rb].each { |file| File.delete(file) }
|
10
|
-
unless ENV['
|
10
|
+
unless ENV['CIRCLECI'] == 'true' || ENV['GITHUB_ACTIONS'] == 'true'
|
11
11
|
%w[random_seed pubring.kbx trustdb.gpg pubring.kbx~].each { |file| File.delete(file) }
|
12
12
|
%w[openpgp-revocs.d private-keys-v1.d].each { |dir| FileUtils.rm_r(dir) }
|
13
13
|
end
|
@@ -59,8 +59,8 @@ describe RapidVaults do
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
#
|
63
|
-
unless ENV['
|
62
|
+
# ci platforms cannot support end-to-end gpg generate/encrypt/decrypt
|
63
|
+
unless ENV['CIRCLECI'] == 'true' || ENV['GITHUB_ACTIONS'] == 'true'
|
64
64
|
context 'executed wtih gpg algorithm as a system from the CLI with settings and a file to be processed' do
|
65
65
|
it 'encrypts a file and then decrypts a file in order' do
|
66
66
|
ENV['GNUPGHOME'] = fixtures_dir
|
@@ -68,8 +68,6 @@ describe RapidVaults do
|
|
68
68
|
# generate and utilize files inside suitable directory
|
69
69
|
Dir.chdir(fixtures_dir)
|
70
70
|
|
71
|
-
puts fixtures_dir
|
72
|
-
|
73
71
|
# generate keys
|
74
72
|
RapidVaults::CLI.main(%w[-g --gpg --gpgparams gpgparams.txt])
|
75
73
|
%w[trustdb.gpg pubring.kbx pubring.kbx~].each { |file| expect(File.file?("#{fixtures_dir}/#{file}")).to be true }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rapid-vaults
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Schuchard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gpgme
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '13.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '13.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: reek
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,22 +98,16 @@ dependencies:
|
|
98
98
|
name: rubocop
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0.58'
|
104
|
-
- - "<"
|
101
|
+
- - "~>"
|
105
102
|
- !ruby/object:Gem::Version
|
106
|
-
version: '
|
103
|
+
version: '1.0'
|
107
104
|
type: :development
|
108
105
|
prerelease: false
|
109
106
|
version_requirements: !ruby/object:Gem::Requirement
|
110
107
|
requirements:
|
111
|
-
- - "
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
version: '0.58'
|
114
|
-
- - "<"
|
108
|
+
- - "~>"
|
115
109
|
- !ruby/object:Gem::Version
|
116
|
-
version: '
|
110
|
+
version: '1.0'
|
117
111
|
- !ruby/object:Gem::Dependency
|
118
112
|
name: rubocop-performance
|
119
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +130,8 @@ executables:
|
|
136
130
|
extensions: []
|
137
131
|
extra_rdoc_files: []
|
138
132
|
files:
|
133
|
+
- CHANGELOG.md
|
134
|
+
- LICENSE.md
|
139
135
|
- README.md
|
140
136
|
- bin/rapid-vaults
|
141
137
|
- lib/rapid-vaults/api.rb
|
@@ -145,12 +141,16 @@ files:
|
|
145
141
|
- lib/rapid-vaults/bindings/puppet_gpg_encrypt.rb
|
146
142
|
- lib/rapid-vaults/bindings/puppet_ssl_decrypt.rb
|
147
143
|
- lib/rapid-vaults/bindings/puppet_ssl_encrypt.rb
|
144
|
+
- lib/rapid-vaults/bindings/rapid_vaults_pb.rb
|
145
|
+
- lib/rapid-vaults/bindings/rapid_vaults_services_pb.rb
|
148
146
|
- lib/rapid-vaults/cli.rb
|
149
147
|
- lib/rapid-vaults/decrypt.rb
|
150
148
|
- lib/rapid-vaults/encrypt.rb
|
151
149
|
- lib/rapid-vaults/generate.rb
|
152
150
|
- lib/rapid-vaults/grpc.rb
|
153
151
|
- lib/rapid_vaults.rb
|
152
|
+
- lib/rapid_vaults.rbs
|
153
|
+
- rapid-vaults.gemspec
|
154
154
|
- spec/fixtures/file.yaml
|
155
155
|
- spec/fixtures/gpgparams.txt
|
156
156
|
- spec/rapid-vaults/api_spec.rb
|
@@ -175,27 +175,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
175
175
|
requirements:
|
176
176
|
- - ">="
|
177
177
|
- !ruby/object:Gem::Version
|
178
|
-
version: 2.
|
178
|
+
version: 2.6.0
|
179
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
180
|
requirements:
|
181
181
|
- - ">="
|
182
182
|
- !ruby/object:Gem::Version
|
183
183
|
version: '0'
|
184
184
|
requirements: []
|
185
|
-
rubygems_version: 3.
|
185
|
+
rubygems_version: 3.4.20
|
186
186
|
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: Ad-hoc encrypt and decrypt data.
|
189
|
-
test_files:
|
190
|
-
- spec/fixtures/file.yaml
|
191
|
-
- spec/fixtures/gpgparams.txt
|
192
|
-
- spec/rapid-vaults/api_spec.rb
|
193
|
-
- spec/rapid-vaults/binding_spec.rb
|
194
|
-
- spec/rapid-vaults/cli_spec.rb
|
195
|
-
- spec/rapid-vaults/decrypt_spec.rb
|
196
|
-
- spec/rapid-vaults/encrypt_spec.rb
|
197
|
-
- spec/rapid-vaults/generate_spec.rb
|
198
|
-
- spec/rapid-vaults/grpc_spec.rb
|
199
|
-
- spec/rapid_vaults_spec.rb
|
200
|
-
- spec/spec_helper.rb
|
201
|
-
- spec/system/system_spec.rb
|
189
|
+
test_files: []
|