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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20d4dacbe17d8162ab7d308069b82e2b54b89cf7a7253763919742ef350597e3
4
- data.tar.gz: 370015b19528bc6a81678e3b0f7f270b0524b6309f23dc6087d04256edad1e27
3
+ metadata.gz: 729b8860bf9bec12fd7185973e265accb516232460ee85dcf862a556d7008c53
4
+ data.tar.gz: 1b93971fda83f73f28e74adda5ae631c86f7fc826ae31f786f5e716f726351aa
5
5
  SHA512:
6
- metadata.gz: 7ed8203d50dbe828d649af7decc40f300f1b2b5d74e912db9119e84444c840dc45a8fcc1c8e0b3fa49a8d7a6ebf73fbb9ce935e7244c1669d9d072af61674c52
7
- data.tar.gz: ddd4e2690d2d47a737fda60d53524d9b57eec456410f14f5e4a56cb61e447e632f6c7a70bc0cc2dfc5126b95191df739dd6484089e07e6126f2d848989b28841
6
+ metadata.gz: fd5b18aaf1ede170f03511a2352bf324a9cbe137507eca720c2fe0b00c8e25124a7dc963ba583621d16911a15bc42b988d2f650cf6edcbb252dc34aeb2b7a614
7
+ data.tar.gz: 3a083c6fe5d1e1f29102adf845a0356ef0f4951f592a49d627bf381c360789fd7d43c9f5dd819cd0e63ec21a271e8586e8100c9e1bb556772bb8780c59d310ad
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ ## 1.0.5 - 2020-09-23
4
+ * Remove dead code
5
+ * Pass client library name and version to server
6
+ * Added AAD information to ciphers for encrypt and decrypy
7
+
8
+ ## 1.0.1 - 2020-08-20
9
+ * Initial Version
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](https://ubiqsecurity.com/docs/api?lang=ruby).
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
- rake install:local
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 "ubiq-security"
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 "ubiq-security"
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 "ubiq-security"
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 "ubiq-security"
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://dev.ubiqsecurity.com/docs/dashboard
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
 
@@ -13,10 +13,9 @@
13
13
  #
14
14
  # https://ubiqsecurity.com/legal
15
15
 
16
- require "ubiq/version"
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'
@@ -14,56 +14,81 @@
14
14
  # https://ubiqsecurity.com/legal
15
15
  #
16
16
 
17
- require "active_support/all"
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
- def set_algo
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
- def get_algo(name)
38
- set_algo[name]
39
- end
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
- def encryptor(obj,key, iv=nil)
42
- # key : A byte string containing the key to be used with this encryption
43
- # If the caller specifies the initialization vector, it must be
44
- # the correct length and, if so, will be used. If it is not
45
- # specified, the function will generate a new one
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
- cipher = obj[:mode]
48
- raise RuntimeError, 'Invalid key length' if key.length != obj[:key_length]
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
- raise RuntimeError, 'Invalid initialization vector length' if (iv!= nil and iv.length != obj[:iv_length])
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
- def decryptor(obj, key, iv)
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
- raise RuntimeError, 'Invalid initialization vector length' if (iv!= nil and iv.length != obj[:iv_length])
62
- cipher = obj[:mode]
63
- cipher.decrypt
64
- cipher.key = key
65
- cipher.iv = iv
66
- return cipher
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
@@ -13,87 +13,93 @@
13
13
  #
14
14
  # https://ubiqsecurity.com/legal
15
15
  #
16
- require "active_support/all"
17
16
 
18
- module Ubiq
17
+ # frozen_string_literal: true
18
+
19
+ require 'active_support/all'
19
20
 
20
- class Auth
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
- def self.build_headers(papi, sapi, endpoint, query, host, http_method)
28
-
29
- # This function calculates the signature for the message, adding the Signature header
30
- # to contain the data. Certain HTTP headers are required for
31
- # signature calculation and will be added by this code as
32
- # necessary. The constructed headers object is returned
33
-
34
- # the '(request-target)' is part of the signed data.
35
- # it's value is 'http_method path?query'
36
- reqt = "#{http_method} #{endpoint}"
37
-
38
- # The time at which the signature was created expressed as the unix epoch
39
- created = Time.now.to_i
40
-
41
- # the Digest header is always included/overridden by
42
- # this code. it is a hash of the body of the http message
43
- # and is always present even if the body is empty
44
- hash_sha512 = OpenSSL::Digest::SHA512.new
45
- hash_sha512 << JSON.dump(query)
46
- digest = 'SHA-512='+Base64.strict_encode64(hash_sha512.digest)
47
-
48
- # Initialize the headers object to be returned via this method
49
- all_headers = {}
50
- # The content type of request
51
- all_headers['content-type'] = 'application/json'
52
- # The request target calculated above(reqt)
53
- all_headers['(request-target)'] = reqt
54
- # The date and time in GMT format
55
- all_headers['date'] = get_date
56
- # The host specified by the caller
57
- all_headers['host'] = get_host(host)
58
- all_headers['(created)'] = created
59
- all_headers['digest'] = digest
60
- headers = ['content-type', 'date', 'host', '(created)', '(request-target)', 'digest']
61
-
62
- # include the specified headers in the hmac calculation. each
63
- # header is of the form 'header_name: header value\n'
64
- # included headers are also added to an ordered list of headers
65
- # which is included in the message
66
- hmac = OpenSSL::HMAC.new(sapi, OpenSSL::Digest::SHA512.new)
67
- headers.each do |header|
68
- if all_headers.key?(header)
69
- hmac << "#{header}: #{all_headers[header]}\n"
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
- return all_headers
87
- end
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
- def self.get_host(host)
90
- uri = URI(host)
91
- return "#{uri.hostname}:#{uri.port}"
92
- end
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
- def self.get_date
95
- DateTime.now.in_time_zone('GMT').strftime("%a, %d %b %Y") + " " + DateTime.now.in_time_zone('GMT').strftime("%H:%M:%S") + " GMT"
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
@@ -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
- class CredentialsInfo
23
-
24
- def initialize(access_key_id, secret_signing_key, secret_crypto_access_key, host)
25
- @access_key_id = access_key_id
26
- @secret_signing_key = secret_signing_key
27
- @secret_crypto_access_key = secret_crypto_access_key
28
- @host = host
29
- end
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
- def set_attributes
32
- return OpenStruct.new(access_key_id: @access_key_id, secret_signing_key: @secret_signing_key, secret_crypto_access_key: @secret_crypto_access_key, host: @host)
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
- class ConfigCredentials < CredentialsInfo
38
- def initialize(config_file, profile)
39
- # If config file is not found
40
- if config_file != nil and !File.exists?(config_file)
41
- raise RuntimeError, "Unable to open config file #{config_file} or contains missing values"
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
- if config_file == nil
45
- config_file = "~/.ubiq/credentials"
65
+ def get_attributes
66
+ return @creds
46
67
  end
47
68
 
48
- # If config file is found
49
- if File.exists?(File.expand_path(config_file))
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
- def get_attributes
55
- return @creds
56
- end
72
+ # Create empty dictionaries for the default and supplied profile
73
+ p = {}
74
+ d = {}
57
75
 
58
- def load_config_file(file, profile)
59
- config = ConfigParser.new(File.expand_path(file))
76
+ # get the default profile if there is one
77
+ if config['default'].present?
78
+ d = config['default']
79
+ end
60
80
 
61
- # Create empty dictionaries for the default and supplied profile
62
- p = {}
63
- d = {}
81
+ if !d.key?('SERVER')
82
+ d['SERVER'] = Ubiq::UBIQ_HOST
83
+ end
64
84
 
65
- # get the default profile if there is one
66
- if config['default'].present?
67
- d = config['default']
68
- end
85
+ # get the supplied profile if there is one
86
+ if config[profile].present?
87
+ p = config[profile]
88
+ end
69
89
 
70
- # get the supplied profile if there is one
71
- if config[profile].present?
72
- p = config[profile]
73
- end
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
- # Use given profile if it is available, otherwise use default.
76
- access_key_id = p.key?('ACCESS_KEY_ID') ? p['ACCESS_KEY_ID'] : d['ACCESS_KEY_ID']
77
- secret_signing_key = p.key?('SECRET_SIGNING_KEY') ? p['SECRET_SIGNING_KEY'] : d['SECRET_SIGNING_KEY']
78
- secret_crypto_access_key = p.key?('SECRET_CRYPTO_ACCESS_KEY') ? p['SECRET_CRYPTO_ACCESS_KEY'] : d['SECRET_CRYPTO_ACCESS_KEY']
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
- # If the provided host does not contain http protocol then add to it
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
- class Credentials < CredentialsInfo
91
-
92
- def initialize(papi, sapi, srsa, host)
93
- @access_key_id = papi.present? ? papi : ENV['UBIQ_ACCESS_KEY_ID']
94
- @secret_signing_key = sapi.present? ? sapi : ENV['UBIQ_SECRET_SIGNING_KEY']
95
- @secret_crypto_access_key = srsa.present? ? srsa : ENV['UBIQ_SECRET_CRYPTO_ACCESS_KEY']
96
- @host = host.present? ? host : ENV['UBIQ_SERVER']
97
- end
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
- @creds = CredentialsInfo.new(@access_key_id, @secret_signing_key, @secret_crypto_access_key, @host).set_attributes
115
+ @creds = CredentialsInfo.new(@access_key_id, @secret_signing_key, @secret_crypto_access_key, @host).set_attributes
100
116
 
101
- def get_attributes
102
- return @creds
117
+ def get_attributes
118
+ return @creds
119
+ end
103
120
  end
104
121
  end
105
- end