Class: Xmlenc::Algorithms::RsaOaepMgf1p
- Inherits:
-
Object
- Object
- Xmlenc::Algorithms::RsaOaepMgf1p
- Defined in:
- lib/xmlenc/algorithms/rsa_oaep_mgf1p.rb
Constant Summary collapse
- DIGEST_METHODS =
%w(http://www.w3.org/2000/09/xmldsig#sha1)
Instance Method Summary collapse
- #decrypt(cipher_value, options = {}) ⇒ Object
- #encrypt(data) ⇒ Object
-
#initialize(key) ⇒ RsaOaepMgf1p
constructor
A new instance of RsaOaepMgf1p.
Constructor Details
#initialize(key) ⇒ RsaOaepMgf1p
Returns a new instance of RsaOaepMgf1p.
6 7 8 |
# File 'lib/xmlenc/algorithms/rsa_oaep_mgf1p.rb', line 6 def initialize(key) @key = key end |
Instance Method Details
#decrypt(cipher_value, options = {}) ⇒ Object
10 11 12 13 |
# File 'lib/xmlenc/algorithms/rsa_oaep_mgf1p.rb', line 10 def decrypt(cipher_value, = {}) verify_algorithm([:node]) if [:node] @key.private_decrypt(cipher_value, OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING) end |
#encrypt(data) ⇒ Object
15 16 17 |
# File 'lib/xmlenc/algorithms/rsa_oaep_mgf1p.rb', line 15 def encrypt(data) @key.public_encrypt(data, OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING) end |