You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yacy_search_server/source/de/anomic/http/AcceptEverythingTrustManage...

46 lines
1.2 KiB

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());
}
}
}