Class NamedCurveRegistryImpl
java.lang.Object
se.swedenconnect.security.algorithms.curves.NamedCurveRegistryImpl
- All Implemented Interfaces:
NamedCurveRegistry
- Direct Known Subclasses:
StaticNamedCurveRegistry
Implementation of the
NamedCurveRegistry
interface.- Author:
- Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.NamedCurveRegistryImpl
(List<NamedCurve> registry) Constructor setting up the registry according to the supplied list. -
Method Summary
Modifier and TypeMethodDescriptionGets aNamedCurve
based on its name.getCurve
(Predicate<NamedCurve> predicate) Gets aNamedCurve
based on the given predicate.getCurves
(Predicate<NamedCurve> predicate) Gets all curves that matches the given predicate.void
register
(NamedCurve curve) Registers the given curve in the registry.void
unregister
(String name) Removes the given curve from the registry.
-
Constructor Details
-
NamedCurveRegistryImpl
public NamedCurveRegistryImpl()Default constructor. -
NamedCurveRegistryImpl
Constructor setting up the registry according to the supplied list.Note: a copy of the supplied registry is made.
- Parameters:
registry
- initial contents of the registry
-
-
Method Details
-
register
Registers the given curve in the registry.- Parameters:
curve
- the curve to register
-
unregister
Removes the given curve from the registry.- Parameters:
name
- the curve name
-
getCurve
Gets aNamedCurve
based on its name.- Specified by:
getCurve
in interfaceNamedCurveRegistry
- Parameters:
name
- the name- Returns:
- the NamedCurve or null if no match is found
-
getCurve
Gets aNamedCurve
based on the given predicate.- Specified by:
getCurve
in interfaceNamedCurveRegistry
- Parameters:
predicate
- the predicate- Returns:
- the first curve that matches the supplied predicate, or null if no matches are found
-
getCurves
Gets all curves that matches the given predicate.- Specified by:
getCurves
in interfaceNamedCurveRegistry
- Parameters:
predicate
- the predicate- Returns:
- a (possibly empty) list of NamedCurve objects
-