class Xml::Kit::Crypto::OaepCipher

Constants

ALGORITHM
ALGORITHMS

Attributes

algorithm[R]
key[R]

Public Class Methods

matches?(algorithm) click to toggle source
# File lib/xml/kit/crypto/oaep_cipher.rb, line 18
def self.matches?(algorithm)
  ALGORITHMS[algorithm]
end
new(algorithm, key) click to toggle source
# File lib/xml/kit/crypto/oaep_cipher.rb, line 13
def initialize(algorithm, key)
  @algorithm = algorithm
  @key = key
end

Public Instance Methods

decrypt(cipher_text) click to toggle source
# File lib/xml/kit/crypto/oaep_cipher.rb, line 26
def decrypt(cipher_text)
  @key.private_decrypt(cipher_text, padding)
end
encrypt(plain_text) click to toggle source
# File lib/xml/kit/crypto/oaep_cipher.rb, line 22
def encrypt(plain_text)
  @key.public_encrypt(plain_text, padding)
end

Private Instance Methods

padding() click to toggle source
# File lib/xml/kit/crypto/oaep_cipher.rb, line 32
def padding
  OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING
end