class Egalite::Keitai::URLSession

Public Class Methods

decrypt(s,key) click to toggle source
# File lib/egalite/keitai/keitai.rb, line 17
def self.decrypt(s,key)
  cipher = OpenSSL::Cipher.new("bf-cbc")
  cipher.pkcs5_keyivgen(key)
  cipher.decrypt
  e = s.tr('_.-','+/=')
  e = Base64.decode64(e)
  d = cipher.update(e) + cipher.final
  d
end
encrypt(s,key) click to toggle source
# File lib/egalite/keitai/keitai.rb, line 10
def self.encrypt(s,key)
  cipher = OpenSSL::Cipher.new("bf-cbc")
  cipher.pkcs5_keyivgen(key)
  cipher.encrypt
  e = cipher.update(s) + cipher.final
  Base64.encode64(e).tr('+/=','_.-').gsub!("\n","")
end