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 classAbstractAlgorithm.AbstractAlgorithmBuilder<T extends AbstractAlgorithm,B extends AlgorithmBuilder<T>> Abstract builder for creatingAlgorithmobjects. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractAlgorithm(String uri) Protected constructor used by builders.AbstractAlgorithm(String uri, int order, String jcaName) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the JCA (Java Cryptography Architecture) name.intgetOrder()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.inthashCode()booleanTells whether this algorithm is black-listed, i.e., configured to not be allowed.voidsetBlacklisted(boolean blacklisted) Sets whether this algorithm is blacklisted.protected voidsetJcaName(String jcaName) Assigns the JCA name.protected voidsetOrder(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:
getJcaNamein 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:
isBlacklistedin 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
-