2015-03-02 2 views
0

я написал код в JDK 1.6Как получить SSLParameters JDK 1,5

SSLContext context = SSLContext.getInstance("TLS"); 
     context.init(null, tmf.getTrustManagers(), null); 
     SSLParameters params = context.getSupportedSSLParameters(); 
     List<String> enabledCiphers = new ArrayList<String>(); 
     for (String cipher : params.getCipherSuites()) { 
      boolean exclude = false; 
      if (exludedCipherSuites != null) { 
       for (int i = 0; i < exludedCipherSuites.length && !exclude; i++) { 
        exclude = cipher.indexOf(exludedCipherSuites[i]) >= 0; 
       } 
      } 
      if (!exclude) { 
       enabledCiphers.add(cipher); 
      } 
     } 
     String[] cArray = new String[enabledCiphers.size()]; 



     SSLSocketFactory sf = context.getSocketFactory(); 
     sf = new DOSSLSocketFactory(sf, cArray); 
     urlConnection.setSSLSocketFactory(sf); 

Проблема заключается в том, что в JDK 1.5 У меня нет SSLParameters. Как я могу решить проблему в JDK 1.5?

+0

Вы должны сделать это на SSLSocketFactory вместо SSLContext. – EJP

ответ