Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1351 - development/main/transit/handler/src/main/net/dpml/transit/artifact

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT netcompartner.com
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1351 - development/main/transit/handler/src/main/net/dpml/transit/artifact
  • Date: Mon, 03 Jan 2005 07:57:43 +0100

Author: mcconnell
Date: Mon Jan 3 07:57:42 2005
New Revision: 1351

Removed:

development/main/transit/handler/src/main/net/dpml/transit/artifact/AllowSelfCertTrustManager.java
Modified:

development/main/transit/handler/src/main/net/dpml/transit/artifact/MavenResourceHost.java
Log:
Remove AllowSelfCertTrustManager and replace with NullTrustManager as a
private inner-class within MavenResourceHost.

Modified:
development/main/transit/handler/src/main/net/dpml/transit/artifact/MavenResourceHost.java
==============================================================================
---
development/main/transit/handler/src/main/net/dpml/transit/artifact/MavenResourceHost.java
(original)
+++
development/main/transit/handler/src/main/net/dpml/transit/artifact/MavenResourceHost.java
Mon Jan 3 07:57:42 2005
@@ -30,6 +30,8 @@

import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;

import java.util.HashMap;
import java.util.HashSet;
@@ -39,6 +41,9 @@
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+
+

/** This class represents a single host where resources are stored at.
* <p>
@@ -373,9 +378,9 @@
if( m_trusted )
{
HttpsURLConnection ssl = (HttpsURLConnection) conn;
- TrustManager tm = new AllowSelfCertTrustManager();
+ TrustManager nullTrustManager = new NullTrustManager();
SSLContext ctx = SSLContext.getInstance( "SSLv3" );
- ctx.init( null, new TrustManager[] {tm}, null );
+ ctx.init( null, new TrustManager[]{nullTrustManager}, null );
SSLSocketFactory factory = ctx.getSocketFactory();
ssl.setSSLSocketFactory( factory );
}
@@ -418,4 +423,47 @@
{
return "[HOST: " + m_baseUrl + "]";
}
+
+ /**
+ * A null trust manager that will accept any certificate. I.e. this
+ * class performs NO TRUST MANAGEMENT and simply serves as a mechanism
+ * through which https connections can be established with the same notion
+ * of trust as a http connection (i.e. none).
+ */
+ private static final class NullTrustManager
+ implements X509TrustManager
+ {
+ private static final X509Certificate[] EMPTY_CERTS = new
X509Certificate[0];
+
+ /**
+ * Null implementation.
+ * @param certs the supplied certs (ignored)
+ * @param authType the supplied type (ignored)
+ * @exception CertificateException never thrown
+ */
+ public void checkServerTrusted( final X509Certificate[] certs, final
String authType )
+ throws CertificateException
+ {
+ }
+
+ /**
+ * Null implementation.
+ * @param certs the supplied certs (ignored)
+ * @param authType the supplied type (ignored)
+ * @exception CertificateException never thrown
+ */
+ public void checkClientTrusted( final X509Certificate[] certs, final
String authType )
+ throws CertificateException
+ {
+ }
+
+ /**
+ * Null implementation.
+ * @return an empty certificate array
+ */
+ public X509Certificate[] getAcceptedIssuers()
+ {
+ return EMPTY_CERTS;
+ }
+ }
}



  • svn commit: r1351 - development/main/transit/handler/src/main/net/dpml/transit/artifact, mcconnell, 01/03/2005

Archive powered by MHonArc 2.6.24.

Top of Page