Class NamedCurveRegistryImpl

java.lang.Object
se.swedenconnect.security.algorithms.curves.NamedCurveRegistryImpl
All Implemented Interfaces:
NamedCurveRegistry
Direct Known Subclasses:
StaticNamedCurveRegistry

public class NamedCurveRegistryImpl extends Object implements NamedCurveRegistry
Implementation of the NamedCurveRegistry interface.
Author:
Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
  • Constructor Details

    • NamedCurveRegistryImpl

      public NamedCurveRegistryImpl()
      Default constructor.
    • NamedCurveRegistryImpl

      public NamedCurveRegistryImpl(List<NamedCurve> registry)
      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

      public void register(NamedCurve curve)
      Registers the given curve in the registry.
      Parameters:
      curve - the curve to register
    • unregister

      public void unregister(String name)
      Removes the given curve from the registry.
      Parameters:
      name - the curve name
    • getCurve

      public NamedCurve getCurve(String name)
      Gets a NamedCurve based on its name.
      Specified by:
      getCurve in interface NamedCurveRegistry
      Parameters:
      name - the name
      Returns:
      the NamedCurve or null if no match is found
    • getCurve

      public NamedCurve getCurve(Predicate<NamedCurve> predicate)
      Gets a NamedCurve based on the given predicate.
      Specified by:
      getCurve in interface NamedCurveRegistry
      Parameters:
      predicate - the predicate
      Returns:
      the first curve that matches the supplied predicate, or null if no matches are found
    • getCurves

      public List<NamedCurve> getCurves(Predicate<NamedCurve> predicate)
      Gets all curves that matches the given predicate.
      Specified by:
      getCurves in interface NamedCurveRegistry
      Parameters:
      predicate - the predicate
      Returns:
      a (possibly empty) list of NamedCurve objects