ECC.pyi 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. from typing import Union, Callable, Optional, NamedTuple, List
  2. from Cryptodome.Math.Numbers import Integer
  3. class UnsupportedEccFeature(ValueError): ...
  4. class EccPoint(object):
  5. def __init__(self, x: Union[int, Integer], y: Union[int, Integer]) -> None: ...
  6. def set(self, point: EccPoint) -> EccPoint: ...
  7. def __eq__(self, point: object) -> bool: ...
  8. def __neg__(self) -> EccPoint: ...
  9. def copy(self) -> EccPoint: ...
  10. def is_point_at_infinity(self) -> bool: ...
  11. @staticmethod
  12. def point_at_infinity() -> EccPoint: ...
  13. @property
  14. def x(self) -> int: ...
  15. @property
  16. def y(self) -> int: ...
  17. def double(self) -> EccPoint: ...
  18. def __iadd__(self, point: EccPoint) -> EccPoint: ...
  19. def __add__(self, point: EccPoint) -> EccPoint: ...
  20. def __mul__(self, scalar: int) -> EccPoint: ...
  21. class EccKey(object):
  22. curve: str
  23. def __init__(self, *, curve: str = ..., d: int = ..., point: EccPoint = ...) -> None: ...
  24. def __eq__(self, other: object) -> bool: ...
  25. def __repr__(self) -> str: ...
  26. def has_private(self) -> bool: ...
  27. @property
  28. def d(self) -> int: ...
  29. @property
  30. def pointQ(self) -> EccPoint: ...
  31. def public_key(self) -> EccKey: ...
  32. def export_key(self, **kwargs: Union[str, bytes, bool]) -> str: ...
  33. _Curve = NamedTuple("_Curve", [ ('p', Integer),
  34. ('b', Integer),
  35. ('order', Integer),
  36. ('Gx', Integer),
  37. ('Gy', Integer),
  38. ('G', EccPoint),
  39. ('names', List[str]),
  40. ('oid', str)
  41. ])
  42. _curve : _Curve
  43. def generate(**kwargs: Union[str, Callable]) -> EccKey: ...
  44. def construct(**kwargs: Union[str, int]) -> EccKey: ...
  45. def import_key(encoded: Union[bytes, str], passphrase: Optional[str]=None) -> EccKey: ...