Class: Xml::Kit::Crypto::RsaCipher
- Inherits:
-
Object
- Object
- Xml::Kit::Crypto::RsaCipher
- Defined in:
- lib/xml/kit/crypto/rsa_cipher.rb
Constant Summary collapse
- ALGORITHM =
"#{::Xml::Kit::Namespaces::XMLENC}rsa-1_5".freeze
Class Method Summary collapse
Instance Method Summary collapse
- #decrypt(cipher_text) ⇒ Object
- #encrypt(plain_text) ⇒ Object
-
#initialize(_algorithm, key) ⇒ RsaCipher
constructor
A new instance of RsaCipher.
Constructor Details
#initialize(_algorithm, key) ⇒ RsaCipher
Returns a new instance of RsaCipher.
9 10 11 |
# File 'lib/xml/kit/crypto/rsa_cipher.rb', line 9 def initialize(_algorithm, key) @key = key end |
Class Method Details
.matches?(algorithm) ⇒ Boolean
13 14 15 |
# File 'lib/xml/kit/crypto/rsa_cipher.rb', line 13 def self.matches?(algorithm) ALGORITHM == algorithm end |
Instance Method Details
#decrypt(cipher_text) ⇒ Object
21 22 23 |
# File 'lib/xml/kit/crypto/rsa_cipher.rb', line 21 def decrypt(cipher_text) @key.private_decrypt(cipher_text) end |
#encrypt(plain_text) ⇒ Object
17 18 19 |
# File 'lib/xml/kit/crypto/rsa_cipher.rb', line 17 def encrypt(plain_text) @key.public_encrypt(plain_text) end |