Module: JWE::Alg

Defined in:
lib/jwe/alg.rb,
lib/jwe/alg/dir.rb,
lib/jwe/alg/rsa15.rb,
lib/jwe/alg/aes_kw.rb,
lib/jwe/alg/a128_kw.rb,
lib/jwe/alg/a192_kw.rb,
lib/jwe/alg/a256_kw.rb,
lib/jwe/alg/rsa_oaep.rb

Overview

Key encryption algorithms namespace

Defined Under Namespace

Modules: AesKw Classes: A128kw, A192kw, A256kw, Dir, Rsa15, RsaOaep

Class Method Summary collapse

Class Method Details

.decrypt_cek(alg, key, encrypted_cek) ⇒ Object


21
22
23
# File 'lib/jwe/alg.rb', line 21

def self.decrypt_cek(alg, key, encrypted_cek)
  self.for(alg).new(key).decrypt(encrypted_cek)
end

.encrypt_cek(alg, key, cek) ⇒ Object


17
18
19
# File 'lib/jwe/alg.rb', line 17

def self.encrypt_cek(alg, key, cek)
  self.for(alg).new(key).encrypt(cek)
end

.for(alg) ⇒ Object


11
12
13
14
15
# File 'lib/jwe/alg.rb', line 11

def self.for(alg)
  const_get(JWE.param_to_class_name(alg))
rescue NameError
  raise NotImplementedError.new("Unsupported alg type: #{alg}")
end