def aes_encrypt() cipher = OpenSSL::Cipher::AES.new(128, :CBC) cipher.encrypt cipher.key = "quck7295abvdefgh" data= 'sssssdsadkjak' cipher.iv = "abcdefghhigk" encrypted = cipher.update(data) + cipher.final Base64.strict_encode64(encrypted) end def aes_decrypt() data = 'hWmnsBO1buB1==' cipher = OpenSSL::Cipher.new('aes-128-cbc') cipher.key = "quck7295abvdefgh" cipher.iv = "abcdefghhigk" cipher.decrypt plain_text = "" plain_text << cipher.update(Base64.decode64(data)) plain_text << cipher.final return plain_text end