KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > javax > net > ssl > SSLContext

javax.net.ssl
Class SSLContext

java.lang.Object
  extended by javax.net.ssl.SSLContext
See Also:
Top Examples, Source Code

public final SSLEngine createSSLEngine()
See Also:
UnsupportedOperationException, createSSLEngine(String, int)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final SSLEngine createSSLEngine(String peerHost,
                                       int peerPort)
See Also:
UnsupportedOperationException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final SSLSessionContext getClientSessionContext()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static SSLContext getInstance(String protocol)
                              throws NoSuchAlgorithmException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static SSLContext getInstance(String protocol,
                                     String provider)
                              throws NoSuchAlgorithmException,
                                     NoSuchProviderException
See Also:
IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static SSLContext getInstance(String protocol,
                                     Provider provider)
                              throws NoSuchAlgorithmException
See Also:
IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final String getProtocol()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final Provider getProvider()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final SSLSessionContext getServerSessionContext()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final SSLServerSocketFactory getServerSocketFactory()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final SSLSocketFactory getSocketFactory()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final void init(KeyManager[] km,
                       TrustManager[] tm,
                       SecureRandom random)
                throws KeyManagementException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[620]Trust All Https Certificates
By vijay { dot } rishi { at } webrizon { dot } com on 2004/09/13 12:11:40  Rate
private static void trustAllHttpsCertificates (  )  throws Exception  
  {  
   System.setProperty ( "java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol" ) ; //add https protocol handler 
   java.security.Security.addProvider ( new com.sun.net.ssl.internal.ssl.Provider (  )  ) ; //dynamic registration of SunJSSE provider  
  
  
   //Create a trust manager that does not validate certificate chains: 
   com.sun.net.ssl.TrustManager [  ]  trustAllCerts = new com.sun.net.ssl.TrustManager [  ]   
    { new com.sun.net.ssl.X509TrustManager (  )   
    {  
     public java.security.cert.X509Certificate [  ]  getAcceptedIssuers (  )   
      {  
       return null; 
      }  
     public boolean isServerTrusted ( java.security.cert.X509Certificate [  ]  certs )   
      {  
       return true; 
      }  
     public boolean isClientTrusted ( java.security.cert.X509Certificate [  ]  certs )   {  
     return true; 
      }  
     public void checkServerTrusted ( java.security.cert.X509Certificate [  ]  certs, String authType )  throws javax.security.cert.CertificateException  {  
     return; 
      }  
     public void checkClientTrusted ( java.security.cert.X509Certificate [  ]  certs, String authType )  throws javax.security.cert.CertificateException  {  
     return; 
      }  
    } //X509TrustManager 
    } ;//TrustManager [  ]  
  
  
   javax.net.ssl.SSLContext sc = javax.net.ssl.SSLContext.getInstance ( "SSL" ) ; 
   sc.init ( new javax.net.ssl.X509KeyManager [  ]  {  } , trustAllCerts, new java.security.SecureRandom (  )  ) ; 
   javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory ( sc.getSocketFactory (  )  ) ; 
  
  
  }    
  
  
 


protected SSLContext(SSLContextSpi contextSpi,
                     Provider provider,
                     String protocol)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags