Repository is archived
No commit activity in last 3 years
No release in over 3 years
Rack::ResponseSignature uses RSA key pairs to transparently sign the outgoing responses from any Rack-compliant application.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
~> 2.11

Runtime

~> 1.0
 Project Readme

Rack::ResponseSignature¶ ↑

Rack::ResponseSignature is a Rack middleware which can drop into any Rack-compliant application an add transparent response signing. Response signing is done to verify to clients that the response is coming from a trusted source. The signature is currently based on RSA Public/Private key pair signing.

Primarily, this is useful when verified-SSL is not an option. This may occur when you are working on a shared host or other environment which utilizes wildcard certificates (like Heroku). In this case, while the SSL certificate may be verified with the Certificate Authority, it doesn’t not ensure the identity of the serving party.

With this implementation:

  • RSA keys of any strength may be used,

  • SSL certificates are optional,

  • Response signing is transparent,

  • Response verification is simple

Installation¶ ↑

From the gem:

$ sudo gem install rack-response-signature

From source:

$ git clone http://github.com/nbibler/rack_response_signature.git
$ rake package && sudo rake install

Basic Usage¶ ↑

Rack¶ ↑

Rack::ResponseSignature is implemented as a piece of Rack middleware and can be used with any Rack-based application. If your application includes a rackup file (‘config.ru`, for example) or uses Rack::Builder to construct the application stack, then require and use, like so:

require 'rack/response_signature'

use Rack::ResponseSignature, "my-private-ssh-key-for-signing"

run app

The SSH key may also be read from a file with ‘File.read(’private.key’)‘, as well.

Rails¶ ↑

To use this middleware with Rails, add this to your ‘config/environment.rb`, to `config/environments/production.rb`, or to an initializer:

config.middleware.use Rack::ResponseSignature, "my-private-ssh-key..."

You should now see ‘Rack::ResponseSignature` listed in the middleware stack:

$ rake middleware