Add expiration support for message_verifier and message_encryptor

The patch will bake the expiration into message_verifier's signed message and message_encryptor's encrypted message to prevent the expiration from being forged. It will check the expiration every time you try to verify a signed message or decrypt an encrypted message. If the message is expired, it will raise an exception ExpiredMessage.
```ruby
encrypted_message = encryptor.encrypt_and_sign( data, 1.hour.from_now)
encryptor.decrypt_and_verify(encrypted_message) #=> data if not expired
encryptor.decrypt_and_verify(encrypted_message) #> raise ExpiredMessage if expired
```
cc @rafaelfranca @chancancode
:+1:

Den 22/08/2014 kl. 18.03 skrev Xuchu Zhang <notifications@github.com>:

> In activesupport/lib/active_support/message_verifier.rb:
> 
> > +
> > +    def initialize(serializer)
> > +      @serializer = serializer
> > +    end
> > +
> > +    def dump(value, expiration=nil)
> > +      if expiration.present?
> > +        "#{SIGNATURE}--#{encode_expiration(expiration)}--#{@serializer.dump(value)}"
> > +      else
> > +        @serializer.dump(value)
> > +      end
> > +    end
> > +
> > +    def load(value)
> > +      if value.start_with?(SIGNATURE)
> > +        value_array = value.split("--")
>  add _array at last is just a habit. I can change it to serialized_values to indicate that the value is processed after serialization.
> 
> —
> Reply to this email directly or view it on GitHub.
> 

--
Kasper