class Xmlenc::Algorithms::RsaOaepMgf1p
Constants
- DIGEST_METHODS
Public Class Methods
new(key)
click to toggle source
# File lib/xmlenc/algorithms/rsa_oaep_mgf1p.rb, line 6 def initialize(key) @key = key end
Public Instance Methods
decrypt(cipher_value, options = {})
click to toggle source
# File lib/xmlenc/algorithms/rsa_oaep_mgf1p.rb, line 10 def decrypt(cipher_value, options = {}) verify_algorithm(options[:node]) if options[:node] @key.private_decrypt(cipher_value, OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING) end
encrypt(data, options = {})
click to toggle source
# File lib/xmlenc/algorithms/rsa_oaep_mgf1p.rb, line 15 def encrypt(data, options = {}) @key.public_encrypt(data, OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING) end
Private Instance Methods
verify_algorithm(node)
click to toggle source
# File lib/xmlenc/algorithms/rsa_oaep_mgf1p.rb, line 21 def verify_algorithm(node) digest_method = node.at_xpath('./ds:DigestMethod', NAMESPACES)['Algorithm'] unless DIGEST_METHODS.include? digest_method raise UnsupportedError.new("RSA OEAP MGF1P unsupported digest method #{digest_method}") end end