Skip to content

Commit

Permalink
0005896: Fixed ValidatorException while validating self-signed X509 c…
Browse files Browse the repository at this point in the history
…ertificate
  • Loading branch information
evan-miller-jumpmind committed Jun 27, 2023
1 parent b05b33c commit 36b43b1
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,22 @@ public void checkServerTrusted(X509Certificate[] certificates, String authType)
log.debug("X509Certificate[" + i + "]=" + certificates[i]);
}
}
if ((certificates != null) && (certificates.length == 1)) {
certificates[0].checkValidity();
} else {
standardTrustManager.checkServerTrusted(certificates, authType);
if (certificates != null) {
if (certificates.length == 1 && certificates[0] != null) {
certificates[0].checkValidity();
return;
} else if (certificates.length > 1 && certificates[0] != null) {
boolean certificatesAreEqual = true;
for (int i = 1; i < certificates.length; i++) {
certificatesAreEqual &= certificates[0].equals(certificates[i]);
}
if (certificatesAreEqual) {
certificates[0].checkValidity();
return;
}
}
}
standardTrustManager.checkServerTrusted(certificates, authType);
}

/**
Expand Down

0 comments on commit 36b43b1

Please sign in to comment.