Package org.opensaml.security.crypto.ec.curves

# Class AbstractNamedCurve

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.security.crypto.ec.curves.AbstractNamedCurve

All Implemented Interfaces:
  `Component`, `DestructableComponent`, `InitializableComponent`, `NamedCurve`

Direct Known Subclasses:
  `BrainpoolP256r1`, `BrainpoolP320r1`, `BrainpoolP384r1`, `BrainpoolP512r1`, `Secp112r1`, `Secp112r2`, `Secp128r1`, `Secp128r2`, `Secp160k1`, `Secp160r1`, `Secp160r2`, `Secp192k1`, `Secp192r1`, `Secp224k1`, `Secp224r1`, `Secp256k1`, `Secp256r1`, `Secp384r1`, `Secp521r1`, `Sect113r1`, `Sect113r2`, `Sect131r1`, `Sect131r2`, `Sect163k1`, `Sect163r1`, `Sect163r2`, `Sect193r1`, `Sect193r2`, `Sect233k1`, `Sect233r1`, `Sect239k1`, `Sect283k1`, `Sect283r1`, `Sect409k1`, `Sect409r1`, `Sect571k1`, `Sect571r1`, `X962c2tnb191v1`, `X962c2tnb191v2`, `X962c2tnb191v3`, `X962c2tnb239v1`, `X962c2tnb239v2`, `X962c2tnb239v3`, `X962c2tnb359v1`, `X962c2tnb431r1`, `X962prime192v2`, `X962prime192v3`, `X962prime239v1`, `X962prime239v2`, `X962prime239v3`

public abstract class AbstractNamedCurve extends AbstractInitializableComponent implements NamedCurve
Abstract base class for implementations of `NamedCurve`.

## Field Summary

Fields
Modifier and Type
Field
Description
`private final org.slf4j.Logger`
`log`
Logger.
`private ECParameterSpec`
`paramSpec`
Instance of `ECParameterSpec` corresponding to the curve.

## Constructor Summary

Constructors
Constructor
Description
`AbstractNamedCurve()`

## Method Summary

Modifier and Type
Method
Description
`ECParameterSpec`
`buildParameterSpec()`
Build an instance of `ECParameterSpec` corresponding to this curve.
`protected void`
`doInitialize()`
`ECParameterSpec`
`getParameterSpec()`
Get the curve's `ECParameterSpec`.
`String`
`toString()`

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.opensaml.security.crypto.ec.NamedCurve

`getKeyLength, getName, getObjectIdentifier, getURI`

## Field Details

### log

@Nonnull private final org.slf4j.Logger log
Logger.

### paramSpec

@NonnullAfterInit private ECParameterSpec paramSpec
Instance of `ECParameterSpec` corresponding to the curve.

## Constructor Details

### AbstractNamedCurve

public AbstractNamedCurve()

## Method Details

### getParameterSpec

@Nonnull public ECParameterSpec getParameterSpec()
Get the curve's `ECParameterSpec`.

Specified by:
  `getParameterSpec` in interface `NamedCurve`
Returns:
  the parameter spec instance

### doInitialize

protected void doInitialize() throws ComponentInitializationException

Overrides:
  `doInitialize` in class `AbstractInitializableComponent`
Throws:
  `ComponentInitializationException`

### buildParameterSpec

@Nullable public ECParameterSpec buildParameterSpec()
Build an instance of `ECParameterSpec` corresponding to this curve.

The default implementation here is that it first attempts to resolve the curve from Bouncy Castle's `ECNamedCurveTable`. If that is unsuccessful then it attempts a brute force approach by generating a key pair using a `ECGenParameterSpec` based on the curve's name from `NamedCurve.getName()`, returning the parameter instance from the resulting `ECPublicKey`.

Returns:
  the parameter spec instance, or null if can not be built

### toString

public String toString()

Overrides:
  `toString` in class `Object`