pyecsca.ec.params module¶
Provides functions for obtaining domain parameters from the std-curves repository [STD].
It also provides a domain parameter class and a class for a whole category of domain parameters.
- class pyecsca.ec.params.DomainParameters(curve, generator, order, cofactor, name=None, category=None)[source]¶
Bases:
object
Domain parameters which specify a subgroup on an elliptic curve.
-
curve:
EllipticCurve
¶
-
order:
int
¶
-
cofactor:
int
¶
-
name:
Optional
[str
]¶
-
category:
Optional
[str
]¶
- to_coords(coordinate_model)[source]¶
Convert the domain parameters into a different coordinate model, only possible if they are currently affine.
- Parameters:
coordinate_model¶ (
CoordinateModel
) – The target coordinate model.- Return type:
- Returns:
The transformed domain parameters
-
curve:
- class pyecsca.ec.params.DomainParameterCategory(name, description, curves)[source]¶
Bases:
object
A category of domain parameters.
-
name:
str
¶
-
description:
str
¶
-
curves:
List
[DomainParameters
]¶
-
name:
- pyecsca.ec.params.load_category(file, coords, infty=True)[source]¶
Load a category of domain parameters containing several curves from a JSON file.
- Parameters:
file¶ (
Union
[str
,Path
,BinaryIO
,IO
[bytes
]]) – The file to load from.coords¶ (
Union
[str
,Callable
[[str
],str
]]) – The name of the coordinate system to use. Can be a callable that takes as argument the name of the curve and produces the coordinate system to use for that curve.infty¶ (
Union
[bool
,Callable
[[str
],bool
]]) – Whether to use the specialInfinityPoint
(True) or try to use the point at infinity of the coordinate system. Can be a callable that takes as argument the name of the curve and returns the infinity option to use for that curve.
- Return type:
- Returns:
The category.
- pyecsca.ec.params.load_params(file, coords, infty=True)[source]¶
Load a curve from a JSON file.
- Parameters:
file¶ (
Union
[str
,Path
,BinaryIO
]) – The file to load from.coords¶ (
str
) – The name of the coordinate system to use.infty¶ (
bool
) – Whether to use the specialInfinityPoint
(True) or try to use the point at infinity of the coordinate system.
- Return type:
- Returns:
The curve.
- pyecsca.ec.params.load_params_ecgen(file, coords, infty=True)[source]¶
Load a curve from a file that is output of ecgen.
- Parameters:
file¶ (
Union
[str
,Path
,BinaryIO
]) – The file to load from.coords¶ (
str
) – The name of the coordinate system to use.infty¶ (
bool
) – Whether to use the specialInfinityPoint
(True) or try to use the point at infinity of the coordinate system.
- Return type:
- Returns:
The curve.
- pyecsca.ec.params.load_params_ectester(file, coords, infty=True)[source]¶
Load a curve from a file that uses the format of ECTester.
- Parameters:
file¶ (
Union
[str
,Path
,BinaryIO
]) – The file to load from.coords¶ (
str
) – The name of the coordinate system to use.infty¶ (
bool
) – Whether to use the specialInfinityPoint
(True) or try to use the point at infinity of the coordinate system.
- Return type:
- Returns:
The curve.
- pyecsca.ec.params.get_category(category, coords, infty=True)[source]¶
Retrieve a category from the std-curves database at https://github.com/J08nY/std-curves.
- Parameters:
category¶ (
str
) – The category to retrieve.coords¶ (
Union
[str
,Callable
[[str
],str
]]) – The name of the coordinate system to use. Can be a callable that takes as argument the name of the curve and produces the coordinate system to use for that curve.infty¶ (
Union
[bool
,Callable
[[str
],bool
]]) – Whether to use the specialInfinityPoint
(True) or try to use the point at infinity of the coordinate system. Can be a callable that takes as argument the name of the curve and returns the infinity option to use for that curve.
- Return type:
- Returns:
The category.
- pyecsca.ec.params.get_params(category, name, coords, infty=True)[source]¶
Retrieve a curve from a set of stored parameters.
Uses the std-curves database at https://github.com/J08nY/std-curves.
- Parameters:
category¶ (
str
) – The category of the curve.name¶ (
str
) – The name of the curve.coords¶ (
str
) – The name of the coordinate system to use.infty¶ (
bool
) – Whether to use the specialInfinityPoint
(True) or try to use the point at infinity of the coordinate system.
- Return type:
- Returns:
The curve.