module Reapal::Encrypt::AES

Public Class Methods

decrypt(content, key) click to toggle source
# File lib/reapal/encrypt/aes.rb, line 14
def self.decrypt(content, key)
  encrypted = Base64.strict_decode64(content)
  cipher = OpenSSL::Cipher.new("AES-128-ECB")
  cipher.decrypt
  cipher.key = key
  cipher.update(encrypted) + cipher.final
end
encrypt(content, key) click to toggle source
# File lib/reapal/encrypt/aes.rb, line 6
def self.encrypt(content, key)
  cipher = OpenSSL::Cipher.new("AES-128-ECB")
  cipher.encrypt
  cipher.key = key
  encrypted = cipher.update(content) + cipher.final
  Base64.strict_encode64(encrypted)
end