Merge pull request #66 from cconlon/certPathValidatorFIPSFix

CertPathValidator: set PKIXParameters Signature provider if null with wolfCrypt FIPS
pull/69/head
András Fekete 2024-03-11 16:29:57 -04:00 committed by GitHub
commit 0497ee767c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 3 deletions

View File

@ -653,9 +653,16 @@ public class WolfCryptPKIXCertPathValidator extends CertPathValidatorSpi {
/* If we are in FIPS mode, verify wolfJCE is the Signature provider
* to help maintain FIPS compliance */
if (Fips.enabled && pkixParams.getSigProvider() != "wolfJCE") {
throw new CertPathValidatorException(
"CertPathParameters Signature Provider must be wolfJCE " +
"when using wolfCrypt FIPS");
if (pkixParams.getSigProvider() == null) {
/* Preferred Signature provider not set, set to wolfJCE */
pkixParams.setSigProvider("wolfJCE");
}
else {
throw new CertPathValidatorException(
"CertPathParameters Signature Provider must be wolfJCE " +
"when using wolfCrypt FIPS: " +
pkixParams.getSigProvider());
}
}
/* Use wolfSSL CertManager to facilitate chain verification */