Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Bad signature in response #47

pghodgman opened this Issue · 7 comments

3 participants


In a Rails 3.2 app, I consistently get an error during the validation of the signature..

Bad signature in response from

In a sinatra app, I do not get this error.



I assume you are using the latest version of the gem, right?

Does this also happen with stores other than filesystem? (you wrote to me via mail, that you are using the filesystem storage, that's where I got this info from)

Also from the mail you've sent to me:

I have looked through the code and clearly the signatures are not comparing correctly.

What do the signatures look like?


Hi Dennis,

Thanks for getting back to me. I am a newbie to ruby so bear with me. It does happen with the other stores (at least the memory store). The signatures come out - same length, but completely different.

calculated_sig = "Gjuoe0mzPhfjzakzciVu5aIhvv0="
message_sig = "JDvZzOjsrqOfQlKe3QX5sfH3seI="

I am using Ruby 1.8.7, Ruby-OpenId 2.2.3

I have a very small sample app I can share if you would like that shows this ...

Any help is greatly appreciated..



Hello Pete, sorry for not responding. This is hard to debug, do you have any additional logging or some more background information in how the Rails and Sinatra versions differ?


Hello Pete, I'm sorry, but attaching the apps when responding to a comment via mail does not work. And even if it would: Sorry, but I currently don't have the time to go through two custom written apps and look for the problem.

We have to approach this differently. Do you have further information you can provide?


I have just spent a whole lot of time debugging a "Bad signature" on Ruby 1.8.7 as well. So here's my findings in the hope it may help somebody else:

The Ruby version that was on the OS X box was broken. This resulted in the DiffieHellman.powermod method returning 0 instead of the real result.

Reinstalling a fresh version of Ruby 1.8.7 made the problem go away.

Example code on a broken machine:

def powermod(x, n, q)
  while n_p != 0
    if n_p[0]==1
      y_p=(y_p*z_p) % q
    n_p = n_p >> 1
    z_p = (z_p * z_p) % q
    counter += 1
  return y_p

powermod(2, 123454321, 155172898181473697471232257763715539915724801966915404479707795314057629378541917580651227423698188993727816152646631438561595825688188889951272158842675419950341258706556549803580104870537681476726513255747040765857479291291572334510643245094715007229621094194349783925984760375594985848253359305585439638443)
=> 0

On a functioning machine the result is:

=> 26377743625840057072763552718012941530019788180938923058871680953946689785693880983045064884581510578731167609717886907931885249151846297616014337793734934561965519812927148341001547423492109180488010619441012471253459762900460564568636436551249157202778947712262503994502901910588207390947488361112428722944
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.