lib/xml/kit/crypto/rsa_cipher.rb in xml-kit-0.1.0 vs lib/xml/kit/crypto/rsa_cipher.rb in xml-kit-0.1.1
- old
+ new
@@ -1,18 +1,20 @@
module Xml
module Kit
module Crypto
class RsaCipher
- ALGORITHMS = {
- 'http://www.w3.org/2001/04/xmlenc#rsa-1_5' => true,
- }
+ ALGORITHM = "#{::Xml::Kit::Namespaces::XMLENC}rsa-1_5"
def initialize(algorithm, key)
@key = key
end
def self.matches?(algorithm)
- ALGORITHMS[algorithm]
+ ALGORITHM == algorithm
+ end
+
+ def encrypt(plain_text)
+ @key.public_encrypt(plain_text)
end
def decrypt(cipher_text)
@key.private_decrypt(cipher_text)
end