/soc/2012/michael/android: 27b4b3b4ff8f: Commented ssl classes

Michael Zangl michael at soc.pidgin.im
Mon Aug 20 10:15:53 EDT 2012


Changeset: 27b4b3b4ff8f191e85a6a3558386fe836a29ae81
Author:	 Michael Zangl <michael at soc.pidgin.im>
Date:	 2012-08-20 15:53 +0200
Branch:	 soc.2012.android
URL: http://hg.pidgin.im/soc/2012/michael/android/rev/27b4b3b4ff8f

Description:

Commented ssl classes

diffstat:

 android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/core/ssl/SslConnection.java |  63 ++++++---
 android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/core/ssl/SslOps.java        |  16 ++-
 2 files changed, 53 insertions(+), 26 deletions(-)

diffs (138 lines):

diff --git a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/core/ssl/SslConnection.java b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/core/ssl/SslConnection.java
--- a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/core/ssl/SslConnection.java
+++ b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/core/ssl/SslConnection.java
@@ -19,24 +19,34 @@ import javax.net.ssl.X509TrustManager;
  * This class handles all actions that need to be performed on a ssl connection.
  * <p>
  * It is only used internally by {@link SslOps}.
- * 
+ *
  * @author michaelz
- * 
  */
 public final class SslConnection extends Peered implements
-		HandshakeCompletedListener {
+        HandshakeCompletedListener {
 
+	/**
+	 * The socket that is encrypted with SSL.
+	 */
 	private Socket sslsocket;
+	/**
+	 * The basic socket we use.
+	 */
 	private final Socket socket;
+	/**
+	 * The purple thread we should execute the handshake compleate callback on.
+	 */
 	private final PurpleThread thread;
 
 	/**
 	 * Create a new ssl connection object for the given native pointer.
-	 * 
+	 *
 	 * @param nativePointer
 	 * @param socket
+	 * @param thread
 	 */
-	protected SslConnection(long nativePointer, Socket socket, PurpleThread thread) {
+	protected SslConnection(long nativePointer, Socket socket,
+	        PurpleThread thread) {
 		super(nativePointer);
 		this.socket = socket;
 		this.thread = thread;
@@ -45,7 +55,7 @@ public final class SslConnection extends
 	/**
 	 * Connects this socket via SSL and initiates this object. To be called once
 	 * after this object is created,
-	 * 
+	 *
 	 * @return <code>true</code> on success.
 	 */
 	protected boolean connect() {
@@ -53,30 +63,35 @@ public final class SslConnection extends
 		// SSLSocketFactory
 		// .getDefault();
 
-		TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
-			@Override
-			public java.security.cert.X509Certificate[] getAcceptedIssuers() {
-				return null;
+		TrustManager[] trustAllCerts = new TrustManager[] {
+			new X509TrustManager() {
+				@Override
+				public java.security.cert.X509Certificate[] getAcceptedIssuers() {
+					return null;
+				}
+
+				@Override
+				public void checkClientTrusted(
+				        java.security.cert.X509Certificate[] certs,
+				        String authType) {
+				}
+
+				@Override
+				public void checkServerTrusted(
+				        java.security.cert.X509Certificate[] certs,
+				        String authType) {
+				}
 			}
-
-			@Override
-			public void checkClientTrusted(
-					java.security.cert.X509Certificate[] certs, String authType) {
-			}
-
-			@Override
-			public void checkServerTrusted(
-					java.security.cert.X509Certificate[] certs, String authType) {
-			}
-		} };
+		};
 
 		try {
 			SSLContext sslContext = SSLContext.getInstance("SSL");
 			sslContext.init(null, trustAllCerts,
-					new java.security.SecureRandom());
+			        new java.security.SecureRandom());
 			SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
-			sslsocket = sslSocketFactory.createSocket(socket, getHost_native(),
-					getPort_native(), false);
+			sslsocket =
+			        sslSocketFactory.createSocket(socket, getHost_native(),
+			                getPort_native(), false);
 			((SSLSocket) sslsocket).addHandshakeCompletedListener(this);
 			((SSLSocket) sslsocket).startHandshake();
 			boolean connected = sslsocket.isConnected();
diff --git a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/core/ssl/SslOps.java b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/core/ssl/SslOps.java
--- a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/core/ssl/SslOps.java
+++ b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/core/ssl/SslOps.java
@@ -2,14 +2,26 @@ package im.pidgin.libpurple.core.ssl;
 
 import im.pidgin.libpurple.core.thread.PurpleThread;
 
-
-public final class SslOps{
+/**
+ * This are the ssl ui ops. They let libpruple access the java ssl library.
+ *
+ * @author michael
+ */
+public final class SslOps {
 	private final PurpleThread thread;
 
+	/**
+	 * Creates a new SSL operations object.
+	 *
+	 * @param thread
+	 */
 	public SslOps(PurpleThread thread) {
 		this.thread = thread;
 	}
 
+	/**
+	 * Registers the SSL operations on the libpurple core.
+	 */
 	public void register() {
 		register_native(thread);
 	}



More information about the Commits mailing list