Class: SecurityClient::Voltron
- Inherits:
-
Object
- Object
- SecurityClient::Voltron
- Defined in:
- lib/security_client.rb
Instance Method Summary collapse
- #decrypt(data:) ⇒ Object
- #encrypt(uses:, data:) ⇒ Object
- #get_attributes ⇒ Object
-
#initialize(access_key_id:, secret_signing_key:, secret_crypto_access_key:, host:) ⇒ Voltron
constructor
A new instance of Voltron.
Constructor Details
#initialize(access_key_id:, secret_signing_key:, secret_crypto_access_key:, host:) ⇒ Voltron
Returns a new instance of Voltron.
10 11 12 13 14 15 |
# File 'lib/security_client.rb', line 10 def initialize access_key_id:, secret_signing_key:, secret_crypto_access_key: , host: @access_key_id = access_key_id @secret_signing_key = secret_signing_key @secret_crypto_access_key = secret_crypto_access_key @host = host end |
Instance Method Details
#decrypt(data:) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/security_client.rb', line 34 def decrypt data: creds = self.get_attributes begin dec = Decryption.new(creds) res = dec.begin() + dec.update(data) + dec.end() dec.close() rescue dec.close() if dec raise end return res end |
#encrypt(uses:, data:) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/security_client.rb', line 21 def encrypt uses:, data: creds = self.get_attributes begin enc = SecurityClient::Encryption.new(creds, 1) res = enc.begin() + enc.update(data) + enc.end() enc.close() rescue enc.close() if enc raise end return res end |
#get_attributes ⇒ Object
17 18 19 |
# File 'lib/security_client.rb', line 17 def get_attributes 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) end |