Class DisallowedAlgorithms


  • public class DisallowedAlgorithms
    extends Object
    A collection of insecure or otherwise undesirable digest algorithms and signature algorithms, to be used to prevent their use in the validation of digital signatures.
    • Field Detail

      • digestAlgorithms

        private final Set<String> digestAlgorithms
        Ordered set of disallowed digest algorithm URIs.
      • signatureAlgorithms

        private final Set<String> signatureAlgorithms
        Ordered set of disallowed signature algorithm URIs.
    • Constructor Detail

      • DisallowedAlgorithms

        public DisallowedAlgorithms()
        Constructor. Initializes the collections with those algorithms that should be regarded as unusable by default.
    • Method Detail

      • disallowDigest

        public void disallowDigest​(DigestChoice digestChoice)
        Add the digest and signature algorithms associated with a DigestChoice.
        Parameters:
        digestChoice - DigestChoice to add
      • allowDigest

        public void allowDigest​(DigestChoice digestChoice)
        Remove the digest and signature algorithms associated with a DigestChoice.
        Parameters:
        digestChoice - DigestChoice to remove
      • isDigestAlgorithmDisallowed

        public boolean isDigestAlgorithmDisallowed​(String alg)
        Returns true if the indicated algorithm URI is disallowed for use as a digest algorithm.
        Parameters:
        alg - digest algorithm URI to check
        Returns:
        true if the algorithm is disallowed
      • isSignatureAlgorithmDisallowed

        public boolean isSignatureAlgorithmDisallowed​(String alg)
        Returns true if the indicated algorithm URI is disallowed for use as a signature algorithm.
        Parameters:
        alg - signature algorithm URI to check
        Returns:
        true if the algorithm is disallowed
      • allowAllDigests

        public void allowAllDigests()
        Empties the disallowed digest and signature algorithm lists.
      • list

        public void list​(PrintStream out)
        List out the contents of the algorithm collections.
        Parameters:
        out - stream to send the listing to