ciao!
per un programmino mi servirebbe scaricare una libreria dal web.
solo che l'indirizzo è in HTTPS, e quando provo a scaricarlo da java mi da questo errore:
codice:
java.lang.RuntimeException: Could not generate DH keypair
per il download sto usando la libreria Apache Commons IO, ma leggendo in giro non dovrebbe dipendere da quello.
ed infatti ho trovato vari esempi tipo questo:
codice:
public void install() throws IOException, KeyManagementException, NoSuchAlgorithmException {
TrustManager[] trustAllCerts;
trustAllCerts = new TrustManager[]{
new X509TrustManager() {
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
@Override
public void checkClientTrusted(
X509Certificate[] certs, String authType) {
}
@Override
public void checkServerTrusted(
X509Certificate[] certs, String authType) {
}
}
};
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
FileUtils.copyURLToFile(new URL(remoteFile), new File(fileYdl), 20000, 20000);
ydlEnd.setExecutable(true);
}
però non riesco ad applicarlo, nel senso che mi da cmq quell'errore.
posso anche fare a meno di Apache Commons IO ovviamente.
ma mi manca cmq qualcosa.
avete qualche dritta??