Class: SyrupPay::Jwa::ContentEncryptionKeyGenerator
- Inherits:
-
Object
- Object
- SyrupPay::Jwa::ContentEncryptionKeyGenerator
- Includes:
- RandomKeyGen
- Defined in:
- lib/jose/jwa/enc/content_encryptionkey_generator.rb
Instance Attribute Summary collapse
-
#cek ⇒ Object
readonly
Returns the value of attribute cek.
-
#key_length ⇒ Object
readonly
Returns the value of attribute key_length.
Instance Method Summary collapse
- #generate_random_key ⇒ Object
-
#initialize(key_length) ⇒ ContentEncryptionKeyGenerator
constructor
A new instance of ContentEncryptionKeyGenerator.
- #user_encryption_key=(cek) ⇒ Object
Methods included from RandomKeyGen
Constructor Details
#initialize(key_length) ⇒ ContentEncryptionKeyGenerator
Returns a new instance of ContentEncryptionKeyGenerator.
15 16 17 |
# File 'lib/jose/jwa/enc/content_encryptionkey_generator.rb', line 15 def initialize(key_length) @key_length = key_length end |
Instance Attribute Details
#cek ⇒ Object (readonly)
Returns the value of attribute cek.
13 14 15 |
# File 'lib/jose/jwa/enc/content_encryptionkey_generator.rb', line 13 def cek @cek end |
#key_length ⇒ Object (readonly)
Returns the value of attribute key_length.
13 14 15 |
# File 'lib/jose/jwa/enc/content_encryptionkey_generator.rb', line 13 def key_length @key_length end |
Instance Method Details
#generate_random_key ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/jose/jwa/enc/content_encryptionkey_generator.rb', line 23 def generate_random_key if (@cek.nil?) @cek = randomKey(@key_length/2) end @cek end |
#user_encryption_key=(cek) ⇒ Object
19 20 21 |
# File 'lib/jose/jwa/enc/content_encryptionkey_generator.rb', line 19 def user_encryption_key=(cek) @cek = cek end |