Class: Pubnub::Crypto::EncryptedData

Inherits:
Object
  • Object
show all
Defined in:
lib/pubnub/modules/crypto/cryptor.rb

Overview

Encrypted data representation object.

Objects contain both encrypted data and additional data created by cryptor that will be required to decrypt the data.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, metadata = nil) ⇒ EncryptedData

Create encrypted data object.

An object used to keep track of the results of data encryption and the additional data the cryptor needs to handle it later.

Parameters:

  • data (String)

    Outcome of successful cryptor encrypt method call.

  • metadata (String, nil) (defaults to: nil)

    Additional information is provided by cryptor so that encrypted data can be handled later.



35
36
37
38
# File 'lib/pubnub/modules/crypto/cryptor.rb', line 35

def initialize(data,  = nil)
  @data = data
  @metadata = 
end

Instance Attribute Details

#dataString (readonly)

Encrypted data.

Returns:

  • (String)

    Encrypted data.



24
25
26
# File 'lib/pubnub/modules/crypto/cryptor.rb', line 24

def data
  @data
end

#metadataString? (readonly)

Cryptor may provide here any information which will be useful when data should be decrypted.

For example metadata may contain:

  • initialization vector
  • cipher key identifier
  • encrypted data length

Returns:

  • (String, nil)

    Cryptor-defined information.



19
20
21
# File 'lib/pubnub/modules/crypto/cryptor.rb', line 19

def 
  @metadata
end