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 anAlgorithm.- Author:
- Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classAbstractAlgorithm.AbstractAlgorithmBuilder<T extends AbstractAlgorithm,B extends AlgorithmBuilder<T>>Abstract builder for creatingAlgorithmobjects.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractAlgorithm(String uri)Protected constructor used by builders.AbstractAlgorithm(String uri, int order, String jcaName)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)StringgetJcaName()Gets 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.StringgetUri()Gets the URI representation of the algorithm.inthashCode()booleanisBlacklisted()Tells 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.StringtoString()
-
-
-
Constructor Detail
-
AbstractAlgorithm
public AbstractAlgorithm(String uri, int order, String jcaName)
Constructor.- Parameters:
uri- the algorithm URIorder- the ordering for the algorithmjcaName- the JCA name
-
AbstractAlgorithm
protected AbstractAlgorithm(String uri)
Protected constructor used by builders.- Parameters:
uri- the algorithm URI
-
-
Method Detail
-
getUri
public String getUri()
Gets the URI representation of the algorithm.
-
getJcaName
public String 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
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:
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
-
-