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 ed44f7ad61
commit 2a88b22ae1
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

@ -53,7 +53,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 {
System.out.println("Need a RIM file to validate!");
System.exit(1);