[Android Software/Hacking General [Developers Only]] ErrieR:
Please help me with the following problem:

I'm trying to http POST to https://www.hi.nl/amserver/UI/Login, but whatever I do I keep getting an "Not trusted server certificate" error.

This is the code I'm using:

HttpParams parameters = new BasicHttpParams();
SchemeRegistry schemeRegistry = new SchemeRegistry();
SSLSocketFactory sslSocketFactory = SSLSocketFactory
.getSocketFactory();
sslSocketFactory
.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
schemeRegistry.register(new Scheme("https", sslSocketFactory, 443));
ClientConnectionManager manager = new ThreadSafeClientConnManager(
parameters, schemeRegistry);
HttpClient client = new DefaultHttpClient(manager, parameters);

HttpPost post = new HttpPost("https://www.hi.nl/amserver/UI/Login");
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
nvps.add(new BasicNameValuePair("IDToken1", idToken1));
nvps.add(new BasicNameValuePair("IDToken2", idToken2));

post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.ISO_8859_1));
HttpResponse result = client.execute(post);

I also tried the trust-all TrustManager method from here:

http://stackoverflow.com/questions/995514/https-connection-android

and I tried to create my own keystore as spelled out here:

http://blog.antoine.li/index.php/2010/10/android-trusting-ssl-certificates/

But no matter what I keep getting this:

02-01 20:15:51.226: INFO/System.out(263): javax.net.ssl.SSLException: Not trusted server certificate
02-01 20:15:51.226: WARN/System.err(263): javax.net.ssl.SSLException: Not trusted server certificate
02-01 20:15:51.256: WARN/System.err(263): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:371)
02-01 20:15:51.256: WARN/System.err(263): at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:92)
02-01 20:15:51.266: WARN/System.err(263): at org.apache.http.conn.ssl.SSLSocketFactory.createSocket(SSLSocketFactory.java:381)
02-01 20:15:51.276: WARN/System.err(263): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:164)
02-01 20:15:51.276: WARN/System.err(263): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
02-01 20:15:51.286: WARN/System.err(263): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
02-01 20:15:51.296: WARN/System.err(263): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:348)
02-01 20:15:51.306: WARN/System.err(263): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
02-01 20:15:51.306: WARN/System.err(263): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
02-01 20:15:51.316: WARN/System.err(263): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
02-01 20:15:51.316: WARN/System.err(263): at com.test.Tester.onCreate(Tester.java:200)
02-01 20:15:51.326: WARN/System.err(263): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-01 20:15:51.336: WARN/System.err(263): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
02-01 20:15:51.346: WARN/System.err(263): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
02-01 20:15:51.346: WARN/System.err(263): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
02-01 20:15:51.356: WARN/System.err(263): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
02-01 20:15:51.356: WARN/System.err(263): at android.os.Handler.dispatchMessage(Handler.java:99)
02-01 20:15:51.366: WARN/System.err(263): at android.os.Looper.loop(Looper.java:123)
02-01 20:15:51.376: WARN/System.err(263): at android.app.ActivityThread.main(ActivityThread.java:4627)
02-01 20:15:51.376: WARN/System.err(263): at java.lang.reflect.Method.invokeNative(Native Method)
02-01 20:15:51.386: WARN/System.err(263): at java.lang.reflect.Method.invoke(Method.java:521)
02-01 20:15:51.396: WARN/System.err(263): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-01 20:15:51.396: WARN/System.err(263): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-01 20:15:51.406: WARN/System.err(263): at dalvik.system.NativeStart.main(Native Method)
02-01 20:15:51.416: WARN/System.err(263): Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Could not validate certificate signature.
02-01 20:15:51.446: WARN/System.err(263): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:168)
02-01 20:15:51.446: WARN/System.err(263): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:366)
02-01 20:15:51.455: WARN/System.err(263): ... 23 more
02-01 20:15:51.455: WARN/System.err(263): Caused by: java.security.cert.CertPathValidatorException: Could not validate certificate signature.
02-01 20:15:51.485: WARN/System.err(263): at org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi.engineValidate(PKIXCertPathValidatorSpi.java:342)
02-01 20:15:51.485: WARN/System.err(263): at java.security.cert.CertPathValidator.validate(CertPathValidator.java:202)
02-01 20:15:51.495: WARN/System.err(263): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:164)
02-01 20:15:51.495: WARN/System.err(263): ... 24 more
02-01 20:15:51.506: WARN/System.err(263): Caused by: java.security.SignatureException: Signature was not verified.
02-01 20:15:51.536: WARN/System.err(263): at org.apache.harmony.security.provider.cert.X509CertImpl.fastVerify(X509CertImpl.java:601)
02-01 20:15:51.536: WARN/System.err(263): at org.apache.harmony.security.provider.cert.X509CertImpl.verify(X509CertImpl.java:544)
02-01 20:15:51.545: WARN/System.err(263): at org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi.engineValidate(PKIXCertPathValidatorSpi.java:337)
02-01 20:15:51.545: WARN/System.err(263): ... 26 more

Thanks in advance from pointing me in the right direction!