Sha256: 7cc21bf064d0256c04c63d3bbcdca02e89ded24df11b93c30593ca62557e6c2b

Contents?: true

Size: 419 Bytes

Versions: 2

Compression:

Stored size: 419 Bytes

Contents

module JWE
  module Alg
    # RSA-OAEP key encryption algorithm.
    class RsaOaep
      attr_accessor :key

      def initialize(key)
        self.key = key
      end

      def encrypt(cek)
        key.public_encrypt(cek, OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING)
      end

      def decrypt(encrypted_cek)
        key.private_decrypt(encrypted_cek, OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jwe-0.4.0 lib/jwe/alg/rsa_oaep.rb
jwe-0.3.1 lib/jwe/alg/rsa_oaep.rb