/**@class org.apache.http.conn.ssl.SSLSocketFactory implements org.apache.http.conn.scheme.LayeredSocketFactory @extends java.lang.Object Layered socket factory for TLS/SSL connections, based on JSSE. . <p> SSLSocketFactory can be used to validate the identity of the HTTPS server against a list of trusted certificates and to authenticate to the HTTPS server using a private key. </p> <p> SSLSocketFactory will enable server authentication when supplied with a {@link KeyStore truststore} file containg one or several trusted certificates. The client secure socket will reject the connection during the SSL session handshake if the target HTTPS server attempts to authenticate itself with a non-trusted certificate. </p> <p> Use JDK keytool utility to import a trusted certificate and generate a truststore file: <pre> keytool -import -alias "my server cert" -file server.crt -keystore my.truststore </pre> </p> <p> SSLSocketFactory will enable client authentication when supplied with a {@link KeyStore keystore} file containg a private key/public certificate pair. The client secure socket will use the private key to authenticate itself to the target HTTPS server during the SSL session handshake if requested to do so by the server. The target HTTPS server will in its turn verify the certificate presented by the client in order to establish client's authenticity </p> <p> Use the following sequence of actions to generate a keystore file </p> <ul> <li> <p> Use JDK keytool utility to generate a new key <pre>keytool -genkey -v -alias "my client key" -validity 365 -keystore my.keystore</pre> For simplicity use the same password for the key as that of the keystore </p> </li> <li> <p> Issue a certificate signing request (CSR) <pre>keytool -certreq -alias "my client key" -file mycertreq.csr -keystore my.keystore</pre> </p> </li> <li> <p> Send the certificate request to the trusted Certificate Authority for signature. One may choose to act as her own CA and sign the certificate request using a PKI tool, such as OpenSSL. </p> </li> <li> <p> Import the trusted CA root certificate <pre>keytool -import -alias "my trusted ca" -file caroot.crt -keystore my.keystore</pre> </p> </li> <li> <p> Import the PKCS#7 file containg the complete certificate chain <pre>keytool -import -alias "my client key" -file mycert.p7 -keystore my.keystore</pre> </p> </li> <li> <p> Verify the content the resultant keystore file <pre>keytool -list -v -keystore my.keystore</pre> </p> </li> </ul> @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a> @author Julius Davies @deprecated Please use {@link java.net.URL#openConnection} instead. Please visit <a href="http://android-developers.blogspot.com/2011/09/androids-http-clients.html">this webpage</a> for further details. */ var SSLSocketFactory = { /***/ TLS : "TLS", /***/ SSL : "SSL", /***/ SSLV2 : "SSLv2", /***/ ALLOW_ALL_HOSTNAME_VERIFIER : "null", /***/ BROWSER_COMPATIBLE_HOSTNAME_VERIFIER : "null", /***/ STRICT_HOSTNAME_VERIFIER : "null", /**Gets an singleton instance of the SSLProtocolSocketFactory. @return {Object {org.apache.http.conn.ssl.SSLSocketFactory}} a SSLProtocolSocketFactory */ getSocketFactory : function( ) {}, /** */ createSocket : function( ) {}, /** */ connectSocket : function( ) {}, /**Checks whether a socket connection is secure. This factory creates TLS/SSL socket connections which, by default, are considered secure. <br/> Derived classes may override this method to perform runtime checks, for example based on the cypher suite. @param {Object {Socket}} sock the connected socket @return {Boolean} <code>true</code> @throws IllegalArgumentException if the argument is invalid */ isSecure : function( ) {}, /** */ createSocket : function( ) {}, /** */ setHostnameVerifier : function( ) {}, /** */ getHostnameVerifier : function( ) {}, };