Module: JytPay::Encrypt::Rsa

Defined in:
lib/jyt_pay/encrypt/rsa.rb

Class Method Summary collapse

Class Method Details

.decrypt(key_enc, rsa_private_key) ⇒ Object



13
14
15
16
# File 'lib/jyt_pay/encrypt/rsa.rb', line 13

def self.decrypt(key_enc, rsa_private_key)
  ec = [key_enc].pack 'H*'
  rsa_private_key.private_decrypt(ec)
end

.encrypt(rsa_public_key, key_arg = Encrypt::DES_KEY) ⇒ Object



7
8
9
10
11
# File 'lib/jyt_pay/encrypt/rsa.rb', line 7

def self.encrypt(rsa_public_key, key_arg = Encrypt::DES_KEY)
  data = [key_arg].pack 'H*'
  kenc = rsa_public_key.public_encrypt key_arg
  kenc.unpack('H*')[0]
end