Class: SyrupPay::Jwa::ContentEncryption

Inherits:
Object
  • Object
show all
Includes:
RandomKeyGen
Defined in:
lib/jose/jwa/enc/content_encryption.rb

Direct Known Subclasses

A128CbcHmac256Encryption

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RandomKeyGen

#randomKey

Constructor Details

#initialize(key_length, iv_length) ⇒ ContentEncryption

Returns a new instance of ContentEncryption.



7
8
9
10
# File 'lib/jose/jwa/enc/content_encryption.rb', line 7

def initialize(key_length, iv_length)
  @key_length = key_length
  @iv_length = iv_length
end

Instance Attribute Details

#iv_lengthObject (readonly)

Returns the value of attribute iv_length.



5
6
7
# File 'lib/jose/jwa/enc/content_encryption.rb', line 5

def iv_length
  @iv_length
end

#key_lengthObject (readonly)

Returns the value of attribute key_length.



5
6
7
# File 'lib/jose/jwa/enc/content_encryption.rb', line 5

def key_length
  @key_length
end

Instance Method Details

#content_encryption_generatorObject



16
17
18
# File 'lib/jose/jwa/enc/content_encryption.rb', line 16

def content_encryption_generator
  SyrupPay::Jwa::ContentEncryptionKeyGenerator.new(@key_length)
end

#generate_random_ivObject



12
13
14
# File 'lib/jose/jwa/enc/content_encryption.rb', line 12

def generate_random_iv
  randomKey(@iv_length/2)
end