2009/10/13 vonguyen <lie...@gmail.com>:
>
> Hello Cyryl.
>
> To connect you can do follow:
>
> try {
>                        SSLContext sc = SSLContext.getInstance("TLS");
>                        sc.init(null, new TrustManager[] { new 
> MyTrustManager() },
>                                        new SecureRandom());
>                        HttpsURLConnection
>                                        
> .setDefaultSSLSocketFactory(sc.getSocketFactory());
>                        HttpsURLConnection
>                                        .setDefaultHostnameVerifier(new 
> MyHostnameVerifier());
>                        HttpsURLConnection con = (HttpsURLConnection) new 
> URL(HTTPS)
>                                        .openConnection();
>                        con.setDoOutput(true);
>                        con.setDoInput(true);
>                        con.connect();
> }
> catch (IOException e) {
>                        System.err.println(e);
> } catch (NoSuchAlgorithmException e) {
>        // TODO Auto-generated catch block
>                        e.printStackTrace();
>                } catch (KeyManagementException e) {
>                        // TODO Auto-generated catch block
>                        e.printStackTrace();
> }
>
> //---------------------------------------------------------------------
> public class MyHostnameVerifier implements HostnameVerifier {
>       �...@override
>        public boolean verify(String arg0, SSLSession arg1) {
>                // TODO Auto-generated method stub
>                return true;
>        }
> }
>
>
> //------------------------------------------------------
>
> public class MyTrustManager implements X509TrustManager
> {
>
>   �...@override
>    public X509Certificate[] getAcceptedIssuers() {
>            return null;
>    }
>
>       �...@override
>        public void checkClientTrusted(X509Certificate[] arg0,
>                        String arg1) throws CertificateException {
>                // TODO Auto-generated method stub
>
>        }
>
>       �...@override
>        public void checkServerTrusted(X509Certificate[] arg0,
>                        String arg1) throws CertificateException {
>                // TODO Auto-generated method stub
>
>        }
> }
>


thanks for the enaswer, where can I put the password auth credentials ?

-- 
Cyryl Płotnicki-Chudyk
+48 697 088 885

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to