Class AbstractAlgorithm
java.lang.Object
se.swedenconnect.security.algorithms.impl.AbstractAlgorithm
- All Implemented Interfaces:
Algorithm
- Direct Known Subclasses:
AbstractJoseAlgorithm
,MessageDigestAlgorithmImpl
Abstract implementation of an
Algorithm
.- Author:
- Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
AbstractAlgorithm.AbstractAlgorithmBuilder<T extends AbstractAlgorithm,
B extends AlgorithmBuilder<T>> Abstract builder for creatingAlgorithm
objects. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractAlgorithm
(String uri) Protected constructor used by builders.AbstractAlgorithm
(String uri, int order, String jcaName) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets the JCA (Java Cryptography Architecture) name.int
getOrder()
Gets the order for an algorithm where a lower order is seen as more preferable than an algorithm with a higher ordering.getUri()
Gets the URI representation of the algorithm.int
hashCode()
boolean
Tells whether this algorithm is black-listed, i.e., configured to not be allowed.void
setBlacklisted
(boolean blacklisted) Sets whether this algorithm is blacklisted.protected void
setJcaName
(String jcaName) Assigns the JCA name.protected void
setOrder
(int order) Assigns the algorithm order.toString()
-
Constructor Details
-
AbstractAlgorithm
Constructor.- Parameters:
uri
- the algorithm URIorder
- the ordering for the algorithmjcaName
- the JCA name
-
AbstractAlgorithm
Protected constructor used by builders.- Parameters:
uri
- the algorithm URI
-
-
Method Details
-
getUri
Gets the URI representation of the algorithm. -
getJcaName
Gets the JCA (Java Cryptography Architecture) name.- Specified by:
getJcaName
in interfaceAlgorithm
- 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. -
setJcaName
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 interfaceAlgorithm
- 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 isfalse
.- Parameters:
blacklisted
- whether this algorithm is blacklisted
-
hashCode
public int hashCode() -
equals
-
toString
-