I'm trying to download a captcha image from a specific URL because I'm working on a program to solve simple captchas. The url I'm using: https://www.mannschaftsfoto-nrw.de/rpc/captcha/Ddc3Lp5eOshwmzWfpgL4cNCTnZTcOU2T I've read many posts before and tried different things, what I'm using right now is this code:
URL url = new URL("https://www.mannschaftsfoto-nrw.de/rpc/captcha/Ddc3Lp5eOshwmzWfpgL4cNCTnZTcOU2T");
InputStream in = new BufferedInputStream(url.openStream());
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
int n = 0;
while (-1!=(n=in.read(buf)))
{
out.write(buf, 0, n);
}
out.close();
in.close();
byte[] response = out.toByteArray();
FileOutputStream fos = new FileOutputStream("C://captcha.jpg");
fos.write(response);
fos.close();
This does in fact work when I'm using a different URL like a google image, but it doesn't work for my link. I get the Exception:
Exception: javax.net.ssl.SSLException: java.lang.RuntimeException: Could not generate DH keypair
Can this function even work, although the link doesn't end on ".png"?