Module: JWE::Enc

Defined in:
lib/jwe/enc.rb,
lib/jwe/enc/cipher.rb,
lib/jwe/enc/a128gcm.rb,
lib/jwe/enc/a192gcm.rb,
lib/jwe/enc/a256gcm.rb,
lib/jwe/enc/aes_gcm.rb,
lib/jwe/enc/aes_cbc_hs.rb,
lib/jwe/enc/a128cbc_hs256.rb,
lib/jwe/enc/a192cbc_hs384.rb,
lib/jwe/enc/a256cbc_hs512.rb

Overview

Content encryption algorithms namespace

Defined Under Namespace

Modules: AesCbcHs, AesGcm, Cipher Classes: A128cbcHs256, A128gcm, A192cbcHs384, A192gcm, A256cbcHs512, A256gcm

Class Method Summary collapse

Class Method Details

.for(enc, cek = nil, iv = nil, tag = nil) ⇒ Object


11
12
13
14
15
16
17
18
# File 'lib/jwe/enc.rb', line 11

def self.for(enc, cek = nil, iv = nil, tag = nil)
  klass = const_get(JWE.param_to_class_name(enc))
  inst = klass.new(cek, iv)
  inst.tag = tag if tag
  inst
rescue NameError
  raise NotImplementedError.new("Unsupported enc type: #{enc}")
end