yacy_search_server/source/de/anomic/http/AcceptEverythingTrustManager.java
orbiter 024da2916b refactoring of logging
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5544 6c8d7289-2bf4-0310-a012-ef5d649a1542
2009-01-30 23:33:47 +00:00

46 lines
1.2 KiB
Java

package de.anomic.http;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.X509TrustManager;
import de.anomic.kelondro.util.Log;
/**
* trust every server
*
* @author daniel
*
*/
class AcceptEverythingTrustManager extends EasyX509TrustManager implements X509TrustManager {
/**
* constructor
*
* @param keystore
* @throws NoSuchAlgorithmException
* @throws KeyStoreException
*/
public AcceptEverythingTrustManager() throws NoSuchAlgorithmException, KeyStoreException {
super(null);
}
/*
* (non-Javadoc)
*
* @see javax.net.ssl.X509TrustManager#checkServerTrusted(java.security.cert.X509Certificate[], java.lang.String)
*/
@Override
public void checkServerTrusted(final X509Certificate[] chain, final String authType) throws CertificateException {
try {
super.checkServerTrusted(chain, authType);
} catch (final Exception e) {
// trusted but logged
Log.logWarning("HTTPC", "trusting SSL certificate with " + e.getClass() + ": " + e.getMessage());
}
}
}