Class AlgorithmPredicates

java.lang.Object
se.swedenconnect.security.algorithms.AlgorithmPredicates

public class AlgorithmPredicates extends Object
A set of "ready-to-go" predicates to use when searching for algorithms in the AlgorithmRegistry.
Author:
Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
  • Method Details

    • notBlacklisted

      public static Predicate<Algorithm> notBlacklisted()
      A predicate that can be combined with other predicates to ensure that the resulting Algorithm is not blacklisted.
      Returns:
      a predicate
    • fromJcaName

      public static Predicate<Algorithm> fromJcaName(String jcaName)
      Predicate for finding an algorithm based on its JCA name.
      Parameters:
      jcaName - the JCA name
      Returns:
      a predicate
    • fromType

      public static Predicate<Algorithm> fromType(AlgorithmType type)
      Predicate for finding an algorithm based on its type.
      Parameters:
      type - the algorithm type
      Returns:
      a predicate
    • fromKeyType

      public static Predicate<Algorithm> fromKeyType(String keyType)
      Predicate for finding an algorithm based on its key type.
      Parameters:
      keyType - the key type
      Returns:
      a predicate
    • fromAlgorithmIdentifier

      public static Predicate<Algorithm> fromAlgorithmIdentifier(org.bouncycastle.asn1.x509.AlgorithmIdentifier algorithmIdentifier)
      Predicate for finding an algorithm based on its AlgorithmIdentifier.
      Parameters:
      algorithmIdentifier - the algorithm identifier
      Returns:
      a predicate
    • fromAlgorithmIdentifierRelaxed

      public static Predicate<Algorithm> fromAlgorithmIdentifierRelaxed(org.bouncycastle.asn1.x509.AlgorithmIdentifier algorithmIdentifier)
      Predicate for finding an algorithm based on its AlgorithmIdentifier. The method implementation is "relaxed" which means that if no parameters are supplied in the algorithmIdentifier the comparison of parameters will be excluded. This covers for the case when the special NULL param is used.

      Also, for RSA-PSS, we compare only the digest part of the parameters.

      Parameters:
      algorithmIdentifier - the algorithm identifier
      Returns:
      a predicate