Log an error instead of throwing an exception when a signing key cannot be located in the provided truststore

This commit is contained in:
chubtub 2024-02-01 10:15:54 -05:00
parent 3fbc0e743c
commit f6f1ab4ee7
2 changed files with 10 additions and 1 deletions

View File

@ -257,6 +257,11 @@ public class ReferenceManifestValidator {
X509Certificate signingCert = null;
try {
signingCert = getCertFromTruststore();
if (signingCert == null) {
log.error("Unable to locate the signing cert in the provided truststore "
+ trustStoreFile);
return false;
}
} catch (IOException e) {
log.warn("Error while parsing signing cert from truststore: " + e.getMessage());
return false;

View File

@ -62,7 +62,11 @@ public class Main {
System.out.println("A single cert cannot be used for verification. " +
"The signing cert will be searched for in the trust store.");
}
validator.validateSwidtagFile(verifyFile);
if (validator.validateSwidtagFile(verifyFile)) {
System.out.println("Successfully verified " + verifyFile);
} else {
System.out.println("Failed to verify " + verifyFile);
}
} else {
gateway = new SwidTagGateway();
if (commander.isVerbose()) {