main
1# frozen_string_literal: true
2
3module Xml
4 module Kit
5 module Crypto
6 class RsaCipher
7 ALGORITHM = "#{::Xml::Kit::Namespaces::XMLENC}rsa-1_5"
8 attr_reader :algorithm, :key
9
10 def initialize(algorithm, key)
11 @algorithm = algorithm
12 @key = key
13 end
14
15 def self.matches?(algorithm)
16 ALGORITHM == algorithm
17 end
18
19 def encrypt(plain_text)
20 @key.public_encrypt(plain_text)
21 end
22
23 def decrypt(cipher_text)
24 @key.private_decrypt(cipher_text)
25 end
26 end
27 end
28 end
29end