5 messages in com.googlegroups.opensocial-orkutRe: Signed requests error using oauth...
FromSent OnAttachments
Nikhil Gupte12 Mar 2008 04:51 
Nikhil Gupte12 Mar 2008 12:26 
Nikhil Gupte12 Mar 2008 23:52 
Vikram31 Mar 2008 04:48 
Vikram31 Mar 2008 04:48 
Subject:Re: Signed requests error using oauth-ruby [Neither PUB key nor PRIV key]
From:Vikram (s.ve@gmail.com)
Date:03/31/2008 04:48:20 AM
List:com.googlegroups.opensocial-orkut

Hi Nikhil,

I was getting the following NoMethodError (the very same error you were getting) when trying to do OAuth::Signature.verify(request) in my rails application.... undefined method `consumer' for #<OAuth::RequestProxy::ActionControllerRequest:0x4590b24>

I saw your post reporting that it is a bug in sha1.rb for it to be using request.consumer.secret, and that consumer_secret is the right usage. I applied the following patch (posted by you) to my sha1.rb - public_key = OpenSSL::PKey::RSA.new(request.consumer.secret) + public_key = OpenSSL::PKey::RSA.new(consumer_secret)

But, after the change, i see 'customer_secret' is nil when making the call OpenSSL::PKey::RSA.new(customer_secret) in sha1.rb Just curious, may i know where customer_secret is defined?

On Mar 13, 11:52 am, Nikhil Gupte <nikh@gmail.com> wrote:

Thanks Arne,

I finally seem to have got it working. There were some bugs inoauth-ruby. I've
submitted patches for the same. Anyone interested please refer
tohttp://groups.google.com/group/oauth-ruby/browse_thread/thread/ac0f71...

On Mar 13, 1:54 am, "Arne Roomann-Kurrik" <api.@google.com> wrote:

That looks like progress. What does your verification step look like?

~Arne

On Wed, Mar 12, 2008 at 12:27 PM, Nikhil Gupte <nikh@gmail.com> wrote:

Thanks Arne.

Now I'm getting the request as invalid. This is what I'm doing: 1. cert = OpenSSL::X509::Certificate.new(PATH/TO/CERT_FILE) # Get certificate... 2. public_key = cert.public_key # Get the public key... 3. # verify...

I've even tried replacing Step #2 with: 2. publick_key = OpenSSL::PKey::RSA.new(cert.public_key)

I don't understand this stuff too well and hence hope you can spot what I'm doing wrong. In the mean time, I'm reading-up onoauth...

Thanks!

On Mar 12, 10:02 pm, "Arne Roomann-Kurrik" <api.@google.com> wrote:

Hi Nikhil,

Sorry, I don't do very much withRuby, but it appears that you're treating the certificate file like a public key. This is incorrect - the certificate encodes the public key and some other information in a X.509certificate format. You can paste the contents of the file you're loading here:http://www.redkestrel.co.uk/utilities/CertDecoder.htmltoseewhat information is contained.

Rubyshould have some libraries to decode X.509 certificates for you. A quick google search indicates that OpenSSL::X509::Certificate may be able to help you access this information: http://raa.ruby-lang.org/project/openssl/ You should be able to decode the certificate, obtain the public key, and then pass that to the RSA.new constructor.

~Arne

On Wed, Mar 12, 2008 at 4:52 AM, Nikhil Gupte <nikh@gmail.com>

wrote:

Hi,

I'm using theoauth-rubyAPI. It seems to think that the certificate @ http://sandbox.orkut.com/46/o/pub.1199819524.-1556113204990931254.cer is invalid. It says that it's neither a public nor private key file

Following is a quick way (bypassing everything else to simplify) to demonstrate the issue: $ irb

require 'openssl' OpenSSL::PKey::RSA.new(File.read("/PATH/TO/pub.1199819524.-

1556113204990931254.cer"))

OpenSSL::PKey::RSAError: Neither PUB key nor PRIV key:: nested asn1 error