ubiq-security 1.0.0 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +15 -14
- data/lib/ubiq-security.rb +5 -6
- data/lib/ubiq/algo.rb +65 -40
- data/lib/ubiq/auth.rb +77 -71
- data/lib/ubiq/credentials.rb +80 -64
- data/lib/ubiq/decrypt.rb +231 -211
- data/lib/ubiq/encrypt.rb +158 -146
- data/lib/ubiq/host.rb +4 -1
- data/lib/ubiq/version.rb +1 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 729b8860bf9bec12fd7185973e265accb516232460ee85dcf862a556d7008c53
|
4
|
+
data.tar.gz: 1b93971fda83f73f28e74adda5ae631c86f7fc826ae31f786f5e716f726351aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd5b18aaf1ede170f03511a2352bf324a9cbe137507eca720c2fe0b00c8e25124a7dc963ba583621d16911a15bc42b988d2f650cf6edcbb252dc34aeb2b7a614
|
7
|
+
data.tar.gz: 3a083c6fe5d1e1f29102adf845a0356ef0f4951f592a49d627bf381c360789fd7d43c9f5dd819cd0e63ec21a271e8586e8100c9e1bb556772bb8780c59d310ad
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -7,7 +7,7 @@ to encrypt and decrypt data
|
|
7
7
|
|
8
8
|
## Documentation
|
9
9
|
|
10
|
-
See the [Ruby API docs]
|
10
|
+
See the [Ruby API docs][apidocs].
|
11
11
|
|
12
12
|
|
13
13
|
|
@@ -31,8 +31,11 @@ To build and install directly from a clone of the gitlab repository source:
|
|
31
31
|
```sh
|
32
32
|
git clone https://gitlab.com/ubiqsecurity/ubiq-ruby.git
|
33
33
|
cd ubiq-ruby
|
34
|
-
|
34
|
+
bundle install
|
35
|
+
gem build ubiq-security.gemspec
|
36
|
+
gem install ./ubiq-security*.gem
|
35
37
|
```
|
38
|
+
You may need to run the `gem install` commands above using sudo.
|
36
39
|
|
37
40
|
|
38
41
|
## Usage
|
@@ -78,12 +81,11 @@ credentials = Credentials(access_key_id = "...", secret_signing_key = "...", sec
|
|
78
81
|
|
79
82
|
### Encrypt a simple block of data
|
80
83
|
|
81
|
-
Pass credentials and data into the encryption function. The encrypted data
|
82
|
-
will be returned.
|
84
|
+
Pass credentials and data into the encryption function. The encrypted data will be returned.
|
83
85
|
|
84
86
|
|
85
87
|
```ruby
|
86
|
-
require
|
88
|
+
require 'ubiq-security'
|
87
89
|
include Ubiq
|
88
90
|
|
89
91
|
encrypted_data = encrypt(credentials, plaintext_data)
|
@@ -92,11 +94,10 @@ encrypted_data = encrypt(credentials, plaintext_data)
|
|
92
94
|
|
93
95
|
### Decrypt a simple block of data
|
94
96
|
|
95
|
-
Pass credentials and encrypted data into the decryption function. The plaintext data
|
96
|
-
will be returned.
|
97
|
+
Pass credentials and encrypted data into the decryption function. The plaintext data will be returned.
|
97
98
|
|
98
99
|
```ruby
|
99
|
-
require
|
100
|
+
require 'ubiq-security'
|
100
101
|
include Ubiq
|
101
102
|
|
102
103
|
plaintext_data = decrypt(credentials, encrypted_data)
|
@@ -113,7 +114,7 @@ plaintext_data = decrypt(credentials, encrypted_data)
|
|
113
114
|
|
114
115
|
|
115
116
|
```ruby
|
116
|
-
require
|
117
|
+
require 'ubiq-security'
|
117
118
|
include Ubiq
|
118
119
|
|
119
120
|
# Process 1 MiB of plaintext data at a time
|
@@ -129,7 +130,7 @@ BLOCK_SIZE = 1024 * 1024
|
|
129
130
|
# Loop until the end of the input file is reached
|
130
131
|
until infile.eof?
|
131
132
|
chunk = infile.read BLOCK_SIZE
|
132
|
-
encrypted_data += encryption.update(chunk)
|
133
|
+
encrypted_data += encryption.update(chunk)
|
133
134
|
end
|
134
135
|
# Make sure any additional encrypted data is retrieved from encryption instance
|
135
136
|
encrypted_data += encryption.end()
|
@@ -148,7 +149,7 @@ BLOCK_SIZE = 1024 * 1024
|
|
148
149
|
|
149
150
|
|
150
151
|
```ruby
|
151
|
-
require
|
152
|
+
require 'ubiq-security'
|
152
153
|
include Ubiq
|
153
154
|
|
154
155
|
# Process 1 MiB of encrypted data at a time
|
@@ -160,7 +161,7 @@ BLOCK_SIZE = 1024 * 1024
|
|
160
161
|
decryption = Decryption(credentials)
|
161
162
|
|
162
163
|
# Start the decryption and get any header information
|
163
|
-
plaintext_data = decryption.begin()
|
164
|
+
plaintext_data = decryption.begin()
|
164
165
|
|
165
166
|
# Loop until the end of the input file is reached
|
166
167
|
until infile.eof?
|
@@ -181,8 +182,8 @@ BLOCK_SIZE = 1024 * 1024
|
|
181
182
|
[bundler]: https://bundler.io
|
182
183
|
[rubygems]: https://rubygems.org
|
183
184
|
[gem]: https://rubygems.org/gems/uniq-security
|
184
|
-
[dashboard]:https://
|
185
|
+
[dashboard]:https://dashboard.ubiqsecurity.com/
|
185
186
|
[credentials]:https://dev.ubiqsecurity.com/docs/how-to-create-api-keys
|
186
|
-
|
187
|
+
[apidocs]:https://dev.ubiqsecurity.com/docs/api
|
187
188
|
|
188
189
|
|
data/lib/ubiq-security.rb
CHANGED
@@ -13,10 +13,9 @@
|
|
13
13
|
#
|
14
14
|
# https://ubiqsecurity.com/legal
|
15
15
|
|
16
|
-
|
17
|
-
require "ubiq/encrypt"
|
18
|
-
require "ubiq/decrypt"
|
19
|
-
require "ubiq/credentials"
|
20
|
-
|
21
|
-
|
16
|
+
# frozen_string_literal: true
|
22
17
|
|
18
|
+
require 'ubiq/version'
|
19
|
+
require 'ubiq/encrypt'
|
20
|
+
require 'ubiq/decrypt'
|
21
|
+
require 'ubiq/credentials'
|
data/lib/ubiq/algo.rb
CHANGED
@@ -14,56 +14,81 @@
|
|
14
14
|
# https://ubiqsecurity.com/legal
|
15
15
|
#
|
16
16
|
|
17
|
-
|
17
|
+
# frozen_string_literal: true
|
18
|
+
|
19
|
+
require 'active_support/all'
|
18
20
|
require 'openssl'
|
19
21
|
|
20
22
|
module Ubiq
|
23
|
+
# Class to provide some basic information mapping between an
|
24
|
+
# encryption algorithm name and the cooresponding
|
25
|
+
# key size, initialization vector length, and tag
|
21
26
|
|
22
|
-
class Algo
|
27
|
+
class Algo
|
23
28
|
|
24
|
-
|
25
|
-
@algorithm = {
|
26
|
-
"aes-256-gcm"=>{
|
27
|
-
id:0,
|
28
|
-
algorithm: OpenSSL::Cipher::AES256,
|
29
|
-
mode: OpenSSL::Cipher::AES256.new(:GCM),
|
30
|
-
key_length: 32,
|
31
|
-
iv_length: 12,
|
32
|
-
tag_length: 16
|
33
|
-
},
|
34
|
-
}
|
35
|
-
end
|
29
|
+
UBIQ_HEADER_V0_FLAG_AAD = 0b00000001
|
36
30
|
|
37
|
-
|
38
|
-
|
39
|
-
|
31
|
+
def set_algo
|
32
|
+
@algorithm = {
|
33
|
+
'aes-256-gcm' => {
|
34
|
+
id: 0,
|
35
|
+
algorithm: OpenSSL::Cipher::AES256,
|
36
|
+
mode: OpenSSL::Cipher::AES256.new(:GCM),
|
37
|
+
key_length: 32,
|
38
|
+
iv_length: 12,
|
39
|
+
tag_length: 16
|
40
|
+
},
|
41
|
+
'aes-128-gcm' => {
|
42
|
+
id: 1,
|
43
|
+
algorithm: OpenSSL::Cipher::AES128,
|
44
|
+
mode: OpenSSL::Cipher::AES128.new(:GCM),
|
45
|
+
key_length: 16,
|
46
|
+
iv_length: 12,
|
47
|
+
tag_length: 16
|
48
|
+
}
|
49
|
+
}
|
50
|
+
end
|
40
51
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
52
|
+
def find_alg(id)
|
53
|
+
set_algo.each do |k,v|
|
54
|
+
if v[:id] == id
|
55
|
+
return k
|
56
|
+
end
|
57
|
+
end
|
58
|
+
"unknown"
|
59
|
+
end
|
60
|
+
|
61
|
+
def get_algo(name)
|
62
|
+
set_algo[name]
|
63
|
+
end
|
46
64
|
|
47
|
-
|
48
|
-
|
65
|
+
def encryptor(obj, key, iv = nil)
|
66
|
+
# key : A byte string containing the key to be used with this encryption
|
67
|
+
# If the caller specifies the initialization vector, it must be
|
68
|
+
# the correct length and, if so, will be used. If it is not
|
69
|
+
# specified, the function will generate a new one
|
49
70
|
|
50
|
-
|
51
|
-
cipher.encrypt
|
52
|
-
cipher.key = key
|
53
|
-
iv = cipher.random_iv
|
54
|
-
return cipher, iv
|
55
|
-
end
|
71
|
+
raise RuntimeError, 'Invalid key length' if key.length != obj[:key_length]
|
56
72
|
|
57
|
-
|
58
|
-
cipher = obj[:mode]
|
59
|
-
raise RuntimeError, 'Invalid key length' if key.length != obj[:key_length]
|
73
|
+
raise RuntimeError, 'Invalid initialization vector length' if !iv.nil? && iv.length != obj[:iv_length]
|
60
74
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
75
|
+
cipher = obj[:mode]
|
76
|
+
cipher.encrypt
|
77
|
+
cipher.key = key
|
78
|
+
iv = cipher.random_iv
|
79
|
+
return cipher, iv
|
80
|
+
end
|
81
|
+
|
82
|
+
def decryptor(obj, key, iv)
|
83
|
+
raise RuntimeError, 'Invalid key length' if key.length != obj[:key_length]
|
84
|
+
|
85
|
+
raise RuntimeError, 'Invalid initialization vector length' if !iv.nil? && iv.length != obj[:iv_length]
|
86
|
+
|
87
|
+
cipher = obj[:mode]
|
88
|
+
cipher.decrypt
|
89
|
+
cipher.key = key
|
90
|
+
cipher.iv = iv
|
91
|
+
return cipher
|
92
|
+
end
|
67
93
|
end
|
68
94
|
end
|
69
|
-
end
|
data/lib/ubiq/auth.rb
CHANGED
@@ -13,87 +13,93 @@
|
|
13
13
|
#
|
14
14
|
# https://ubiqsecurity.com/legal
|
15
15
|
#
|
16
|
-
require "active_support/all"
|
17
16
|
|
18
|
-
|
17
|
+
# frozen_string_literal: true
|
18
|
+
|
19
|
+
require 'active_support/all'
|
19
20
|
|
20
|
-
|
21
|
+
module Ubiq
|
21
22
|
# HTTP Authentication for the Ubiq Platform
|
22
23
|
|
23
24
|
# This module implements HTTP authentication for the Ubiq platform
|
24
25
|
# via message signing as described by the IETF httpbis-message-signatures
|
25
26
|
# draft specification.
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
27
|
+
class Auth
|
28
|
+
def self.build_headers(papi, sapi, endpoint, query, host, http_method)
|
29
|
+
|
30
|
+
# This function calculates the signature for the message, adding the Signature header
|
31
|
+
# to contain the data. Certain HTTP headers are required for
|
32
|
+
# signature calculation and will be added by this code as
|
33
|
+
# necessary. The constructed headers object is returned
|
34
|
+
|
35
|
+
# the '(request-target)' is part of the signed data.
|
36
|
+
# it's value is 'http_method path?query'
|
37
|
+
reqt = "#{http_method} #{endpoint}"
|
38
|
+
|
39
|
+
# The time at which the signature was created expressed as the unix epoch
|
40
|
+
created = Time.now.to_i
|
41
|
+
|
42
|
+
# the Digest header is always included/overridden by
|
43
|
+
# this code. it is a hash of the body of the http message
|
44
|
+
# and is always present even if the body is empty
|
45
|
+
hash_sha512 = OpenSSL::Digest::SHA512.new
|
46
|
+
hash_sha512 << JSON.dump(query)
|
47
|
+
digest = 'SHA-512=' + Base64.strict_encode64(hash_sha512.digest)
|
48
|
+
|
49
|
+
# Initialize the headers object to be returned via this method
|
50
|
+
all_headers = {}
|
51
|
+
all_headers['user-agent'] = 'ubiq-ruby/' + Ubiq::VERSION
|
52
|
+
# The content type of request
|
53
|
+
all_headers['content-type'] = 'application/json'
|
54
|
+
# The request target calculated above(reqt)
|
55
|
+
all_headers['(request-target)'] = reqt
|
56
|
+
# The date and time in GMT format
|
57
|
+
all_headers['date'] = get_date
|
58
|
+
# The host specified by the caller
|
59
|
+
all_headers['host'] = get_host(host)
|
60
|
+
all_headers['(created)'] = created
|
61
|
+
all_headers['digest'] = digest
|
62
|
+
headers = ['content-type', 'date', 'host', '(created)', '(request-target)', 'digest']
|
63
|
+
|
64
|
+
# include the specified headers in the hmac calculation. each
|
65
|
+
# header is of the form 'header_name: header value\n'
|
66
|
+
# included headers are also added to an ordered list of headers
|
67
|
+
# which is included in the message
|
68
|
+
hmac = OpenSSL::HMAC.new(sapi, OpenSSL::Digest::SHA512.new)
|
69
|
+
headers.each do |header|
|
70
|
+
if all_headers.key?(header)
|
71
|
+
hmac << "#{header}: #{all_headers[header]}\n"
|
72
|
+
end
|
70
73
|
end
|
71
|
-
end
|
72
|
-
|
73
|
-
all_headers.delete('(created)')
|
74
|
-
all_headers.delete('(request-target)')
|
75
|
-
all_headers.delete('host')
|
76
|
-
|
77
|
-
# Build the Signature header itself
|
78
|
-
all_headers['signature'] = 'keyId="' + papi + '"'
|
79
|
-
all_headers['signature'] += ', algorithm="hmac-sha512"'
|
80
|
-
all_headers['signature'] += ', created=' + created.to_s
|
81
|
-
all_headers['signature'] += ', headers="' + headers.join(" ") + '"'
|
82
|
-
all_headers['signature'] += ', signature="'
|
83
|
-
all_headers['signature'] += Base64.strict_encode64(hmac.digest)
|
84
|
-
all_headers['signature'] += '"'
|
85
74
|
|
86
|
-
|
87
|
-
|
75
|
+
all_headers.delete('(created)')
|
76
|
+
all_headers.delete('(request-target)')
|
77
|
+
all_headers.delete('host')
|
78
|
+
|
79
|
+
# Build the Signature header itself
|
80
|
+
all_headers['signature'] = 'keyId="' + papi + '"'
|
81
|
+
all_headers['signature'] += ', algorithm="hmac-sha512"'
|
82
|
+
all_headers['signature'] += ', created=' + created.to_s
|
83
|
+
all_headers['signature'] += ', headers="' + headers.join(' ') + '"'
|
84
|
+
all_headers['signature'] += ', signature="'
|
85
|
+
all_headers['signature'] += Base64.strict_encode64(hmac.digest)
|
86
|
+
all_headers['signature'] += '"'
|
87
|
+
|
88
|
+
return all_headers
|
89
|
+
end
|
88
90
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
91
|
+
# Only want to return port in the URI if the
|
92
|
+
# host contained one, otherwise let gateway resolve it
|
93
|
+
def self.get_host(host)
|
94
|
+
uri = URI(host)
|
95
|
+
ret = uri.hostname.to_s
|
96
|
+
ret += ":#{uri.port}" if host.match(/:[0-9]+/)
|
97
|
+
ret
|
98
|
+
end
|
93
99
|
|
94
|
-
|
95
|
-
|
100
|
+
def self.get_date
|
101
|
+
DateTime.now.in_time_zone('GMT').strftime('%a, %d %b %Y') + ' ' +
|
102
|
+
DateTime.now.in_time_zone('GMT').strftime('%H:%M:%S') + ' GMT'
|
103
|
+
end
|
96
104
|
end
|
97
|
-
|
98
|
-
end
|
99
105
|
end
|
data/lib/ubiq/credentials.rb
CHANGED
@@ -13,93 +13,109 @@
|
|
13
13
|
#
|
14
14
|
# https://ubiqsecurity.com/legal
|
15
15
|
#
|
16
|
+
|
17
|
+
# frozen_string_literal: true
|
18
|
+
|
16
19
|
require 'configparser'
|
17
20
|
require 'rb-readline'
|
18
21
|
require 'byebug'
|
22
|
+
require_relative './host.rb'
|
19
23
|
|
20
|
-
module Ubiq
|
21
24
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
module Ubiq
|
26
|
+
# Access Credentials used by the library to validate service calls
|
27
|
+
class CredentialsInfo
|
28
|
+
def initialize(access_key_id, secret_signing_key, secret_crypto_access_key, host)
|
29
|
+
@access_key_id = access_key_id
|
30
|
+
@secret_signing_key = secret_signing_key
|
31
|
+
@secret_crypto_access_key = secret_crypto_access_key
|
32
|
+
@host = host
|
33
|
+
end
|
30
34
|
|
31
|
-
|
32
|
-
|
35
|
+
def set_attributes
|
36
|
+
return OpenStruct.new(
|
37
|
+
access_key_id: @access_key_id,
|
38
|
+
secret_signing_key: @secret_signing_key,
|
39
|
+
secret_crypto_access_key: @secret_crypto_access_key,
|
40
|
+
host: @host
|
41
|
+
)
|
42
|
+
end
|
33
43
|
end
|
34
|
-
end
|
35
|
-
|
36
44
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
45
|
+
# Class to load a credentials file or the default
|
46
|
+
# and read the credentials from either a supplied
|
47
|
+
# profile or use the default
|
48
|
+
class ConfigCredentials < CredentialsInfo
|
49
|
+
def initialize(config_file, profile)
|
50
|
+
# If config file is not found
|
51
|
+
if !config_file.nil? && !File.exist?(config_file)
|
52
|
+
raise RuntimeError, "Unable to open config file #{config_file} or contains missing values"
|
53
|
+
end
|
54
|
+
|
55
|
+
if config_file.nil?
|
56
|
+
config_file = '~/.ubiq/credentials'
|
57
|
+
end
|
58
|
+
|
59
|
+
# If config file is found
|
60
|
+
if File.exist?(File.expand_path(config_file))
|
61
|
+
@creds = load_config_file(config_file, profile)
|
62
|
+
end
|
42
63
|
end
|
43
64
|
|
44
|
-
|
45
|
-
|
65
|
+
def get_attributes
|
66
|
+
return @creds
|
46
67
|
end
|
47
68
|
|
48
|
-
|
49
|
-
|
50
|
-
@creds = load_config_file(config_file, profile)
|
51
|
-
end
|
52
|
-
end
|
69
|
+
def load_config_file(file, profile)
|
70
|
+
config = ConfigParser.new(File.expand_path(file))
|
53
71
|
|
54
|
-
|
55
|
-
|
56
|
-
|
72
|
+
# Create empty dictionaries for the default and supplied profile
|
73
|
+
p = {}
|
74
|
+
d = {}
|
57
75
|
|
58
|
-
|
59
|
-
|
76
|
+
# get the default profile if there is one
|
77
|
+
if config['default'].present?
|
78
|
+
d = config['default']
|
79
|
+
end
|
60
80
|
|
61
|
-
|
62
|
-
|
63
|
-
|
81
|
+
if !d.key?('SERVER')
|
82
|
+
d['SERVER'] = Ubiq::UBIQ_HOST
|
83
|
+
end
|
64
84
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
85
|
+
# get the supplied profile if there is one
|
86
|
+
if config[profile].present?
|
87
|
+
p = config[profile]
|
88
|
+
end
|
69
89
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
90
|
+
# Use given profile if it is available, otherwise use default.
|
91
|
+
access_key_id = p.key?('ACCESS_KEY_ID') ? p['ACCESS_KEY_ID'] : d['ACCESS_KEY_ID']
|
92
|
+
secret_signing_key = p.key?('SECRET_SIGNING_KEY') ? p['SECRET_SIGNING_KEY'] : d['SECRET_SIGNING_KEY']
|
93
|
+
secret_crypto_access_key = p.key?('SECRET_CRYPTO_ACCESS_KEY') ? p['SECRET_CRYPTO_ACCESS_KEY'] : d['SECRET_CRYPTO_ACCESS_KEY']
|
94
|
+
host = p.key?('SERVER') ? p['SERVER'] : d['SERVER']
|
74
95
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
host = p.key?('SERVER') ? p['SERVER'] : d['SERVER']
|
96
|
+
# If the provided host does not contain http protocol then add to it
|
97
|
+
if !host.include?('http://') && !host.include?('https://')
|
98
|
+
host = 'https://' + host
|
99
|
+
end
|
80
100
|
|
81
|
-
|
82
|
-
if !host.include?('http://') and !host.include?('https://')
|
83
|
-
host = 'https://' + host
|
101
|
+
return CredentialsInfo.new(access_key_id, secret_signing_key, secret_crypto_access_key, host).set_attributes
|
84
102
|
end
|
85
|
-
|
86
|
-
return CredentialsInfo.new(access_key_id, secret_signing_key, secret_crypto_access_key, host).set_attributes
|
87
103
|
end
|
88
|
-
end
|
89
104
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
105
|
+
# Class where the credentials can be explicitly set or
|
106
|
+
# will use the Environment variables instead
|
107
|
+
class Credentials < CredentialsInfo
|
108
|
+
def initialize(papi, sapi, srsa, host)
|
109
|
+
@access_key_id = papi.present? ? papi : ENV['UBIQ_ACCESS_KEY_ID']
|
110
|
+
@secret_signing_key = sapi.present? ? sapi : ENV['UBIQ_SECRET_SIGNING_KEY']
|
111
|
+
@secret_crypto_access_key = srsa.present? ? srsa : ENV['UBIQ_SECRET_CRYPTO_ACCESS_KEY']
|
112
|
+
@host = host.present? ? host : ENV['UBIQ_SERVER']
|
113
|
+
end
|
98
114
|
|
99
|
-
|
115
|
+
@creds = CredentialsInfo.new(@access_key_id, @secret_signing_key, @secret_crypto_access_key, @host).set_attributes
|
100
116
|
|
101
|
-
|
102
|
-
|
117
|
+
def get_attributes
|
118
|
+
return @creds
|
119
|
+
end
|
103
120
|
end
|
104
121
|
end
|
105
|
-
end
|