Class AbstractAlgorithm

java.lang.Object
se.swedenconnect.security.algorithms.impl.AbstractAlgorithm
All Implemented Interfaces:
Algorithm
Direct Known Subclasses:
AbstractJoseAlgorithm, MessageDigestAlgorithmImpl

public abstract class AbstractAlgorithm extends Object implements Algorithm
Abstract implementation of an Algorithm.
Author:
Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
  • Constructor Details

    • AbstractAlgorithm

      public AbstractAlgorithm(String uri, int order, String jcaName)
      Constructor.
      Parameters:
      uri - the algorithm URI
      order - the ordering for the algorithm
      jcaName - the JCA name
    • AbstractAlgorithm

      protected AbstractAlgorithm(String uri)
      Protected constructor used by builders.
      Parameters:
      uri - the algorithm URI
  • Method Details

    • getUri

      public String getUri()
      Gets the URI representation of the algorithm.
      Specified by:
      getUri in interface Algorithm
      Returns:
      the URI
    • getJcaName

      public String getJcaName()
      Gets the JCA (Java Cryptography Architecture) name.
      Specified by:
      getJcaName in interface Algorithm
      Returns:
      the JCA name
    • getOrder

      public int getOrder()
      Gets the order for an algorithm where a lower order is seen as more preferable than an algorithm with a higher ordering. The ordering is relative to algorithms of the same type, and also other critera such as key or key length material.
      Specified by:
      getOrder in interface Algorithm
      Returns:
      a positive integer
    • setJcaName

      protected void setJcaName(String jcaName)
      Assigns the JCA name.
      Parameters:
      jcaName - the JCA name
    • setOrder

      protected void setOrder(int order)
      Assigns the algorithm order.
      Parameters:
      order - the order
    • isBlacklisted

      public boolean isBlacklisted()
      Tells whether this algorithm is black-listed, i.e., configured to not be allowed.
      Specified by:
      isBlacklisted in interface Algorithm
      Returns:
      true if the algorithm is black-listed and false otherwise
    • setBlacklisted

      public void setBlacklisted(boolean blacklisted)
      Sets whether this algorithm is blacklisted. The default is false.
      Parameters:
      blacklisted - whether this algorithm is blacklisted
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object