Sha256: e6f83922db306ee586db9cb889fd69b2c89c75cb7d6d8187f3b99d819a501791

Contents?: true

Size: 527 Bytes

Versions: 4

Compression:

Stored size: 527 Bytes

Contents

# frozen_string_literal: true

module Xml
  module Kit
    module Crypto
      class RsaCipher
        ALGORITHM = "#{::Xml::Kit::Namespaces::XMLENC}rsa-1_5".freeze

        def initialize(_algorithm, key)
          @key = key
        end

        def self.matches?(algorithm)
          ALGORITHM == algorithm
        end

        def encrypt(plain_text)
          @key.public_encrypt(plain_text)
        end

        def decrypt(cipher_text)
          @key.private_decrypt(cipher_text)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
xml-kit-0.2.0 lib/xml/kit/crypto/rsa_cipher.rb
xml-kit-0.1.14 lib/xml/kit/crypto/rsa_cipher.rb
xml-kit-0.1.13 lib/xml/kit/crypto/rsa_cipher.rb
xml-kit-0.1.12 lib/xml/kit/crypto/rsa_cipher.rb