Hello all, I am trying to decrypt a string which has been encrypted in my rails project. This is how I am encrypting the data:
def encrypt_text(text_To_encrypt) # Ref: http://www.monkeyandcrow.com/blog/reading_rails_how_does_message_encryptor_work/ secret = Rails.configuration.miscconfig['encryption_key'] salt = Rails.configuration.miscconfig['encryption_salt'] key = ActiveSupport::KeyGenerator.new(secret).generate_key(salt, 32) crypt = ActiveSupport::MessageEncryptor.new(key) encrypted_data = crypt.encrypt_and_sign(text_To_encrypt) encrypted_data end I am able to decrypt using decrypt_and_verify, but I want to decrypt it manually using openssl. How do I do that. I tried doing the following command: echo "<encrypted_message>"|openssl enc -d -aes-256-cbc -a -salt This encrypted message is the first part of the "encrypted_data" from the above code. This doesn't include the IV. It didn't work, so I tried giving the entire encrypted_data, which didn't work as well. After giving the password, it shows "bad magic number". I don't understand what I am doing wrong. Can someone please give me a push in the right direction. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/81f2a556-4d47-404d-a057-04174a8c15ff%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.