rack/rack — Issue #251: OpenSSL
Author: carlosjhr64
Created: 2011-10-09 22:02:57+00:00
State: open

This is not a bug report, but more of a feature request...
Rack::Session::Cookie requires openssl just to get an HMAC.
Otherwise, sinatra's session (and rack) would not depend on opessl, from what I can see.
Problem is that in some systems, openssl is not available (for whatever reason).
For example, current ruby 1.8 for Nokia's N900.
There is a ruby-hmac gem available.

In lib/rack/session/cookie.rb, the following edits seem to work:
#require 'openssl' <=edit this out
require 'rubygems' # ruby 1.8 needs this somewhere
require 'hmac'
# ... then down at the bottom of the file...
hmac = HMAC::SHA1.new(@secret)
hmac << data
hmac.hexdigest

I just guessed at the above.
You should verify that it's correct.