-3

I am currently trying to check a MD5 Hash using the api provided by the following site: https://md5db.net/api/

The following code seems to produce an error and can't find the site. The code does however work for other sites. It just doesn't seem to work with the md5db.net site. Not sure what I am doing wrong.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;


public class FetchURLData {

    public static void main(String[] args) {
        try {
            URL url = new URL("https://md5db.net/api/5d41402abc4b2a76b9719d911017c592");
            BufferedReader br = new BufferedReader(newInputStreamReader(url.openStream()));
            String strTemp = "";
            while (null != (strTemp = br.readLine())) {
                System.out.println(strTemp);
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}
James Lockhart
  • 131
  • 1
  • 2
  • 11
  • 1
    *"seems to produce an error"* Do you find that description to be helpful? We don't. Perhaps you should actually show us the error, with full stacktrace. --- Also, that code doesn't compile. – Andreas Feb 01 '17 at 17:12
  • 1
    MD5 is not encryption. – zaph Feb 01 '17 at 17:13
  • 2
    A HTTPS connection requires handshaking... Similar issue: http://stackoverflow.com/questions/18576069/how-to-save-the-file-from-https-url-in-java – FrAn Feb 01 '17 at 17:16

1 Answers1

4

Update to Java 8u101 or newer.

The site uses an SSL certificate issued by Let's Encrypt, which is however not supported with Java 8u100 or earlier as mentioned here:

Does Java support Let's Encrypt certificates?

Community
  • 1
  • 1
Philipp Merkle
  • 2,555
  • 2
  • 11
  • 22