YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Proplem connecting to PayPal via https Options
Guest(old)
#1 Posted : Tuesday, November 19, 2002 12:31:27 PM
Rank: Starting Member

Groups: Registered

Joined: 11/12/2002
Posts: 312
Location: ,
I'm attempting to use a jsp page to post the information back to paypal, after receiving the IPN. I basically cut and pasted the java code example from the paypal site, and I'm getting a "java.security.cert.CertificateException: Could not find trusted certificate" error. If I use straight http, it works. But, no luck with https. I've been researching for days and cannot make any headway. Here are the steps I'm taking: URL u; URLConnection uc; try { System.out.println("about to https:"); u = new URL("https://www.paypal.com/cgi-bin/webscr"); System.out.println("URL instantiated"); uc = u.openConnection(); System.out.println("Connection opened"); uc.setDoOutput(true); System.out.println("setDoOutput() success"); uc.setRequestProperty("Content-Type","application/x-www-form-urlencoded"); System.out.println("setRequestProperty() success"); PrintWriter pw = new PrintWriter(uc.getOutputStream()); System.out.println("Printwriter instantiated"); pw.println(str); pw.close(); } catch (Exception e) { System.out.println("Error posting to http://www.paypal.com/cgi-bin/webscr!"); System.out.println(e.getMessage()); throw e; }
Sponsor  
 
paypal_pb
#2 Posted : Tuesday, November 19, 2002 6:34:54 PM
Rank: Starting Member

Groups: Registered

Joined: 9/16/2002
Posts: 2,960
Location: ,
I believe this is an issue with your SSL installation. There's very little information available. Try: http://forum.java.sun.co...rum=2&thread=295242

Patrick Breitenbach
PayPal, Inc.
Dev Net: https://www.paypal.com/pdn
Guest(old)
#3 Posted : Tuesday, November 19, 2002 11:43:31 PM
Rank: Starting Member

Groups: Registered

Joined: 11/12/2002
Posts: 312
Location: ,
Hi,
I submitted the solution to connect to the secure server to paypal
developer section using java servlet
,hopefully if they approve they can put in the
link for how to do.If you want a code, email me at
softwareObjects@hotmail.com
Guest(old)
#4 Posted : Friday, November 22, 2002 4:15:19 PM
Rank: Starting Member

Groups: Registered

Joined: 11/12/2002
Posts: 312
Location: ,
Perhaps I need to get a certificate from PayPal, and import it into my keystore? I don't fully understand the issue here.

I'm attempting to https to paypal. What happens next? Does my SSL implementation attempt to match paypal's public key to something that I have stored on my side?
harpsoft
#5 Posted : Tuesday, January 28, 2003 6:03:01 PM
Rank: Starting Member

Groups: Registered

Joined: 1/28/2003
Posts: 9
Location: ,

I'm surprised PayPal doesn't supply a servlet with overridden methods for each of the commands (ie. .paymentComplete()).

Also, I'm surprised how few Java posts there are in this forum (probably 'cause Java programmers are much smarter, and don't need as much help).

It would be nice to have a servlet already written though, than the JSP code.

Joel
paypal_pb
#6 Posted : Thursday, January 30, 2003 10:54:43 PM
Rank: Starting Member

Groups: Registered

Joined: 9/16/2002
Posts: 2,960
Location: ,
We're in progress of updating our sample code to provide more guidance as well as implement new features like multi-currency.

Of the 5 samples we provide, Java does seem to be the least accessed for whatever reason.

Patrick Breitenbach
PayPal, Inc.
Dev Net: https://www.paypal.com/pdn
rfroberg
#7 Posted : Saturday, August 30, 2003 4:05:44 PM
Rank: Starting Member

Groups: Registered

Joined: 8/30/2003
Posts: 8
Location: ,
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Originally posted by paypal_pb
[br]We're in progress of updating our sample code to provide more guidance as well as implement new features like multi-currency.

Dev Net: https://www.paypal.com/pdn
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">

I think that the example Java code actually performs a GET when
notified by IPN, when it should perform a POST.

From the API docs of HttpURLConnection:
setRequestMethod
public void setRequestMethod(String method)
throws ProtocolExceptionSet the method for the URL request, one of: GET POST HEAD OPTIONS PUT DELETE TRACE
are legal, subject to protocol restrictions.
The default method is GET

In the sample code, it says:
URL u = new URL("http://www.paypal.com/cgi-bin/webscr");
URLConnection uc = u.openConnection();
uc.setDoOutput(true);
uc.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
PrintWriter pw = new PrintWriter(uc.getOutputStream());
pw.println(str);
pw.close();
--
The URLConnection is actually an HttpURLConnection, and you could
do the following to actually, explicitly send a POST rather than GET:

URL u = new URL("http://www.paypal.com/cgi-bin/webscr");
HttpURLConnection uc=null;
try{
uc = (HttpURLConnection)u.openConnection();
uc.setDoOutput(true);
uc.setRequestMethod("POST");
/* AS BEFORE */
}catch(Exception e){...}

Comments, suggestions?

Rikard


ABC, DEFG, HIJ, KL
paypal_pb
#8 Posted : Tuesday, September 02, 2003 7:44:55 PM
Rank: Starting Member

Groups: Registered

Joined: 9/16/2002
Posts: 2,960
Location: ,
We'll review this. The system does accept a GET as well.

Patrick Breitenbach
PayPal, Inc.
Dev Net: https://www.paypal.com/pdn
servin7@yahoo.com
#9 Posted : Saturday, January 10, 2004 1:20:28 AM
Rank: Starting Member

Groups: Registered

