lib/xmlenc/algorithms/rsa_oaep_mgf1p.rb in xmlenc-0.0.1 vs lib/xmlenc/algorithms/rsa_oaep_mgf1p.rb in xmlenc-0.1.0
- old
+ new
@@ -6,11 +6,16 @@
def initialize(key)
@key = key
end
def decrypt(cipher_value, options = {})
- verify_algorithm(options[:node])
+ verify_algorithm(options[:node]) if options[:node]
@key.private_decrypt(cipher_value, OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING)
+ end
+
+ def encrypt(data, options = {})
+ verify_algorithm(options[:node]) if options[:node]
+ @key.public_encrypt(data, OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING)
end
private
def verify_algorithm(node)