Module: Ubiq

Defined in:
lib/ubiq/decrypt.rb,
lib/ubiq/algo.rb,
lib/ubiq/auth.rb,
lib/ubiq/host.rb,
lib/ubiq/encrypt.rb,
lib/ubiq/version.rb,
lib/ubiq/credentials.rb

Overview

Ubiq Security Modules for encrypting / decrypting data

Defined Under Namespace

Classes: Algo, Auth, ConfigCredentials, Credentials, CredentialsInfo, Decryption, Encryption

Constant Summary collapse

UBIQ_HOST =
'api.ubiqsecurity.com'
VERSION =
'1.0.7'

Instance Method Summary collapse

Instance Method Details

#decrypt(creds, data) ⇒ Object



260
261
262
263
264
265
266
267
268
269
270
# File 'lib/ubiq/decrypt.rb', line 260

def decrypt(creds, data)
  begin
    dec = Decryption.new(creds)
    res = dec.begin + dec.update(data) + dec.end
    dec.close
  rescue StandardError
    dec&.close
    raise
  end
  return res
end

#encrypt(creds, data) ⇒ Object



190
191
192
193
194
195
196
197
198
199
200
# File 'lib/ubiq/encrypt.rb', line 190

def encrypt(creds, data)
  begin
    enc = Encryption.new(creds, 1)
    res = enc.begin + enc.update(data) + enc.end
    enc.close
  rescue StandardError
    enc&.close
    raise
  end
  return res
end

#validate_creds(credentials) ⇒ Object



183
184
185
186
187
188
# File 'lib/ubiq/encrypt.rb', line 183

def validate_creds(credentials)
  # This method checks for the presence of the credentials
  !credentials.access_key_id.blank? &&
    !credentials.secret_signing_key.blank? &&
    !credentials.secret_crypto_access_key.blank?
end