Skip to content

Instantly share code, notes, and snippets.

@rgpower
Last active April 3, 2025 12:44
Show Gist options
  • Save rgpower/8a546cde0fca5fdec8389434fe44da59 to your computer and use it in GitHub Desktop.
Save rgpower/8a546cde0fca5fdec8389434fe44da59 to your computer and use it in GitHub Desktop.
Small utility to test Java truststore roots, easy to copy to a vm/container and run via "java -Djavax.ssl.trustStore... PKIX.java <URL>"
import java.net.*;
import java.io.*;
public class PKIX {
public static void main(String[] args) throws Exception {
URL u = new URL(args[0]);
URLConnection uc = u.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(uc.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment