Add comments
This commit is contained in:
@@ -32,7 +32,7 @@ public class SSLCertChecker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e){
|
catch (IOException e){
|
||||||
System.out.println("Error reading file");
|
System.out.println("Error reading file"+e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void checkCert(String curl){
|
public static void checkCert(String curl){
|
||||||
@@ -41,6 +41,8 @@ public class SSLCertChecker {
|
|||||||
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
|
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
|
||||||
connection.connect();
|
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();
|
Certificate[] certs = connection.getServerCertificates();
|
||||||
for (Certificate cert : certs) {
|
for (Certificate cert : certs) {
|
||||||
if (cert instanceof X509Certificate) {
|
if (cert instanceof X509Certificate) {
|
||||||
@@ -64,10 +66,15 @@ public class SSLCertChecker {
|
|||||||
System.out.println("Fehler beim Abrufen des Zertifikats: " + e.getMessage());
|
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){
|
public static void main(String[] args){
|
||||||
if(args.length <1)
|
if(args.length <1){
|
||||||
System.out.println("Kein Url-File angegeben");
|
System.out.println("Kein Url-File angegeben");
|
||||||
readUrls(args[0]);
|
}
|
||||||
|
else
|
||||||
|
readUrls(args[0]);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user