Hi Nitin
Thanks for the update. But still i am getting diffrent error: after
modifying my code [like sending certficate as string]
Please let me know, what's wrong in this.
This is my Server side code:
----------------------------------------
try
{
ByteArrayInputStream in = new
ByteArrayInputStream(CERTIFICATE.getBytes());
CertificateFactory certFac =
CertificateFactory.getInstance("X509");
X509Certificate cert =
(X509Certificate)certFac.generateCertificate(in);
OAuthServiceProvider provider = new
OAuthServiceProvider(null, null, null);
OAuthConsumer consumer = new OAuthConsumer(null,
"
orkut.com", null, provider);
consumer.setProperty(RSA_SHA1.X509_CERTIFICATE,
CERTIFICATE);
OAuthMessage message = OAuthServlet.getMessage(request,
null);
OAuthAccessor accessor = new OAuthAccessor(consumer);
out.print("*** OAuthMessage Params [Before
calling:validateSignature() method] *** ");
for(java.util.Map.Entry param: message.getParameters())
{
out.print("<br>");
out.print("Param Name-->"+param.getKey());
out.print(" ");
out.print("Value-->"+param.getValue());
}
out.print("<br>");
out.print("<HERE>");
out.print(" VALIDATING SIGNATURE ");
out.print("<br>");
message.validateSignature(accessor);
result = true;
out.print("REQUEST STATUS::"+result);
out.print("<br>");
}
catch(OAuthProblemException ope)
{
out.print("<br>");
out.print("OAuthProblemException-->"+ope.getProblem());
}
And When i execute & got below output
---------------------------------------------------------
--------------------------------------------------------
*** OAuthMessage Params [Before calling:validateSignature() method]
***
Param Name-->opensocial_ownerid Value-- >00611319245665564774
Param Name-->oauth_signature Value-->PK9mTYeIoav4onvmzlC49hlG3e6AXJscH
lqJpnFFUKt2OVoPzoNH653E2VIMVfrXFJkthJuYJ8MTRriva6a7qIlwMw6CNgjRDYK0iBC86OefnaoqSrIB82pUmFCPKofB7cNWM3N97V4Ay4bhccpSzmO88rp1LGzQE52h71WMn48
=
Param Name-->oauth_nonce Value-->41f92a56fccffc13
Param Name-->opensocial_appid Value-- >14870803059808603830
Param Name-->xoauth_signature_publickey Value-->pub.
1199819524.-1556113204990931254 .cer
Param Name-->oauth_signature_method Value-->RSA-SHA1
Param Name-->oauth_consumer_key Value-->
orkut.com
Param Name-->opensocial_viewerid Value-->00611319245665564774
Param Name-->oauth_token Value-->
Param Name-->oauth_timestamp Value-->1206081149
VALIDATING SIGNATURE
OAuthProblemException-->signature_invalid
> > > > #2) To check if a request issigneduse the following code - I got it
> > > > from another post -
> > > > Try {
> > > > OAuthServiceProvider provider = new
> > > > OAuthServiceProvider(null, null,null);
> > > > OAuthConsumer consumer = new OAuthConsumer(null,
> > > > "
orkut.com", null,provider);
> > > > consumer.setProperty(RSA_SHA1.X509_CERTIFICATE,
> > > > certificate);
> > > > OAuthMessage message = OAuthServlet.getMessage(request,
> > > > null);
> > > > OAuthAccessor accessor = new OAuthAccessor(consumer);
> > > > message.validateSignature(accessor);
> > > > return true;
> > > > } catch (Exception e) {
> > > > //notsignedor some other issue
> > > > }
>
> > > > #3) Also add the authorization related param on the makeRequest - see
> > > > the wiki page for it.
>
> > > > I hope it helps.
>
> > > > - nitin
>
> > > > On Mar 13, 10:54 am, RS <
rsde...@gmail.com> wrote:
>
> > > > > Hi,
>
> > > > > Can anyone help with sample code on how to implement "signed
> > > > > gadgets.io.makeRequest functionality" in servlets?
>
> > > > > Best Regards,
>