From e1188e3178cf4b4432e2617dcee883775e4887da Mon Sep 17 00:00:00 2001 From: Kotschak Date: Thu, 13 Feb 2025 11:45:27 +0100 Subject: [PATCH] Add comments --- src/SSLCertChecker.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/SSLCertChecker.java b/src/SSLCertChecker.java index 10b20c4..92a4e6b 100644 --- a/src/SSLCertChecker.java +++ b/src/SSLCertChecker.java @@ -32,7 +32,7 @@ public class SSLCertChecker { } } catch (IOException e){ - System.out.println("Error reading file"); + System.out.println("Error reading file"+e.getMessage()); } } public static void checkCert(String curl){ @@ -41,6 +41,8 @@ public class SSLCertChecker { HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); connection.connect(); + // Get the Cert Chain and check for every Certificate in the line + // First one is usually the own Cert, the ones after the CA Certificate[] certs = connection.getServerCertificates(); for (Certificate cert : certs) { if (cert instanceof X509Certificate) { @@ -64,10 +66,15 @@ public class SSLCertChecker { System.out.println("Fehler beim Abrufen des Zertifikats: " + e.getMessage()); } } + // + // first args needs to be a file with the domains listed. Every domain needs to have its own line + // public static void main(String[] args){ - if(args.length <1) + if(args.length <1){ System.out.println("Kein Url-File angegeben"); - readUrls(args[0]); + } + else + readUrls(args[0]); } }