title: Rails 7 - ActiveSupport::MessageEncryptor
body: <p>I upgraded my app to Rails 7 (from Rails 6.1) and stuck on an issue.</p>
  <p>I encrypt a few data fields with ActiveSupport::MessageEncryptor. I have my code to encrypt and decrypt below.</p>
  <p>There is no issue when I create a new record. The values are encrypted. Then as I view the record the values are decrypted.</p>
  <p>The issue is that I cannot view any records created before upgrading to Rails 7. The decrypt_and_verify method throws ActiveSupport::MessageEncryptor::InvalidMessage</p>
  <p>Note that the ENV values KEY_GENERATOR_SECRET and KEY_GENERATOR_SALT have not changed.</p>
  <p>I failed to test decrypting older records and thought I was good - so I've pushed to production (on Heroku). This issue is present in Development, Test, and Production. Good times.</p>
  <p>Thanks for any help,
  Charlie</p>
  <pre><code>  # ----------------------------------------------------------------
  
    # encrypt a value
    def encrypt_value(obj_value)
  
      # create the key from a combination of
      # our secret passcode + unique salt
      key = ActiveSupport::KeyGenerator.new(ENV['KEY_GENERATOR_SECRET']).generate_key(ENV['KEY_GENERATOR_SALT'], 32)
  
      # encrypt the objects value
      ActiveSupport::MessageEncryptor.new(key).encrypt_and_sign(obj_value)
  
    end
  
    # ----------------------------------------------------------------
  
    # decrypt a value
    def decrypt_value(encrypted_value)
  
      # if nothing to encrypt,
      # return an empty string
      return '' if encrypted_value.nil?
  
      # create the key from a combination of
      # our secret passcode + unique salt
      key = ActiveSupport::KeyGenerator.new(ENV['KEY_GENERATOR_SECRET']).generate_key(ENV['KEY_GENERATOR_SALT'], 32)
  
      # decrypt the objects encrypted value
      ActiveSupport::MessageEncryptor.new(key).decrypt_and_verify(encrypted_value)
  
    end
  
    # ----------------------------------------------------------------
  </code></pre>