java.lang.Object
net.i2p.crypto.ECUtil
Elliptic curve utility functions for cryptographic operations.
This class provides essential mathematical operations for elliptic curve cryptography used throughout I2P, including scalar multiplication, point operations, and curve parameter handling. It supports multiple curve types with optimized implementations for common cryptographic operations.
Key operations include:
- Scalar multiplication of curve points
- Point addition and doubling operations
- Curve parameter validation and extraction
- Support for standard NIST curves (P-192, P-256, P-384, P-521)
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final BigIntegerThe constant 3.private static final BigIntegerThe constant 2.Constructor Summary
ConstructorsMethod Summary
All MethodsModifier and TypeMethodDescriptionprivate static ECPointaddPoint(ECPoint r, ECPoint s, EllipticCurve curve) Adds two points on a curve.private static ECPointdoublePoint(ECPoint r, EllipticCurve curve) Doubles a point on a curve.
Field Details
TWO
The constant 2.THREE
The constant 3.
Constructor Details
ECUtil
ECUtil()Constructor. Every operation below is a static function of its curve arguments, so an instance holds nothing.
Method Details
addPoint
Adds two points on a curve.- Parameters:
r- the first points- the second pointcurve- the curve they lie on- Returns:
- the sum of the two points
doublePoint
Doubles a point on a curve.- Parameters:
r- the point to doublecurve- the curve it lies on- Returns:
- twice the point