Class NistCurveProcessor
- All Implemented Interfaces:
CurveProcessor
Although the cofactor is 1 for all NIST curves, RFC 9380 still requires the "clear_cofactor" step
for consistency. In Bouncy Castle, invoking ECPoint.multiply(BigInteger.ONE) is not a
trivial no-op: it forces normalization of the internal point representation and ensures that the
returned point is in canonical affine form.
This normalization step is required for correct alignment with the specification and for matching the published test vectors. Returning the input point directly (without normalization) may leave the point in a projective or mixed representation, which causes test vector comparisons to fail even though the mathematical value of the point is the same.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd two points in the curve group.clearCofactor(ECPoint ecPoint) Clears the cofactor from the given elliptic curve point.Converts an elliptic-curve point into the affine (x, y) coordinate representation defined by the hash-to-curve suite.
-
Constructor Details
-
NistCurveProcessor
public NistCurveProcessor()Constructs a new instance of NistCurveProcessor. This class processes elliptic curve operations for NIST curves (P-256, P-384, P-521) with a cofactor of 1. It ensures compliance with RFC 9380 by performing required normalization steps, such as the "clear_cofactor" operation, to align the elliptic curve points with their canonical affine form and match published test vectors.
-
-
Method Details
-
add
Add two points in the curve group. Semantics are curve-model specific.- Specified by:
addin interfaceCurveProcessor
-
clearCofactor
Clears the cofactor from the given elliptic curve point.- Specified by:
clearCofactorin interfaceCurveProcessor- Parameters:
ecPoint- the elliptic curve point to process- Returns:
- the elliptic curve point with the cofactor cleared
-
mapToAffineXY
Description copied from interface:CurveProcessorConverts an elliptic-curve point into the affine (x, y) coordinate representation defined by the hash-to-curve suite.The returned coordinates are intended for serialization, testing, and interoperability with the reference outputs defined in RFC 9380. For most Weierstrass curves, this is simply the affine (x, y) coordinates of the given point. For curves that use a different coordinate model in the specification (e.g. Montgomery curves such as curve25519), this method applies the appropriate coordinate transformation.
This method does not change the underlying group element represented by the point. It only changes how that point is expressed as field elements. The input point is expected to be a valid point on the curve used by the implementation.
- Specified by:
mapToAffineXYin interfaceCurveProcessor- Parameters:
p- a valid elliptic-curve point- Returns:
- the affine (x, y) coordinates corresponding to the suite-specific representation of the given point
-