Hi Julio,

JWebUnit uses HtmlUnit as TestingEngine, and HtmlUnit uses Jakarta HttpClient 
to deals with Http connection.

I found these links :
http://www.developpez.net/forums/showthread.php?t=47270 [French]
http://jakarta.apache.org/commons/httpclient/sslguide.html

It seems to be a non trivial process. I think you should better try to get a 
non encrypted connection for your tests.

If you really want this feature, you should contact HtmlUnit developpers, 
because HttpClient configuration is hidden inside HtmlUnit, and not easily 
available to me.

++

Julien


----- Message d'origine ----
De : Julio S. G. <[EMAIL PROTECTED]>
À : jwebunit-users@lists.sourceforge.net
Envoyé le : Mardi, 23 Janvier 2007, 17h41mn 28s
Objet : [JWebUnit-users] SSL certificate validation - SSLHandshakeException

   Hi,

   Is there any way to avoid ssl certificate validation?
   I'm getting a SSLHandshakeException because my development
certificate is expired.
   The code below, if we just put it before the test, works using
httpUnit but it doesn't work with jWebUnit.
   The complete exception message is : "java.lang.RuntimeException:
javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: PKIX path validation
failed: java.security.cert.CertPathValidatorException: timestamp check
failed" that is exacty what is suppose to happen when the certificate
is expired.
   Thanks.

Julio


--------------------------------------------------------------
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;

SSLContext context = SSLContext.getInstance("SSLv3");
TrustManager[] trustManagerArray = { new NullX509TrustManager() };
context.init(null, trustManagerArray, null);
HttpsURLConnection.setDefaultSSLSocketFactory(context.getSocketFactory());
HttpsURLConnection.setDefaultHostnameVerifier(new NullHostnameVerifier());


class NullX509TrustManager implements X509TrustManager {
/* Implements all methods, keeping them empty or returning null */
}
class NullHostnameVerifier implements HostnameVerifier {
    public boolean verify(String hostname, SSLSession session) {
        return true;
    }
}

--------------------------------------------------------------

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
JWebUnit-users mailing list
JWebUnit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jwebunit-users





        

        
                
___________________________________________________________________________ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur 
Yahoo! Questions/Réponses 
http://fr.answers.yahoo.com

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
JWebUnit-users mailing list
JWebUnit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to