2011-03-31 151 views
0

我正在为Android 1.5编写应用程序。 想知道Android 1.5版本是否支持128位或其他的SSL?Android SSL支持

回答

2

肯定的是,在这里它忽略证书错误代码:

public static String makeGETRequest(String s,String encoding) 
{ 

    DefaultHttpClient http = new DefaultHttpClient(); 
    SSLSocketFactory ssl = (SSLSocketFactory)http.getConnectionManager().getSchemeRegistry().getScheme("https").getSocketFactory(); 
    ssl.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); 

    HttpResponse res; 
    try { 

     res = http.execute(new HttpGet(s)); 
     InputStream is = res.getEntity().getContent(); 
     BufferedInputStream bis = new BufferedInputStream(is); 
     ByteArrayBuffer baf = new ByteArrayBuffer(50); 
     int current = 0; 
     while((current = bis.read()) != -1){ 
       baf.append((byte)current); 
     } 

     return new String(baf.toByteArray(),encoding); 
     } 
    catch (ClientProtocolException e) { 
     // TODO Auto-generated catch block 
     return "error: " + e.getMessage(); 
    } 
    catch (IOException e) { 
     // TODO Auto-generated catch block 
     return "error: " + e.getMessage(); 
    } 

} 
+0

因此,它是128位? – rayman 2011-03-31 13:25:19

+0

我用它与公钥RSA(1024位)和RSA(2048位)不知道这是什么意思^^ – 2red13 2011-03-31 13:40:39