Joined: 1/10/2004
Posts: 2
Location: ,
I've had PayPal IPN service working for a few months now. All of a sudden, it stopped working on 1/7/2004. I'm also getting

java.security.cert.CertificateException: Could not find trusted certificate

Perhaps PayPal updated its server SSL certificate recently. Can PayPal provide a .cert file we can import into our SSL key store? I've done this at work in the past when we had trouble connecting to providers/customer SSL servers.


J Servin
pparthiban77
#10 Posted : Monday, January 12, 2004 3:42:55 PM
Rank: Starting Member

Groups: Registered

Joined: 1/12/2004
Posts: 6
Location: ,
Hi,

We are also facing "javax.net.ssl.SSLHandshakeException: Could not find trusted certificate" from paypal IPN calling from 8th Jan 2004, as our customers are complain that their status set with paid but we are not receiving payments.

we are getting Exception at this code

System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");

we have tried with this following but still exception at setting property at "javax.net.ssl"

Security.addProvider ( new com.sun.net.ssl.internal.ssl.Provider());
System.setProperty("javax.net.debug","all");
System.setProperty("java.protocol.handler.pkgs","javax.net.ssl");
// System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");

As we are facing severe problem with our Customer Relationship any one's reply will be appreciated very much!!!.

Thanks & Regards,

Parthiban Palani,
Akmin Tech.
pparthiban77
#11 Posted : Monday, January 12, 2004 6:37:40 PM
Rank: Starting Member

Groups: Registered

Joined: 1/12/2004
Posts: 6
Location: ,
hi,
Thanks Patrick.

Parthiban Palani,

Akmin Tech.
bdunklau
#12 Posted : Wednesday, January 21, 2004 2:53:05 PM
Rank: Starting Member

Groups: Registered

Joined: 1/21/2004
Posts: 3
Location: ,
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Originally posted by Shannon
[br]It is a problem with Verisign. It is net wide.
http://verisign.com/corp...20040109.html?sl=070807
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">

I'm not sure this is the problem. There's another post I found on this site where the guy posted this link... http://sunsolve.sun.com/....pl?doc=fsalert%2F57436

After reading the article I did what it said - I upgraded to jdk1.4.2_03 and that worked - much more simple than all the other stuff I was trying.

Above-Avg Joe ;-)
jtheory
#13 Posted : Thursday, February 26, 2004 4:00:34 AM
Rank: Starting Member

Groups: Registered

Joined: 2/26/2004
Posts: 7
Location: ,
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
I'm not sure this is the problem. There's another post I found on this site where the guy posted this link... http://sunsolve.sun.com/....pl?doc=fsalert%2F57436
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">

This is absolutely right. The issue is that the certs distributed with the JVM expired, so you can either upgrade your JVM, or you can update the certs in your keystore. There are instructions for both (follow the link above).

If you are like most people and your site is hosted with someone else (where you may not have much choice about changes to the JVM or the keystore!), there are two more options:

1) Simply use the http address and avoid SSL altogether. The only problem - of course you reduce your security level, and take the risk (slim, but it's there) that your POST will be sniffed.

2) You can disable cert validation in your Java code, by replacing the TrustManager with an "all-trusting" version. This is my current solution. It does not risk security (since you KNOW which URL you're connecting to, and you know that PayPal's cert is valid!).

Here's the code (not sure how this will look in the forum...):

private static void disableCertCheck()
{
// make a naive trust manager
TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers(){
return null;
}
public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {}
public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {}
}
};

// install it
try {
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
}
catch (Exception e) {}
}
ralfhauser
#14 Posted : Tuesday, May 03, 2005 4:34:48 AM
Rank: Starting Member

Groups: Registered

Joined: 3/5/2004
Posts: 4
Location: ,
to see how to manage the truststore for this single connection without altering your global JVM truststore, see http://www.paypaldev.org/topic.asp?TOPIC_ID=9272

Reach me securely via:
https://www.privasphere.com/e.do?email=hauser@acm.org
deleted user: 1
#15 Posted : Monday, July 09, 2007 4:16:42 PM
Rank: Starting Member

Groups:

Joined: 9/10/2009
Posts: 3
Try flitronn.
&lt;a href= http://en.wikipedia.org/wiki/Rape &gt; Rape &lt;/a&gt; Rape [link http://en.wikipedia.org/wiki/Rape] Rape [/link]
&lt;a href= http://daughter-incest.enic.nl/ &gt; gay incest stories &lt;/a&gt; gay incest stories [link http://daughter-incest.enic.nl/] gay incest stories [/link]
&lt;a href= http://rapesex.enic.nl/ &gt; forced sex fantasy &lt;/a&gt; forced sex fantasy [link http://rapesex.enic.nl/] forced sex fantasy [/link]
&lt;a href= http://rape-porn.enic.nl/ &gt; anal rape &lt;/a&gt; anal rape [link http://rape-porn.enic.nl/] anal rape [/link]
&lt;a href= http://amateur-incest.enic.nl/ &gt; incest mom &lt;/a&gt; incest mom [link http://amateur-incest.enic.nl/] incest mom [/link]
&lt;a href= http://rape-porn.enic.nl/ &gt; forced oral sex &lt;/a&gt; forced oral sex [link http://rape-porn.enic.nl/] forced oral sex [/link]

&lt;a href= http://en.wikipedia.org/wiki/Incest &gt; Incest &lt;/a&gt; Incest [link http://en.wikipedia.org/wiki/Incest] Incest [/link]
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAFVision Theme by Jaben Cargman (Tiny Gecko)
Powered by YAF | YAF © 2003-2009, Yet Another Forum.NET
This page was generated in 0.744 seconds.