> Arne I tried your solution and I couldn't get it to work, and to be
> honest it was over a few hours ago now since I tried so I can't
> remember which one out of the many attempts and error messages I got
> today, sorry.
I tested it before posting so it is a working example.
> I've done even more googling and came across the jakarta commons
> httpclient package (http://jakarta.apache.org/httpcomponents/
> httpclient-3.x/) and decided to give that a go. This package handles
> both HTTP and HTTPS.
It solves problems with maintaining session and handling
redirects etc..
But for a simple HTTPS it should neither be necessary or
make a difference.
> Again I tried it with HTTP and it worked great (see code below). I
> then switched to a HTTPS connection and I get an
[quoted text clipped - 4 lines]
> [06/10/07 23:25:32:062 BST] 5d9100f1 SystemErr R
> javax.net.ssl.SSLHandshakeException: unknown certificate
That sounds as a certificate problem. Exactly what my code was handling.
> So I do some more googling and I read about adding these two lines:
>
> System.setProperty("java.protocol.handler.pkgs",
> "com.sun.net.ssl.internal.www.protocol");
> Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
Referring directly to com.sun classes should not be necessary.
> which I do to the top of the code below and I then get a different
> exception - example stack trace top few lines here ...
[quoted text clipped - 3 lines]
> java.lang.RuntimeException: Cipher buffering error in JCE provider
> IBMJCE
IBMJCE ??
Are your working with an IBM Java ?
> why is it so difficult to connect to SSL?
It is really not that difficult.
Arne
Dundonald - 08 Oct 2007 00:09 GMT
> > Arne I tried your solution and I couldn't get it to work, and to be
> > honest it was over a few hours ago now since I tried so I can't
[quoted text clipped - 50 lines]
>
> Arne
Arne - thanks for your replies, much appreciated.
Here's an exception that I got from running your code:
java.security.NoSuchAlgorithmException: Algorithm SSL not available
at javax.net.ssl.SunJSSE_b.a(DashoA6275)
at javax.net.ssl.SSLContext.getInstance(DashoA6275)
at october.HttpsPost.main(HttpsPost.java:11)
Exception in thread "main"
Line 11 = SSLContext sslctx = SSLContext.getInstance("SSL");
Arne Vajhøj - 08 Oct 2007 01:51 GMT
> Here's an exception that I got from running your code:
>
[quoted text clipped - 5 lines]
>
> Line 11 = SSLContext sslctx = SSLContext.getInstance("SSL");
What version of Java ?
You can try the alternatives:
SSLv2
SSLv3
TLS
TLSv1
TLSv1.1
Arne
Dundonald - 09 Oct 2007 18:54 GMT
> Dundonaldwrote:
> > Here's an exception that I got from running your code:
[quoted text clipped - 18 lines]
>
> Arne
Arne, no need for alternatives. I was running WSAD IDE using JDK 1.3
with patched on JSSE and JCE jars, and have since changed to netbeans
with JDK 5 and retried your code and it works. Thanks.
Arne Vajhøj - 10 Oct 2007 01:15 GMT
>> Dundonaldwrote:
>>> Here's an exception that I got from running your code:
[quoted text clipped - 16 lines]
> with patched on JSSE and JCE jars, and have since changed to netbeans
> with JDK 5 and retried your code and it works. Thanks.
If I were to guess I would guess on IBM Java 1.3.1 and some
SUN JSSE & JCE, which could be a tricky combo.
But if you can use SUN Java 1.5, then by all means do it. Java 1.3
is very old.
Arne