I want encrypt message on the site with user's key and decrypt it on the server side, but decryption doesn't work.
crypto-js(coffe js):
$(document).on 'click', '.subclick', ->
  text = $('#myform_text').val()
  pass = $('#myform_passphrase').val()
  days = $('#store_days').val()
  encrypted = CryptoJS.AES.encrypt(text, pass)
  $.post '/otprecs',
    text: encrypted.toString(CryptoJS.enc.utf8);
    store_days: days
  return
ruby decrypt function:
 def decrypt_text(passphrase, text)
    encrypted = Base64.decode64(text)
    cipher = OpenSSL::Cipher::Cipher.new('aes-256-cbc')
    cipher.decrypt
    cipher.key = Digest::SHA256.digest(passphrase.chomp)
    text = cipher.update(encrypted)
    text << cipher.final
    puts text
  end
Do you have any ideas?
