# Cookie value encryption

**URL:** <https://www.ruby-forum.com/t/cookie-value-encryption/111366>\
**Category:** Rails\
**Created:** [August 6, 2007, 3:38pm UTC](https://www.ruby-forum.com/t/cookie-value-encryption/111366 "2007-08-06T15:38:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![homerlex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/bcef8e/32.png) [@homerlex](https://www.ruby-forum.com/u/homerlex)\
**Post date:** [August 6, 2007, 3:38pm UTC](https://www.ruby-forum.com/t/cookie-value-encryption/111366/1 "2007-08-06T15:38:16Z")

</div>

Is there anything built into either Ruby or Rails that can help  
encrypt and decrypt values placed in a cookie?

I realize that I could store sensitive data in the server side session  
instead I would like to know if cookie encryption is easily doable  
(exploring options).

---

<div class="post-metadata">

**Author:** ![homerlex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/bcef8e/32.png) [@homerlex](https://www.ruby-forum.com/u/homerlex)\
**Post date:** [August 6, 2007, 3:48pm UTC](https://www.ruby-forum.com/t/cookie-value-encryption/111366/2 "2007-08-06T15:48:17Z")

</div>

On 8/6/07, homerlex [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Is there anything built into either Ruby or Rails that can help  
> encrypt and decrypt values placed in a cookie?
> 
> I realize that I could store sensitive data in the server side session  
> instead I would like to know if cookie encryption is easily doable  
> (exploring options).

OpenSSL, which is poorly documented. Luckily there’s EZCrypto to the  
rescue (though I’ve never used it): [http://ezcrypto.rubyforge.org/](http://ezcrypto.rubyforge.org/)

–  
Rick O.  
[http://lighthouseapp.com](http://lighthouseapp.com)  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)

---

<div class="post-metadata">

**Author:** ![homerlex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/bcef8e/32.png) [@homerlex](https://www.ruby-forum.com/u/homerlex)\
**Post date:** [August 6, 2007, 5:58pm UTC](https://www.ruby-forum.com/t/cookie-value-encryption/111366/3 "2007-08-06T17:58:43Z")

</div>

Or may be use cookie based session store, which encrypts the data.

On 8/6/07, Rick O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> OpenSSL, which is poorly documented. Luckily there’s EZCrypto to the  
> rescue (though I’ve never used it): [http://ezcrypto.rubyforge.org/](http://ezcrypto.rubyforge.org/)
> 
> –  
> Rick O.  
> [http://lighthouseapp.com](http://lighthouseapp.com)  
> [http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
> [http://mephistoblog.com](http://mephistoblog.com)
> 
> >

–  
Cheers!

- Pratik  
[http://m.onkey.org](http://m.onkey.org)

---

<div class="post-metadata">

**Author:** ![homerlex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/bcef8e/32.png) [@homerlex](https://www.ruby-forum.com/u/homerlex)\
**Post date:** [August 7, 2007, 1:06pm UTC](https://www.ruby-forum.com/t/cookie-value-encryption/111366/4 "2007-08-07T13:06:36Z")

</div>

Where can I find some docs on how to use the Cookie Based Session  
Store? I’m using Rails 1.2.3 The following page makes no mention of  
it: [http://wiki.rubyonrails.org/rails/pages/HowtoChangeSessionStore](http://wiki.rubyonrails.org/rails/pages/HowtoChangeSessionStore)

Regards

---

<div class="post-metadata">

**Author:** ![homerlex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/bcef8e/32.png) [@homerlex](https://www.ruby-forum.com/u/homerlex)\
**Post date:** [August 7, 2007, 1:41pm UTC](https://www.ruby-forum.com/t/cookie-value-encryption/111366/5 "2007-08-07T13:41:42Z")

</div>

Oops. Cookie based session store is only in edge rails.

On 8/7/07, homerlex [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> >

–  
Cheers!

- Pratik  
[http://m.onkey.org](http://m.onkey.org)
