blob: cc2c124ec620523df241f4aa2d00689cb4a65dbe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# frozen_string_literal: true
module Xml
module Kit
module Crypto
class RsaCipher
ALGORITHM = "#{::Xml::Kit::Namespaces::XMLENC}rsa-1_5"
attr_reader :algorithm, :key
def initialize(algorithm, key)
@algorithm = algorithm
@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
|