Class: JWE::Alg::RsaOaep256

Inherits:
Object
  • Object
show all
Defined in:
lib/jwe/alg/rsa_oaep_256.rb

Overview

RSA-OAEP-256 key encryption algorithm.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key) ⇒ RsaOaep256

Returns a new instance of RsaOaep256.



9
10
11
# File 'lib/jwe/alg/rsa_oaep_256.rb', line 9

def initialize(key)
  self.key = key
end

Instance Attribute Details

#keyObject

Returns the value of attribute key.



7
8
9
# File 'lib/jwe/alg/rsa_oaep_256.rb', line 7

def key
  @key
end

Instance Method Details

#decrypt(encrypted_cek) ⇒ Object



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

def decrypt(encrypted_cek)
  key.decrypt(encrypted_cek, { rsa_padding_mode: 'oaep', rsa_oaep_md: 'sha256' })
end

#encrypt(cek) ⇒ Object



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

def encrypt(cek)
  key.encrypt(cek, { rsa_padding_mode: 'oaep', rsa_oaep_md: 'sha256' })
end