Skip to content

Commit

Permalink
Merge pull request #435 from fcojfernandez/issue-343
Browse files Browse the repository at this point in the history
Missing non-compliant algorithms in FIPS mode to filter
  • Loading branch information
fcojfernandez authored Oct 14, 2024
2 parents e864bf4 + 40757e7 commit 990b9d3
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.nimbusds.jose.crypto.RSASSASigner;
import com.nimbusds.jose.crypto.impl.AESCryptoProvider;
import com.nimbusds.jose.crypto.impl.ContentCryptoProvider;
import com.nimbusds.jose.crypto.impl.ECDHCryptoProvider;
import com.nimbusds.jose.crypto.impl.PasswordBasedCryptoProvider;
import com.nimbusds.jose.crypto.impl.RSACryptoProvider;
import edu.umd.cs.findbugs.annotations.NonNull;
Expand Down Expand Up @@ -39,14 +38,17 @@ public class OicAlgorithmValidatorFIPS140 {
// Init compliant JWE algorithms
JWESupportedAlgorithms.addAll(AESCryptoProvider.SUPPORTED_ALGORITHMS);
JWESupportedAlgorithms.addAll(RSACryptoProvider.SUPPORTED_ALGORITHMS);
JWESupportedAlgorithms.addAll(PasswordBasedCryptoProvider.SUPPORTED_ALGORITHMS);
// RSA1_5 is deprecated and not a compliant algorithm.
// ECDH seems to use its own key derivation function (ConcatKDF) and so not compliant. Not adding
// ECDHCryptoProvider.SUPPORTED_ALGORITHMS
JWESupportedAlgorithms.remove(JWEAlgorithm.RSA1_5);
JWESupportedAlgorithms.addAll(ECDHCryptoProvider.SUPPORTED_ALGORITHMS);
JWESupportedAlgorithms.addAll(PasswordBasedCryptoProvider.SUPPORTED_ALGORITHMS);

// Init complaint EncryptionMethods
// Init complaint EncryptionMethods and remove non-compliant algorithms
supportedEncryptionMethod.addAll(ContentCryptoProvider.SUPPORTED_ENCRYPTION_METHODS);
supportedEncryptionMethod.remove(EncryptionMethod.XC20P);
supportedEncryptionMethod.remove(EncryptionMethod.A128CBC_HS256_DEPRECATED);
supportedEncryptionMethod.remove(EncryptionMethod.A256CBC_HS512_DEPRECATED);
}

/**
Expand Down

0 comments on commit 990b9d3

Please sign in to comment.