How to use before_filter to decrypt post data

hello, everybody.
in ror, we can add a after_filter to a controller.

def aes_encrypt
response.body = AesHelper.aes_encrypt(response.body)
end

after_filter :aes_encrypt

and all action’s repsonse int the controller can be encrypt.

and my question is , how to decrypt data use before_filter, or anything
else.

ex: i want to post json data to /usr/register, the json data is
{“name”:“good”, “password”:“nice”}. encrypt it to
5B2YC7WzgFmaivnATP1ZLR4sTXB3SsWEUeMpUbcYiylcvHxfSStYIBqwIMCjZAY3

so i post
5B2YC7WzgFmaivnATP1ZLR4sTXB3SsWEUeMpUbcYiylcvHxfSStYIBqwIMCjZAY3
to /usr/register

in action register , i would write code like this:

already decrypt.

def register
User.register(params[:name], params[:passport])
end

so, how can i decrypt
5B2YC7WzgFmaivnATP1ZLR4sTXB3SsWEUeMpUbcYiylcvHxfSStYIBqwIMCjZAY3 before
action register to use params directly in register

thanks for anybody’s help!!

Action Controller Overview — Ruby on Rails Guides
Here
you’ll get a clear description about how to use Filters.

Best Regards,
Ryan Cheung